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
Instancing
5774 7 2- Bernard
- Member
- 523 posts
- Joined: 7月 2005
- Offline
- andrewlowell
- Member
- 537 posts
- Joined: 12月 2005
- Offline
- fxrod
- 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[
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[
Francisco Rodriguez
Effects Animator | Walt Disney Animation Studios
Effects Animator | Walt Disney Animation Studios
- wolfwood
- 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]
http://odforce.net/wiki/index.php/MantraInstancing [odforce.net] [wikipedia.com]
if(coffees<2,round(float),float)
- Bernard
- Member
- 523 posts
- Joined: 7月 2005
- Offline
- old_school
- スタッフ
- 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).
… 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!
- Bernard
- Member
- 523 posts
- Joined: 7月 2005
- Offline
- jason_iversen
- 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]
also, http://www.odforce.net [www.odforce.net]
-
- Quick Links