Share

Apply materials in Bifrost-USD

Bifrost-USD includes high-level compounds that make it easy to create a UsdPreviewSurface material, as well as to bind it to geometry in any of several ways.

Create a material prim

The UsdPreviewSurface material that is available in USD is a simple but modern, physically-based material that covers many cases. It is supported by many renderers.

To add a prim that defines a material:

  1. Right-click on the prim_definitions port of an add_to_stage node or on the children port of a prim definition node, and choose Create Node > Usd::Shading::define_usd_preview_surface.
  2. Set path to a path and name to identify the material, and set its parameters as desired.

Bind a material using the material port

The simplest and sometimes most convenient way to apply a material to a primitive is to connect the output of a define_usd_preview_surface to the material port of a prim definition node. When this "recipe" is processed by an add_to_stage node, the binding is created automatically.

The drawback of this method is that it creates a copy of the material under each prim with a material connection, so it is suitable only for simple situations.

Bind a material using tags

Tags let you bind materials automatically by name. They are convenient for selecting a material from a library previously defined in the stage.

  1. Optionally, add a define_usd_material_tag node to the graph, connect its output to the attribute_definitions port of a define_usd_preview_surface node, and set its value to a unique string for identifying the material.

  2. Add another define_usd_material_tag node to the graph, connect its output to the attribute_definitions port of a prim definition port, and set its value to the name of a material prim definition.

    Alternatively if you connected a tag to the material prim definition, you can set value to the same tag — in this case, you can reuse the output from the same define_usd_material_tag node.

  3. In the add_to_stage node downstream, make sure that use_material_name_or_tag is enabled.

Bind a material using relationships

You can use a relationship to bind a material explicitly.

  1. Right-click on the relationship_definitions port of a prim definition node, and choose Usd::Prim::define_usd_relationship.
  2. By default, the define_usd_relationship is already set to create a material:binding relationship. You only need to set target to the path of the material to bind to.
Tip:

You can get the path by selecting the material in Maya's Outliner, then copying and pasting it from Prim Path in the Metadata attribute group on the material prim's tab in the Attribute Editor.

Bind a material using assign_usd_material

  1. Add an assign_usd_material node to the graph, and connect its stage input and output ports.
  2. Set material_path to the full path of the material to use.
  3. Set prim_path to the full path of the prim to bind.

Was this information helpful?