Hi! I’m Yingying and Welcome to USD in Bifrost.
This tutorial series focuses on the basic structure of USD and its workflow in the
recently released Bifrost 2.4, which combines the power of USD and procedural content
creation.
If you are new to Bifrost,
I recommend you watch our “Intro to Bifrost” series before this one.
I’ve included the link in the description.
USD stands for "Universal Scene Description",
it is a framework developed by Pixar Animation Studios to increase pipeline efficiency and
facilitate collaborations.
It provides a common language for defining, assembling, and editing data.
All these sounds very abstract, doesn’t it?
To make it more comprehensible, I created a diagram showing its elements and structure.
As its name suggests, USD describes how a scene is assembled from individual assets.
Each scenegraph is called a “stage”.
A USD stage is a 3D scene composed of USD layers.
For example, in this case, we have a layer for the monster, one for their dwelling
and another one for the environment.
Say we have 3 artists, each working on one asset.
With USD, these can be quickly assembled into a scene.
The basic container for a USD object is called a “prim”,
a prim can contain other prims, which creates a namespace hierarchy,
it can also contain attributes such as color and transformation.
We can easily modify the attributes without overwriting the original files.
We can also create variant sets, which allows us to switch between different options,
such as colors, sizes and styles.
When we save a stage, each layer is exported as one USD file, which can be referenced later.
The common language and nondestructive workflow of USD facilitate artists to
simultaneously work on the same scene in either the same or different applications,
make modifications as they need and try out different compositions without erasing or
editing any other artist’s work.
With Bifrost, we can create USD assets and reuse them to quickly construct complex
scenes, such as generating a large assembly and creating multiple materials,
which we’ll cover in this tutorial series.
In this first tutorial you’ll learn how to create a USD stage.
I’ll show you how to create a layer, define a prim and assign attributes.
I’ve included the Maya file in the description for you to follow along.
Without further due, let’s go to the Maya file, and create a new Bifrost graph.
To work with USD, we also want to have the USD Layer Editor handy.
We can find it under windows, general editors.
Here’s what we’re going to do today:
We’ll create an empty stage.
Then we’ll define a prim named “monster”, which contains 2 child prims, body and eyes,
and we’ll add the colors and transformations.
Now let’s see how to do it in Bifrost.
First, let’s get the node “create_usd_stage”.
Go to the “parameters” and select the location where you want to store the USD files.
Let’s name the file “monster.usd”.
To add prims to a stage, we can use the node “add_to_stage”.
Connect the empty stage we just created to the port “stage”.
Right click at “prim_definitions”, under “create node”, select “define_usd_prim”.
This provides a prim definition for the “add_to_stage” node to create a prim
and add it to the stage.
Let’s take a look at the parameters of the "define_usd_prim" node.
Here we can specify the path for this prim, for example, “/monster”.
For the type of the prim, the default one is “Xform”, which means “transform”,
it acts as a parent for other prims so that they can be moved, rotated, or scaled all together
simultaneously.
Other prim types are listed in the in-app docs, such as scope, capsule, cube and mesh.
Here we’re creating a parent prim, so “Xform” is the type that we use.
Now let’s add the body and eyes as the children of this parent prim.
Here I have the body that I modeled earlier in Maya.
Let’s middle-drag it into the Bifrost Graph Editor.
To create a child of a parent prim, hover your mouse over “children”, right click,
under “create node”, select the type of the prim that you are about to define.
The body of our monster is a mesh, so we select “define_usd_mesh”.
Rename the path to “body”.
Connect the body to “mesh”,
and "out_stage" to the output.
Let’s hide the original mesh.
Now we have our monster body, which is stored in this USD stage.
When we connected the stage to the output, it also generated this “mayaUsdProxy” object in
the outliner.
If we expand it, we’ll see the hierarchy:
here “monster” is the parent prim, and it has a child called “body”.
Now let’s take a look at the USD layer editor.
In this editor, we can see all the USD layers that we created in the graph.
With the default setting, when we create a stage, it generates this “unshareable layer”
as the root layer,
and the layers that we create in the graph will be the sublayers underneath this root layer.
With this “unshareable layer”, if we move the object, the transformation will be written into
this root layer.
If we right click, and select “print to Script Editor”,
we see this translation here.
This means even after we disconnect the stage from the output, and reconnect it,
we still have this transformation, because every time we transform the object in the viewport,
the operations are written into this "unshareable layer".
If we select “mayaUsdProxy1” in the outliner, go to the attribute editor, under “stage”,
check “shareable”, then immediately we see that the transformation is gone.
Because when “shareable” is on, it doesn’t create that “unshareable layer”.
We can see it here, now we only have the 'monster.usd' layer that we created in the graph.
This means that any manual transformation in the viewport won’t be recorded.
For example, if I drag it,
disconnect the stage from the output, and reconnect it,
I got the original location instead of the translated one.
We want to keep “shareable” on all the time when creating a USD stage in Bifrost,
this allows us to directly access the stage and see which layer is targeted,
which we’ll talk more about in later tutorials.
After we complete the Bifrost graph, we may switch to the unshareable mode if we want to
do some manual adjustments and have them memorized for later use.
In Bifrost USD, we can also add attributes to a prim.
For example, if we want to change the color of the monster,
we can go to “attribute_definitions”, right-click, under create node,
select “define_usd_display_color”,
and we can pick any color that we like.
If we print this layer to script editor, we can see both the structure of the layer and the attributes
of the prims.
Here we have the parent prim, “monster”, whose type is “Xform”,
and it contains a child prim named “body”, and its type is “Mesh”.
Here are the details of this prim, such as face vertex counts, indices and the coordinates of
the vertices.
And this is the color attribute that we just added.
That’s the body of our monster. Now let’s add the eyes.
We want the 2 eyes to act as a group, so let’s create a USD prim with the type Xform as a
container for the 2 eyes,
rename the path to “eyes”,
and then define a mesh prim,
copy and paste it,
rename them to “left_eye” and “right_eye”, respectively.
Get a “create_mesh_sphere”,
connect it to the left eye.
At this moment, it has the wrong size and wrong location.
To change the size and location of a prim, we can add a transform attribute.
Similar to how we added the color, right-click at "attribute_definitions", under create_node,
select “define_usd_transform”.
Here we can change the scale, and translate it to the right location.
By holding down “Shift”, we can multi-select values and change them at the same time.
Now let’s connect the mesh sphere to the right eye as well,
copy and paste this transform node,
invert the x value of the translation,
and connect it to the attribute definitions.
Let’s also get a "define_usd_display_color",
and set it to black.
We can also add a transform node at the parent level so that we can move both eyes
at the same time.
Similarly, we can add a transform attribute to the monster level and this moves everything
together.
If we look at the structure now, we see that we have the prim "monster" as the parent,
which has two children, the body and the eyes,
and the prim “eyes” also has two children, the "left_eye" and "right_eye".
Let’s also take a look at the USD layer.
Here we have the parent prim “monster”, its children “body” and “eyes”,
and grandchildren, “left_eye” and “right_eye”.
Here’s the transformation for everything together, the transformation for both eyes,
and the transformation for each individual eye.
And we can also find the color information for the prims.
That’s it for today.
To recap, we created a stage and added a prim, which contains two children,
the body and the eyes.
All these are stored in one layer.
In the next tutorial, we’ll add another child to the prim “monster”, which is the flowers.
For the flowers we’ll create a variant set so that we can choose between them.
And we’ll learn how to save a USD stage.
If you’re also interested in Maya USD, be sure to watch my colleague Matt’s series
“USD primer for artists”.
Thanks for watching, stay tuned and I’ll see you next time.