Instancing

   5774   7   2
User Avatar
Member
523 posts
Joined: 7月 2005
Offline
Hello,


I've got a little particle system and use point instancing to copy my geometry.
Is it possible in Houdini to use a different shader for each instanced geo, and how can I do this ?



thnaks,


bernard
User Avatar
Member
537 posts
Joined: 12月 2005
Offline
could you stamp a switch which gets it's feeds from different shader sops?
User Avatar
Member
133 posts
Joined: 7月 2005
Offline
Hi Bernard:

If you number your shaders (shader_01, shader_02, etc) you could randomly assign a shop_vm_surface attribute to the points by using an expression in an attribute SOP. The shop_vm_surface string attribute contains a path that tells mantra where the shaders live in your file.

So, if you create a string attribute in the attribute sop, you could use and expression, such as:
/obj/example/shopnet1/shader_0`rint(fit(rand($ID), 0, 1, 1, 3))`

Please see the attached example for further explanation.

Hope this helps!
Francisco Rodriguez[

Attachments:
instShaders.hip.gz (33.0 KB)

Francisco Rodriguez
Effects Animator | Walt Disney Animation Studios
User Avatar
Member
4262 posts
Joined: 7月 2005
Offline
Also, check out the od page here.

http://odforce.net/wiki/index.php/MantraInstancing [odforce.net] [wikipedia.com]
if(coffees<2,round(float),float)
User Avatar
Member
523 posts
Joined: 7月 2005
Offline
Thanks fxrod and Wolfwood.

The example works great!
Would it also be possible to randomize color, the same time you get ‘randomized’ shaders?

I see you're using $ID…What's the difference with $PT?
I believe $PT is the points?….


thanks again and greetings,


bern
User Avatar
スタッフ
2540 posts
Joined: 7月 2005
Offline
To randomize any shader parameter, you need to find the parameter in the shader string then override the values with say something like:
… diff `rand($ID +1.001)` 0 0 …
Make sure you surround your expression with backticks so that it will evaluate properly.

$ID is only valid when it's present. It is always created with a particle system or manually created with a Point SOP, Attribute Create SOP, etc. Just MMB on any SOP's icon and look for a point attribute called ‘id’ to see if you can use it.
'id' is simply a unique number per particle (instead of using $PT which get's recycled when particles die).
$PT is a local varialbe that is available in all SOPs that work on points directly (see that particular SOP's help card).
There's at least one school like the old school!
User Avatar
Member
523 posts
Joined: 7月 2005
Offline
Thanks Jeff, great explaining….
User Avatar
Member
12474 posts
Joined: 7月 2005
Online
Wolfwood
Also, check out the od page here.

http://odforce.net/wiki/index.php/MantraInstancing [odforce.net] [wikipedia.com]

Nice enhancements to the page, Wolfwood! Great stuff, thanks!
[wikipedia.com]
Jason Iversen, Technology Supervisor & FX Pipeline/R+D Lead @ Weta FX
also, http://www.odforce.net [www.odforce.net]
  • Quick Links