This guideline focuses on what a “Composition” is and introduces a practical example on how to use it.
# Basic Concept
Composition is a process that allows us to consolidate multiple USD assets files
into a single USD composition file. The data of the asset files is not stored
inside the composition, instead it us referenced using USD references (which are
not Maya references). A quick way to understand is to write your composition
.usda file and inspect the file into a text editor: you will see how
USD references work and see also their paths.
A couple of notes:
- You can create compositions containing previously generated compositions.
- You can "flatten" compositions, in this case the data of the assets will be stored into the composition, making the file portable.
- Ideally this consolidation process flows down into the pipeline so that when you are in lighting your scene should contain very few Multiverse Compounds each of them would represent different compositions.
Let’s say we have a scene that contains a table and five glasses. Instead of modeling the table and the glass together and then write it as a single asset, we can instead have separate assets for the table and for the glasses.
Afterwards we can use Multiverse to read each USD asset into a new Maya scene, this will generate Compound nodes. We can then instance the glasses and then arrange the table and the five glasses into a proper hierarchy simply by moving them and grouping them. Finally we write it out as a USD composition.
Now we can use that composition in other scenes as a single entity.
The benefit of this is that even though now the table and five glasses are in one scene (or composition), if there are any changes to the table asset we just need to replace the table asset file and the composition will update automatically on file reopen / refresh, and/or on-demand depending on your asset resolution pipeline. This is a very powerful features especially if you have hundreds of individual assets being used in different scenes.
# Practical Example
Let’s start with a simple asset of a filled bath tub that also contains our Maneki Neko and several teapots, whom he enjoys to play with. Ultimately this is the final result we want to create in this example: a cat in a bath tub with some teapot toys to play with.
If we inspect the content of
bathTubWithNeko, we’ll see that it contains the
bath tub, the cat and the teapots properly arranged in a clean hierarchy. Each
of these assets has being combined into one single composition. Also notice that
in MEOW some locations have specific colors: the locations with an orange label
are references, meaning they reference each individual external USD assets.
USD references and not Maya references: remember that when you read USD data with Multiverse there is no data in Maya, and everything is streamed to Maya.
Likewise, the teapot asset has being instanced and it is represented by the light blue color label.
Click on the "?" icon in MEOW to understand the meaning of icons & colors.
If there is any update on the cat, bathtub or teapot models, the changes will be
updated automatically for this
bathTubWithNeko composition, so there’s no need
to rewrite again the composition for every change.
In order to create the composition shown above first we read each assets with Multiverse into a new Maya scene.
We can rename the asset compound nodes and arrange them into groups. It is recommended to create a proper hierarchy if we are planning to compose a larger assets from a series of smaller assets as you can see below.
From here we can select the root of our hierarchy and write the the composition using the Write USD Composition shelf menu. After writing the composition we should have the single asset that we’ve seen in the beginning of this section.
We can use the asset in other scenes or even make a bigger composition authoring a new composition in different Maya scene. We can also make further changes for it by using overrides.
# Object Types and Compositions
We can make a composition from any USD asset: Mesh, instances, animation, particles, etc... as long as the type is supported then we can use it to create a composition.
The basic workflow is:
- Write your assets via Write USD Asset.
- Read the USD assets in Maya and arrange them into a composition organizing them into a hierarchy using Maya transform nodes (groups). Feel free to including Maya instances (duplicate as instance), MASH (Maya particle instancing) etc.
- Write composition using Write USD Composition.
- Use the composition in different scenes or make a new composition based from it.
Composition is yet another powerful feature that allows you to compose assets into a bigger and complex scene. This method allows us to divide and conquer, it is easier to handle smaller things which leads to bigger results.