It is currently 20 May 2013, 16:24

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 14 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Texture instancing?
PostPosted: 07 Apr 2012, 16:58 
Offline
User avatar

Joined: 20 Mar 2011, 02:01
Posts: 306
Location: Leiden, the Netherlands
Hi guys i'm looking for a way to automate "texture bombing" along a grid, what i wan't seems pretty basic: get multiple textures that form a pattern randomly distributed along a grid (point could). Texture wise it would be derived from this technique: http://www.digitalartform.com/archives/2009/05/make_a_maze_in.html This works great for getting "greebled" maps but it has the drawback that it needs a set size for the surface and the set-up can't be automated. (you can make a few actions in PS to speed things up but it still requires a lot of setup to get a different pattern each time)

So what i would like to do is a 2d/texture version of this:
Attachment:
Capture.PNG
Capture.PNG [ 33.64 KiB | Viewed 452 times ]


Its just some geometry of pipes that form a "maze" instanced on a grid point cloud, simple right? But i don't know how to do this with textures.. the closest thing i could find was this http://caffeineabuse.blogspot.com/2011/12/particle-sprites-using-ice.html - that would work if just set the sprites to emit on a grid but ideally i would like to able to bake the "mazes" on objects for further shading/texturing..

Now i saw Paul Smith working with textures in ICE http://vimeo.com/groups/ice/videos/33908339 but unfortunately i can only catch the merest glimpse of his ICE tree so i have no idea how he's doing it :-l

Can anybody tell me how to get textures "instanced"??

Btw i also tried to get this effect using Enhance XSI nodes in the render tree but no joy, if anybody has a non-ICE solution that would be great too!

Thanks in advance! (%)

_________________
My Nooby Animation Project
KP on DA


Top
 Profile  
 
 Post subject: Re: Texture instancing?
PostPosted: 07 Apr 2012, 17:43 
Offline
Moderator
User avatar

Joined: 26 Sep 2009, 15:51
Posts: 778
Location: Bonn, Germany
I think what Paul does is, he creates a point cloud with Helge's "Pixel-particles" addon (which creates a particle for each texture pixel), and from these particles looks up closest particles in a second point cloud which consists of randomly distributed particles.

I assume he then samples a texture using a random rotation and offset. The key is that these two random values are unique to the looked-up particle, probably he simply plugged their IDs into the random seed value of the randomize nodes.

By setting that color on the pixel particles, the texture is being created "on thy fly".
(Just a guess!)

_________________
Image rray.de, a resource site for softimage, updated apr 13th


Top
 Profile  
 
 Post subject: Re: Texture instancing?
PostPosted: 07 Apr 2012, 19:35 
Offline
User avatar

Joined: 20 Mar 2011, 02:01
Posts: 306
Location: Leiden, the Netherlands
Hmm okay so i'll try out the pixel particles addon - i see from the vimeo introduction that it can be used to bake textures based an particle info, i'm hoping that maybe if i combine that with the sprites method perhaps i can bake in many randomized textures placed evenly...

- i hope i'm not sounding really stupid here, i have no idea if that's a workable solution...

_________________
My Nooby Animation Project
KP on DA


Top
 Profile  
 
 Post subject: Re: Texture instancing?
PostPosted: 07 Apr 2012, 19:50 
Offline
User avatar

Joined: 20 Mar 2011, 02:01
Posts: 306
Location: Leiden, the Netherlands
PS: i found the addon on your site but do you know where i could get the sample scenes i see in the video? They would probably help me out ;)

_________________
My Nooby Animation Project
KP on DA


Top
 Profile  
 
 Post subject: Re: Texture instancing?
PostPosted: 07 Apr 2012, 20:16 
Offline
Administrator
User avatar

Joined: 04 Jun 2009, 12:15
Posts: 3206
The Sample Scenes were only included with the very first incarnation of the plugin AFAIK (the one named "sixbirds_pixelparticles.2010_SP1_1.0.xsiaddon", but you'd still have to manually change some compounds to get them to work with the new version. I'll send you a PM with a download link...
;)

_________________
currently sporting a broken arm - response time decreased


Top
 Profile  
 
 Post subject: Re: Texture instancing?
PostPosted: 07 Apr 2012, 21:10 
Offline
Moderator
User avatar

Joined: 26 Sep 2009, 15:51
Posts: 778
Location: Bonn, Germany
Second thoughts... using pixel particles for this is probably double overkill.

Probably easiest and also scriptable is using the "UV Mapping Per Face" addon.

If you put all your textures in 1 big tiled image, you could modify the script so that it doesn't assign the whole 0,0-1,1 range to each face but a random smaller tile.

_________________
Image rray.de, a resource site for softimage, updated apr 13th


Top
 Profile  
 
 Post subject: Re: Texture instancing?
PostPosted: 07 Apr 2012, 21:48 
Offline
User avatar

Joined: 20 Mar 2011, 02:01
Posts: 306
Location: Leiden, the Netherlands
Ai that sounds very sensible but where i can work a little with ICE and look at an ICE tree to see how it works i don't know any python at all... Looking at the script i have no idea where it's asigning the texture space...

I have to think about this... not sure what would be more hassle: doing it in a roundabout ICE way or taking a crash course in pyhon...

EDIT: what am i saying? I'll keep trying in ICE because i really don't know any python. Too bad though :(

_________________
My Nooby Animation Project
KP on DA


Last edited by Kerro Perro on 07 Apr 2012, 21:55, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Texture instancing?
PostPosted: 07 Apr 2012, 21:55 
Offline
Moderator
User avatar

Joined: 26 Sep 2009, 15:51
Posts: 778
Location: Bonn, Germany
simplest solution follows :D
edit ntiles in top area.. use 3.0 for 9 tiles, 4.0 for 16 tiles etc...

(* script is a documentation sample that Piotrek Marczak made into a working script, I only did the scrambling part)

Code:
from win32com.client import constants as c
import random
x = Application
sel = x.Selection
true = 1
false = 0
ntiles = 5.0
null = None

def FindUVCluster(in_obj, in_Name):
   oClusters = in_obj.ActivePrimitive.Geometry.Clusters.Filter("Sample")
   for oCluster in oClusters:
      oProps = oCluster.Properties.Filter("uvspace")
      for oProp in oProps:
         if (oProp.Name == in_Name):
            return oProp
   print "Cluster not found"
   return null
   
def SetUVsPerFace(in_obj, in_uvprop):
   oProgressBar = XSIUIToolkit.ProgressBar
   oUVElements = in_uvprop.Elements
   oCluster = in_uvprop.Parent
   count = oUVElements.Count
   tup = oUVElements.Array
   #tuple to list - wtf...
   elArray = [1-tup[j][i] for i in range(len(tup[0])) for j in range(len(tup))]
   #zeroout uvs
   for i in range(len(elArray)):
      elArray[i] = 0 
   
   oFacets = in_obj.ActivePrimitive.Geometry.Facets
   #progressbar init
   oProgressBar.Maximum = oFacets.Count
   oProgressBar.Step = 1
   oProgressBar.Caption = "Creating UVs"
   oProgressBar.CancelEnabled = true
   oProgressBar.Visible = true
   for ofacet in oFacets:   
      oSamples = ofacet.Samples
      cntSamples = oSamples.Count
      sample0cidx = oCluster.FindIndex(oSamples(0).Index)
      sample1cidx = oCluster.FindIndex(oSamples(1).Index)
      sample2cidx = oCluster.FindIndex(oSamples(2).Index)   
      XOFF = random.randint(1,ntiles)/ntiles
      YOFF = random.randint(1,ntiles)/ntiles
      elArray[sample0cidx*3] = XOFF - 1.0/ntiles
      elArray[sample0cidx*3+1] = YOFF - 1.0/ntiles
      elArray[sample1cidx*3] = XOFF
      elArray[sample1cidx*3+1] = YOFF - 1.0/ntiles
      elArray[sample2cidx*3] = XOFF
      elArray[sample2cidx*3+1] = YOFF
      if (cntSamples >=4):
         sample3cidx = oCluster.FindIndex(oSamples(2).Index)
         elArray[oSamples(3).Index*3] = XOFF - 1.0/ntiles
         elArray[oSamples(3).Index*3+1] = YOFF
      oProgressBar.Increment()
      if oProgressBar.CancelPressed == true:
         break
   oUVElements.Array = elArray
   oProgressBar.Visible = false
   return true
   
#main
for s in sel:
   
   if s.type != "polymsh":
      print "Select poly mesh"
   else:
      oGeo = s.Activeprimitive.Geometry
      prjName = "PerFaceUVs"
      print "Setting Uvs on " + s.FullName
      rtn = x.CreateProjection(s.FullName, "", "","", prjName,true)
      cluster = FindUVCluster(s, rtn[1])
      SetUVsPerFace(s, cluster)
   

_________________
Image rray.de, a resource site for softimage, updated apr 13th


Top
 Profile  
 
 Post subject: Re: Texture instancing?
PostPosted: 07 Apr 2012, 21:57 
Offline
User avatar

Joined: 20 Mar 2011, 02:01
Posts: 306
Location: Leiden, the Netherlands
Haha wow that was insanely fast! Ignore my edit i made on my last comment i guess! ;)

_________________
My Nooby Animation Project
KP on DA


Top
 Profile  
 
 Post subject: Re: Texture instancing?
PostPosted: 07 Apr 2012, 22:00 
Offline
Moderator
User avatar

Joined: 26 Sep 2009, 15:51
Posts: 778
Location: Bonn, Germany
If you want random rotation for the tiles, do a subdivide polys on the grid - this will scramble the UVs.

_________________
Image rray.de, a resource site for softimage, updated apr 13th


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group