Hi!
I'm trying to procedurally add a material per piece of my geometry inside a for loop, but it does not work (the material created is always the last iteration number).
Any idea how to fix that?
(attached is the hip file)
Thanks!
Labs Quick Material and For Each Connected Piece Loop
2869 3 1- Bill_Sansky
- Member
- 20 posts
- Joined: 9月 2018
- Offline
- jsmack
- Member
- 8037 posts
- Joined: 9月 2011
- Online
I think the labs quick material only contains one material, varying it on each iteration only results in one material because materials are created as nodes. To procedurally vary a material, either vary attributes bound to the material, or use stylesheets to create material variations.
In LOPs (solaris) it is possible to create materials in loops, but this is a totally different usd based workflow that does not work with mantra and many renderers are not feature complete with yet.
In LOPs (solaris) it is possible to create materials in loops, but this is a totally different usd based workflow that does not work with mantra and many renderers are not feature complete with yet.
- Bill_Sansky
- Member
- 20 posts
- Joined: 9月 2018
- Offline
Good point, sadly that won't work for me since I am trying to export an fbx to be used in Unity.
However I found a dirty trick to make it work: adding an attribute named sop_materialpath varying per piece creates a material per piece on export, even though they do not point to specific materials in Houdini.
However I found a dirty trick to make it work: adding an attribute named sop_materialpath varying per piece creates a material per piece on export, even though they do not point to specific materials in Houdini.
- Alan S Johnson JR
- Member
- 3 posts
- Joined: 6月 2018
- Online
this took me a while to get right, however I didn't really find a straight forward answer to this in my search so I am updating this post and the other only one I have seen with this answer.
01) use an attribute wrangle to create an id attribute for each piece set to primitives
02) then use attribute create - set the name to shop_materialpath - set the class to primitive - set the type to string - in the string identifier use material.$ID
this will export your geometry with materials for each piece that can be read by unity, UE5, element 3d and so on. I hope helps answer this question for others in the future more clearly.
01) use an attribute wrangle to create an id attribute for each piece set to primitives
02) then use attribute create - set the name to shop_materialpath - set the class to primitive - set the type to string - in the string identifier use material.$ID
this will export your geometry with materials for each piece that can be read by unity, UE5, element 3d and so on. I hope helps answer this question for others in the future more clearly.
Edited by Alan S Johnson JR - 2023年11月11日 11:05:20
-
- Quick Links