Optimal way to assign shaders to faces


#1

This is for a transfer shader between different software tool I’m working on. The geometry shape nodes have a multi attribute with a long list of face indices for each shading group. The only way I’ve fount to assign those faces to a shadingGroup node is to run a loop through each face and with the sets command assign each face to a shadingGroup node. While this works fine for light geometries, when the geometry is large and the number of faces long, the script takes too long to finish if at all.

Is there a different, more optimal way to assign a long number of faces to a shadingGroup node?

PS. I’ve tried converting the long list of faces to the unflatten format Maya uses (ie .f[1:300] ) but that doesn’t seem to make anything better.


#2

Does not help with you Problem but assigning Shaders to Faces is a bad idea in general. Leads to a lot of troubles.

Just in case you are using Arnold you could try materialX to transfer the Shaders.


#3

I agree, face assignment is looking for trouble (although I think it shouldn’t be) but in this case it’s a requirement I can’t avoid.

No unfortunatelly it’s a max corona to maya redshift tool I’m working on. I’ve done the hard part -associating the shader data, but I’m stuck with this faceset assignment problem.

Thanks for your reply,