Texture Instancing Compound

Plugins linking to this thread: (hide)

Texture instancing Shader V1.5Author: Reinhard Claus
Updated April 2013 with the ability to fetch the texture offset from an ICE attribute. Previous update added texturable scale X/Y.

The basic function of this shader is to stamp an instance of the selected texture at each particle location on the shaded object.

The shader requires an ICE particle cloud as a texture placing source which has to have its material shared with the object. It has features such as: Modify texture base scaling and rotation, various lookup options for fractal-like patterns, random position offset in texture, rotation by ICE particle vector attribute, random rotation, orient towards a vector or a tangent map. Mental ray only. See the si-community thread for some interesting looking renders created by Rob Chapman.

Mad props to Paul Smith aka pooby for inventing this wonderful method. If you haven't already, check his videos page for loads of ICE inspiration. Btw Paul's first video introducing the method is here. Btw #2: Since, he's created two videos demonstrating this shader: Texture Instancing Shader and Lizard texinstancing.

local backup: Texture Instancing.1.5.xsirtcompound

User avatar
rray
Moderator
Posts: 1570
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany

Texture Instancing Compound

Post by rray » 20 Jun 2012, 02:01

Texture Instancing Shader

Image

Mad props to Paul Smith aka pooby for inventing this wonderful method. If you haven't already, check his vimeo videos page for loads of ICE inspiration. Btw Paul's first video introducing the method is here: http://vimeo.com/33908339

Since, he's added 2 videos demonstrating this shader: https://vimeo.com/56627504 and https://vimeo.com/56762083. Cheers!


How it works

Basic function of this shader is to stamp an instance of the selected texture at each particle location on the shaded object.

Usage

Shader setup is really simple. Basically you only need a point cloud and an object that share the same material.

For a quick test do the following: Create a new scene, create polymesh sphere, create point cloud sphere, plug "Texture Instancing" into Scene_Material's surface port. Open the shader's PPG, pick the point cloud, then the noicon.pic texture, render.

Now all texture instances are oriented upwards. This is because of the chosen rotation method ("Custom Vector" at 0,1,0). You can enter a different orientation vector here, or use a tangent property. Another option is to have each particle have a texture orientation vector of its own, which has to be created as a point cloud attribute using ICE (See example scene posted below).

Usually for heavily randomized texture instances (like pebbles, sand etc.), using custom vector or tangents will be enough. For "flow" type setups with ICE, the third option has to be used.

To show different bits of the same texture, as Paul did in the first video, you'll have to scale up the texture quite a bit, and use random position offsets. If you see uniformly colored parts appear, try the "wrap" option.

Some notes to sum this up:

(*) Only for mental ray, but with rendermapping the result will be usable in other renderers too.
(*) Make sure the point cloud has a shared material as the textured object (Same material is not enough)
(*) ICE attribute vectors get projected on the surface, and used as the Y up axis for the stamped texture. Ideally the vector attribute would be parallel to textured surface, otherwise there'll be a little distortion (which is true for the other methods, custom vector and tangents, as well)

I hope it works for you! report bugs and crashes and post pretty pictures as usual ))


(Updates)
V1.2 has an option to add roughness to the cell borders/blend them + added commentary inside the compound
V1.3 has Scale X and Scale Y exposed separately and also has closest particle position exposed as an output.
V1.4 bug fix. shearing occured when using different X and Y scales and rotation. Now Tex Size and Offsets are in SI Units, so your values might need to be a little different.
V1.4 bug fix. Didn't work with SI 2012 (which has an older Edit UV node)
V1.5 ability to read offset from an ICE attribute, PPG UI a bit reorganized
You do not have the required permissions to view the files attached to this post.
Last edited by rray on 22 Jun 2012, 15:16, edited 4 times in total.
"as a maya discussion grows longer, the probability of a suggestion involving deleting the preferences approaches one"

softimage resources section (formerly known as rray.de/xsi) updated May 30 2018

User avatar
rray
Moderator
Posts: 1570
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany

Re: Texture Instancing Compound

Post by rray » 21 Jun 2012, 02:04

Some experiments using the settings on the lookup tab:

Image

first one is the "smear" preset, second one has settings 25 0,316 1,32 for both lookup properties
"as a maya discussion grows longer, the probability of a suggestion involving deleting the preferences approaches one"

softimage resources section (formerly known as rray.de/xsi) updated May 30 2018

scaron
Posts: 119
Joined: 08 Jul 2009, 05:16

Re: Texture Instancing Compound

Post by scaron » 21 Jun 2012, 03:38

interesting! reminds me of the modo tool that came out recently in 601, 'texture replicators'?

Pooby
Posts: 495
Joined: 27 Aug 2010, 22:25

Re: Texture Instancing Compound

Post by Pooby » 21 Jun 2012, 09:44

Wow. Thanks for this. I can't wait to test it out when I get to a workstation.
Having it as a shader makes so much sense.

Thanks too for the compliments

User avatar
rray
Moderator
Posts: 1570
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany

Re: Texture Instancing Compound

Post by rray » 21 Jun 2012, 16:05

Thank you both for your feedback.

Yes the modo feature looks similar. Would like to have added blending between the instances as an option, but it looks like it isn't possible. I think with high particle counts things could also become blurry with the blending.
"as a maya discussion grows longer, the probability of a suggestion involving deleting the preferences approaches one"

softimage resources section (formerly known as rray.de/xsi) updated May 30 2018

Pooby
Posts: 495
Joined: 27 Aug 2010, 22:25

Re: Texture Instancing Compound

Post by Pooby » 22 Jun 2012, 17:43

Its a shame it wont work with Arnold. I'm useless with Mental ray.

User avatar
rray
Moderator
Posts: 1570
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany

Re: Texture Instancing Compound

Post by rray » 23 Jun 2012, 01:31

Couldn't test on Arnold but I was afraid that might be so because of the Point_cloud_lookup node I used.
This one exports the whole cloud to mental ray for the closest points lookup. I think they may have used the same (super fast) code they use for the ICE lookups, which is probably not available to Solidangle.
Once Arnold should support such lookups though, I'll do my best to help rewiring this compound for Arnold.
Until then maybe it's good for rendermapping... then again that's exactly what pixelparticles does with your setup... hm...
"as a maya discussion grows longer, the probability of a suggestion involving deleting the preferences approaches one"

softimage resources section (formerly known as rray.de/xsi) updated May 30 2018

User avatar
rray
Moderator
Posts: 1570
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany

Re: Texture Instancing Compound

Post by rray » 24 Jun 2012, 22:07

How to control the texture's scale with another ICE attribute:

Image
"as a maya discussion grows longer, the probability of a suggestion involving deleting the preferences approaches one"

softimage resources section (formerly known as rray.de/xsi) updated May 30 2018

User avatar
mixepix
Posts: 78
Joined: 09 Aug 2010, 15:17
Location: Sweden

Re: Texture Instancing Compound

Post by mixepix » 25 Jun 2012, 11:17

This looks sweet! Thanks for sharing. :)
----------------------------------------
http://vimeo.com/mikaelpettersen

User avatar
Tekano
Posts: 488
Joined: 09 Jun 2009, 14:49
Location: London, UK

Re: Texture Instancing Compound

Post by Tekano » 01 Jul 2012, 03:42

this is seriously cool for generating a lot of variety and detail!

Image

Image

Image

Image

Image

Image

Image
Gossip is what no one claims to like, but everybody enjoys.

User avatar
rray
Moderator
Posts: 1570
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany

Re: Texture Instancing Compound

Post by rray » 03 Jul 2012, 23:59

Thanks for posting Rob, interesting patterns! Very alien :ymalien:
"as a maya discussion grows longer, the probability of a suggestion involving deleting the preferences approaches one"

softimage resources section (formerly known as rray.de/xsi) updated May 30 2018

User avatar
druitre
Posts: 459
Joined: 25 Jun 2009, 23:35

Re: Texture Instancing Compound

Post by druitre » 31 Jul 2012, 18:23

rray wrote:How to control the texture's scale with another ICE attribute:

Image
Hi Ray, can you explain a bit more about how you're doing this? I don't get anything useful out of it - just uniform color. Actually, what I'm looking for is a way to have particle size drive texture size directly. But an explanation of how to get any of the particle's attributes into the rendertree would be equally sweet.

thanks, Jasper

User avatar
rray
Moderator
Posts: 1570
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany

Re: Texture Instancing Compound

Post by rray » 31 Jul 2012, 18:36

Hi!
point_cloud_lookup does only see vector attributes, you'll have to convert the size (which is a scalar) into a custom vector atttribute, or "abuse" the scale attribute like is done here:
ti-settings.png
In that case you'll have to use the ICE tree to set for example the scale Y value to size, then extract the Y in the render tree.

"In" always has to be PointPosition
"Out" is the attribute you want to output by the node
You do not have the required permissions to view the files attached to this post.
"as a maya discussion grows longer, the probability of a suggestion involving deleting the preferences approaches one"

softimage resources section (formerly known as rray.de/xsi) updated May 30 2018

User avatar
druitre
Posts: 459
Joined: 25 Jun 2009, 23:35

Re: Texture Instancing Compound

Post by druitre » 31 Jul 2012, 19:22

Thanks for the quick response!

Still no go, though. Followed your picture and when that didn't work tried the custom vector attribute (named it 'texsize', see picture). It still looks like no data is actually received - is it possible to 'show value' in rendertree like in ICEtree?
ScreenShot015.jpg
(BTW, I also did some variations, without succes. Can you explain what the vector_state/intersection point node is doing? Is it necessary?)
You do not have the required permissions to view the files attached to this post.

User avatar
rray
Moderator
Posts: 1570
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany

Re: Texture Instancing Compound

Post by rray » 31 Jul 2012, 19:56

Sorry, I forgot to pick a point cloud in the PPG screenshot I just posted -- that could well be the issue here.

The other thing that's important is that bth the object and the PPG share the same mat. In case it's still not working I'll post a scene here tomorrow.

Intersection point ist the coordinate of the rendered point--- this tells the point_cloud_lookup node where to start looking for nearby points. It could find that out by itself, but exposing it to the users adds some additional control.
"as a maya discussion grows longer, the probability of a suggestion involving deleting the preferences approaches one"

softimage resources section (formerly known as rray.de/xsi) updated May 30 2018

User avatar
druitre
Posts: 459
Joined: 25 Jun 2009, 23:35

Re: Texture Instancing Compound

Post by druitre » 01 Aug 2012, 11:39

Nope, the 'variations' I mentioned in my previous post definitely included picking the pointcloud and trying out all combinations of vector state, attributes, map lookup settings etc. Looks like I'm gonna be asking you for that example scene :)