Good Day.
Can anyone suggest in LOPs how I might use an instance ID in a material. I'm trying to get material variation on each instance of a mesh.
Thank you for any ideas.
lor
Use instance ID in material?
3234 2 0- lor
- Member
- 292 posts
- Joined: Dec. 2007
- Offline
- simon_o
- Member
- 112 posts
- Joined: Oct. 2011
- Offline
Using the materialvariation node set to point instances and the instances parameter to something like
toggle use snippet and set the wrangle to:
value=index
.. which will give you the instanceid as a primvar, so it can be read in your material.
Though probably better for material variation would be to create a color3f primvar already with the desired variation color and just read that directly in your material.
To read primvars in Karma, you can just use a parameter node.
/myinstancerprim1[*]
, you could create a new primvar based on the index variable:toggle use snippet and set the wrangle to:
value=index
.. which will give you the instanceid as a primvar, so it can be read in your material.
Though probably better for material variation would be to create a color3f primvar already with the desired variation color and just read that directly in your material.
To read primvars in Karma, you can just use a parameter node.
Edited by simon_o - May 5, 2021 03:07:39
Pipeline @ RISE Visual Effects Studios
- rafal
- Staff
- 1454 posts
- Joined: July 2005
- Offline
Like Simon said. Here is an example.
P.S. For Karma, you should use Bind VOP rather than Parameter VOP, because inside Mat Lib LOP the semantics of a Parameter VOP is to create an input attribute on the material primitive, while Bind VOP is translated to the standard USD Primvar reader.
P.S. For Karma, you should use Bind VOP rather than Parameter VOP, because inside Mat Lib LOP the semantics of a Parameter VOP is to create an input attribute on the material primitive, while Bind VOP is translated to the standard USD Primvar reader.
Edited by rafal - May 5, 2021 11:03:00
-
- Quick Links