Graft, reference, merge, sublayer, when to use them ?

   3387   3   2
User Avatar
Member
3 posts
Joined: April 2019
Offline
I'm working on a project where we try a USD base pipeline. We have all our assets in usd with their variant and materials.
We now need to scatter a rock and a cactus asset on a terrain asset.

In the attached image i only show the terrain and the cactus part. for the cactus, I import points that i scattered in a SOP network and i put a configure layer to save all these points in a separate .usdc file so my main .usda file stay clean without any geometry. Then i compose them with a graft to merge them under an xform called desert.

So far everything works but when i hit export, my configure layer node is ignored... Everything is contained in a single .usda file and it doesn't save my scatter points in a separate .usdc file.

It seems like it is because of the graft node because when i use a merge it works fine but the merge doesn't allow to put the merged primitives under an other primitive (the desert xform in my case). In the doc it says that the graft flatten the input, so i guess the graft is not the node I want.

I tried a lot of things but I can't figure out wich one to use between the graft, the sublayer, the merge, and the reference nodes. It is very hard for me to understand what are the differences between those and the sidefx tutorials doesn't help me much.

Thanks

Attachments:
Capture.PNG (89.7 KB)
Capture2.PNG (29.2 KB)

User Avatar
Staff
4435 posts
Joined: July 2005
Offline
Graft duplicates the contents of the input layers into a new root location on the active layer. Because it's actually copying the contents of the layer, it has to "flatten" the input into a single layer. This means your sublayering structure gets lost, which is why your Configure Layer no longer affects the output file generation.

Sublayer does a USD sublayer operation. This layers one full layer directly on top of the current stage without altering any scene graph paths. This node treats each connection to the multi-input as a separate layer stack, so if the inputs have sublayers, then the resulting USD structure is a hierarchy of sublayer compositions.

Merge does USD sublayering, but it does this by treating each inputs sublayer stack as part of a linear list that gets combined into a flat list of sublayers under the stage root layer.

Reference is likely what you want. It lets you pick a scene graph location and pull the data from another USD layer _into that location_. Very much like a graft, but forcing the referenced data (when using the multi-input) to be put in a separate file. But also note that the Reference LOP can only reference to a single location. So if you want to put each input into a separate location in the scene graph, you need separate Reference LOPs.

I've attached a hip file that shows the various methods. Although the output of all the nodes looks the same in the viewport, the scene graph hierarchy is different in some cases, but perhaps more importantly, look at the Inspect Layers pane for each node to see how each node type affect the layer composition (which therefore affects what files are written to disk by the ROP).

Attachments:
combining_layers.hip (123.4 KB)

User Avatar
Member
642 posts
Joined: Aug. 2013
Offline
Hi Mark

That file is super useful. thanks!

Best
User Avatar
Member
3 posts
Joined: April 2019
Offline
Thanks !

This really clears a lot of things.
  • Quick Links