Excuse the primitive questions…
I am creating some geometry via a Python script. There, to make it visible, I am assigning an attribute and set it to an arbitrary color, like this:
bla.setAttribValue(“Cd”,(0.25,0.5,0.0)) #green
Then, in Houdini, I do not seem to be able to change this color or assign materials. I think they get assigned but without any visible result.
Can you please advise on how to do this properly. I am obviously doing something wrong here…
Thank you.
Assign material/color
4363 5 1- anna_waldon
- Member
- 52 posts
- Joined: March 2008
- Offline
- anna_waldon
- Member
- 52 posts
- Joined: March 2008
- Offline
- pbowmar
- Member
- 7028 posts
- Joined: July 2005
- Offline
Hi Anna,
An attribute like Cd doesn't get picked up automatically unless you have a shader applied that uses it.
You can assign in the GUI via a Material SOP a shader, which really just adds a primitive string attribute to the geometry indicating what shader to use on those primitives. This could be easily duplicated in the HDK/Python as you're doing already with the Cd attribute.
Hope that helps!
Cheers,
Peter B
An attribute like Cd doesn't get picked up automatically unless you have a shader applied that uses it.
You can assign in the GUI via a Material SOP a shader, which really just adds a primitive string attribute to the geometry indicating what shader to use on those primitives. This could be easily duplicated in the HDK/Python as you're doing already with the Cd attribute.
Hope that helps!
Cheers,
Peter B
- anna_waldon
- Member
- 52 posts
- Joined: March 2008
- Offline
- pbowmar
- Member
- 7028 posts
- Joined: July 2005
- Offline
Well, briefly, when the IFD file is created in Houdini the attributes are parsed, and the appropriate shader is referenced so that Mantra knows which shader to apply to the geometry.
In the shader, there will be a Parameter VOP (assuming it's a standard Houdini Material) that creates VEX code that roughly looks like:
vector Cd = 0;
however if a 3float/vector attributes called Cd exists, it will completely replace this input per-point or primitive depending on if it's a point or prim attribute.
Hope that helps
Cheers,
Peter B
In the shader, there will be a Parameter VOP (assuming it's a standard Houdini Material) that creates VEX code that roughly looks like:
vector Cd = 0;
however if a 3float/vector attributes called Cd exists, it will completely replace this input per-point or primitive depending on if it's a point or prim attribute.
Hope that helps
Cheers,
Peter B
- anna_waldon
- Member
- 52 posts
- Joined: March 2008
- Offline
-
- Quick Links