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:
- Right-click on the
prim_definitions
port of anadd_to_stage
node or on thechildren
port of a prim definition node, and choose Create Node > Usd::Shading::define_usd_preview_surface. - 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.
Optionally, add a
define_usd_material_tag
node to the graph, connect its output to theattribute_definitions
port of adefine_usd_preview_surface
node, and set itsvalue
to a unique string for identifying the material.Add another
define_usd_material_tag
node to the graph, connect its output to theattribute_definitions
port of a prim definition port, and set itsvalue
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 samedefine_usd_material_tag
node.In the
add_to_stage
node downstream, make sure thatuse_material_name_or_tag
is enabled.
Bind a material using relationships
You can use a relationship to bind a material explicitly.
- Right-click on the
relationship_definitions
port of a prim definition node, and choose Usd::Prim::define_usd_relationship. - By default, the
define_usd_relationship
is already set to create amaterial:binding
relationship. You only need to settarget
to the path of the material to bind to.
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
- Add an
assign_usd_material
node to the graph, and connect itsstage
input and output ports. - Set
material_path
to the full path of the material to use. - Set
prim_path
to the full path of the prim to bind.