Unwrapping UVs per material (Houdini Engine for Maya)

   1633   2   0
User Avatar
Member
11 posts
Joined: 7月 2024
Offline
Hello,

I've looked around the forums and webs for info, but there is surprisingly little that I have found regarding materials and Houdini Engine for Maya. I am able to get this working in Houdini, but it doesn't output anything when brought into Maya as an HDA.

I have an object in maya, which I want to plug into a Houdini HDA that will loop through all the materials, and perform a UV unwrap on all faces/primitives that use that material. For example, a sphere with Material 1 on the top hemisphere, and Material 2 on the bottom will result in the UVs of each hemisphere being stacked on top of each other like in the attached image. It would be great if I had a way to automate this process of selecting the faces with different materials, and unwrapping them.
If there's anyone out there who is familiar with material manipulation between Houdini and Maya, some pointers, or example setup would be much appreciated.
Thanks!
Edited by GorbMocker45 - 2024年8月19日 03:58:25

Attachments:
help1.png (52.5 KB)

"Where's my money, Samuel?"
User Avatar
Member
11 posts
Joined: 7月 2024
Offline
I figured out the first problem that I was having:
The material and object attribute names for maya are different from Houdini. If you want Houdini to loop through these in Maya you have to change the 'piece attribute' in the 'foreach_end' node to the attributes that Maya are passing in.
Use 'name' instead of 'class' to loop through each Maya object.
Use 'maya_shading_group' instead of 'material_name' to loop through each Maya material. (Attached image shows the node and parameter box to change.)

Though, now I've hit another wall- the HDA doesn't preserve multi-material assignments in the output meshes. The meshes that are put out have the correct UVs, but their faces lose the material assignments of the original input, and default back to all faces bearing lambert1.

I've looked around at the forums and blog posts, and I see that this seems to be a common issue. Has anyone found a solution for preserving multiple material assignments on a Maya mesh that is being passed through an HDA via the Houdini Engine for Maya?

Attachments:
loopattribute.png (13.4 KB)

"Where's my money, Samuel?"
User Avatar
Member
11 posts
Joined: 7月 2024
Offline
I figgered it out in the meantime.
I was using the labs texel density node to keep my UVs consistent in size, and it turns out that that node creates some additional primitive attributes. It seems that adding additional primitive attributes messes with Maya's material assignments. My guess is that adding primitive attributes changes the index where Maya was previously looking for the shader group attribute.

To illustrate:

Maya mesh goes in with attribute 1, and attribute 2. Maya knows that the first entry is the shader group. The HDA adds another primitive attribute on front of the stack. The mesh coming out has attribute 1, attribute 2, and attribute 3. Attribute 1 is the new attribute, and attribute 2 is now the shader group, and attribute 3 is former attribute 2. Maya is confused because attribute 1 no longer has any shader group info.

I'm not a programmer, so perhaps someone will be able to explain it more accurately than I.

Dilemma solved.
I almost cried I was so relieved.

Attachments:
help2.png (98.8 KB)

"Where's my money, Samuel?"
  • Quick Links