Hi guys
I'm currently trying to assign different shaders to a bunch of shapes in the same geo node using Arnold Operators in Houdini. Each shape has a primitive attribute called name with a unique value.
Now I'm trying to assign shaders to these shapes based on their names, but Arnold doesn't respond to any of the methods in the help documents on operators.
If I use an assign material node to assign a shader to a collection that grabs the whole geo node, everything works well. However trying to isolate the assignment further has been fruitless so far.
I've tried this:
COLLECTION NODE Selection: /obj/myObjects* Collection: myCollection ASSIGN MATERIAL NODE: Selection: #myCollection Shader Network: /shop/grey_mat
This works, all objects get a grey shader. Now this next thing doesn't work:
COLLECTION NODE Selection: /obj/myObjects* Collection: myCollection ASSIGN MATERIAL NODE: Selection: #myCollection and *.(name=='*nameValue*') Shader Network: /shop/grey_mat
Now no shaders are assigned even though they primitives in the geo node does have the primitive attribute. I've also tried this method, which doesn't work either:
COLLECTION NODE Selection: /obj/myObjects* Collection: myCollection ASSIGN MATERIAL NODE: Selection: #myCollection and *nameValue* Shader Network: /shop/grey_mat
Funny thing is, when I load similar geometry as a packed alembic. All the above methods work and shaders are assigned correctly. Anyone know what I'm doing wrong?
Any help is appreciated.
That "bunch of shapes in the same geo node" is probably exported a single polygon mesh. Export an ASS file and check.
Yes it is indeed exported as a single polygonal mesh. How do I make sure they stay as separate pieces of geo? Do I need to mimic a maya path attribute?
It makes sense now why only procedurals and packed alembics work then, because of their internal hierarchy that keeps shapes separate. Is there really no way around this other than caching out your geo with a hierarchy through the alembic rop node?
Yes currently all the geometry will be exported as a single mesh and the operator won't change the shader per polygon for example.
If you are instancing, you could look into using the copy to points with the pack and instance option, as this will create ginstances for each copy. Then you could try to use a selection based operator on a custom attribute such as the path attribute.
@Stephen It might be a good idea for the ASS exporter to use something like the SOP Alembic ROP, it can create a hierarchy from prim attributes, path by convention I think.
Another option would be to use prim groups, I'm not sure if this is possible either with operators currently.