Assigning One Component Material Across USD Variants

   164   1   2
User Avatar
Member
1 posts
Joined: 3月 2023
オフライン
Hi everyone,

I’m creating USD assets for a project and have set up 3 object variants (3 SpeedTree palm trees) using Component Builder. Each tree has the same internal mesh names:

palmtree_01 (xform)
├─ leaf_01 (mesh)
├─ stem (mesh)
└─ palm_bark (mesh)

palmtree_02 (xform)
├─ leaf_01 (mesh)
├─ stem (mesh)
└─ palm_bark (mesh)

palmtree_03 (xform)
├─ leaf_01 (mesh)
├─ stem (mesh)
└─ palm_bark (mesh)


I want to assign the same materials (for example, leaf_01, palm_bark, stem) across all three variants, without duplicating Component Material nodes for each tree.

Currently:

If I use a filter like /ASSET/geo/render/palmtree*/Palm_Tree_Bark in the Material Assign LOP, only one tree receives the material when I export.

If I use the default lopinputprims('.', 0), the material is applied to all trees, but that only works for one material, so it doesn’t support multiple materials per mesh. (Unless I'm missing something)

The mesh names are the same, but the parent xforms are different (palmtree_01, palmtree_02, palmtree_03).

My workaround is to create three separate Component Material nodes, one per tree variant, but I’d like to avoid that since the materials are actually shared.

I’m trying to figure out:

Is it possible to assign multiple materials to meshes with the same name across different object variants in a single Component Material?

How should I structure the Material Assign LOP or Component Material to support this scenario?

Any guidance or best practices would be greatly appreciated!
User Avatar
スタッフ
4257 posts
Joined: 9月 2007
オフライン
Component Material, or really any of our material assignment nodes, you need some sort of prim in the scene, to author the binding.

If I were you, I would actually simplify things further in the asset setup you can. If you get rid of the number suffix, so all of your geometry variants' prims are just `/palmtree`, then your material binding can be done in one node, and you'd be good to go.

Another option is to do the material binding/creation from SOPs and your Component Geometry nodes. Create the `usdmaterialpath` attribute in SOPs, and set it to something like `/ASSET/mtl/leaf`. Then on the Component Geometry parameters, go to Primitives, and set Bind Materials to Create and Bind Materials Based on Imported Attribute. This will create empty materials, and bind them. Then in your Material Library, as long as you just create the materials at those same locations, you shouldn't have to do any binding on the Component Material LOP, and only need to use one of those nodes.

Attached is an example, hopefully this helps, but I would recommend keeping the scene graphs the same. That will simplify other operations down the road, such as light-linking perhaps.

Attachments:
usdmaterialpath_example.hip (412.1 KB)

I'm o.d.d.
  • Quick Links