Difference between revisions of "UsdGuide11"

From cgwiki
Line 1: Line 1:
 
=== Layers ===
 
=== Layers ===
  
We talked earlier about layering in the context of departments, but not layers.
+
We talked earlier about layering (as a verb) in the context of departments, but not layers (as a noun).  
 
 
The Pixar docs talk about layers in a well meaning but somewhat abstract way, containers and photoshop and stuff. I found I understood it better with specific examples, as well as the dreaded counter examples.
 
  
 
''placeholder notes''
 
''placeholder notes''
  
Anything you do in usd is implicitly in a layer.
+
Anything you do in usd is implicitly in a layer, its the broadest 'container' usd has. So when you make a primtive from scratch, its put in a layer. When you load a reference, the reference is put in a layer.
  
When you create a reference, it's put in its own layer.
+
You can load stuff from disk directly into a layer, skipping the reference style 'put this thing there' requirements. This simplest possible way of loading stuff is done with a sublayer lop, because its the simplest its also the default for when you put down a file node.
  
It's also why a file lop is an alias for 'sublayer', the usd method for loading stuff from disk without the reference tricks.
+
This leads to a basic rule with layers; they should always be associated with a path on disk. If you load something with a sublayer, that's self evident, the path on disk is of course the usd file you loaded.  
  
A layer is usually linked with a path on disk, this is obvious with a sublayer or reference, that path is the usd file you loaded.
+
But what about when you use a sop create? That usd geo didn't come from disk, its been generated from nothing, so there's no save path defined. Strictly speaking this disk path should be defined straight away, but in practice Lops lets you go without it, as it doesn't matter to much.
  
But what about when you use a sop create? That usd geo didn't come from disk, its been generated from nothing, so there's no save path defined.
+
Well, until you try and save stuff with a USD Rop, at which point, yes it matters quite a lot!
  
That doesn't matter until you append a rop, at which point yes it matters.
+
=== Save style ===
  
The rop 'save style' menu is to decide what layers should do, and yes, there's photoshop analogies here. You could do several things
+
The rop 'save style' menu is to decide what layers should do. The text within the menu choices is pretty self descriptive, but here's my loose paraphrasing. Say you've chained together a sublayer from disk, a reference on disk, and a sopcreate within lops. The save styles let you choose between:
  
* If you've loaded stuff from disk, leave them alone, just store any of the edits/overrides in the usd specified in the rop
+
* If you've loaded stuff from disk, leave them alone, just store any of the edits/overrides in the final usd file specified on the rop. OR:
* Take all the contents of all the inputs (except references), bake them into the usd specified in the rop
+
* Take all the contents of all the inputs (except references), bake them into the usd specified in the rop. OR:
 
* Bake everything into the usd specified in the rop, so you have a big fat usd file, no external dependencies.
 
* Bake everything into the usd specified in the rop, so you have a big fat usd file, no external dependencies.
  
Ok, so again, what happens when you save a sop create if you don't use the 'bake everything' mode?
+
So what happens to the sopcreate if it doesn't have a path on disk, and you don't use the 'bake everything' mode?
 +
 
 +
Ideally, an error. In practice, a mess. The layer will have a pretend save path based on the houdini sop path, eg op:/obj/geo1/polyextrude. If you save you'll likely get a warning, and a subfolder like $HIP/obj/geo1/polyextrude.usd containing the sopcreate geo. Ugh.
 +
 
 +
To avoid this mess, there's usually a 'layer save path' parameter lurking somewhere. It exists on sop create and sop modify. Enable it, give it a path (eg $HIP/geo/sopcreategeo.usd).
 +
 
 +
When you click 'save' on the usd rop, it will detect any layers that also need to be saved, look at that save path, and save them there.
 +
 
 +
Why would you need this? Modularity and fine grained control, which USD excels at (arguably USD and Lops gives you too much fine grained control). You might have something like this chain of nodes:
 +
 
 +
* A sop import for building the set
 +
* A sop import for doinng an RBD sim
 +
* A sop create for running fur,
 +
* A USD Rop at the end with a save path of 'master.usd'.
  
Ideally, an error. In practice, a mess. The layer will have a pretend save path baed on the houdini sop path, so op:/obj/geo1/polyextrude. If you hsave, you'll likely get a warning, and a subfolder like $HIP/obj/geo1/polyextrude.usd. Ugh.
+
With the appropriate layer save paths per sopimport/sopcreate, when you save the rop you'll get seperate set.usd, rbd.usd, fur.usd, which will all be references automatically by the tiny master.usd file.
  
To fix, look for a 'layer save path' parameter. It exists on sop create and sop modify, point that to where you want your little sop network to be saved.
+
In reality, this doesn't happen often with fx and lops. Any important external stuff will already be in external usd files, and you'll just be told 'yeah, just throw all your FX work into fx.usd please.'. In that case, just set the save style to 'flatten', job done.
  
When you click save to disk on the usd rop, any layers that have a save path defined, that need to be saved to disk, will be saved to disk.
+
=== Scene Graph Layers pane ===
  
Why would you need this? If you had lots of complex sop creates, one for buidling the set, another for pulling in an RBD sim, another for the fur, and you want the final output to be a small 'master.usd', while next to it are big seperate files for set.usd, rbd.usd, fur.usd.
+
If you want to keep track of your layers (and sooner or later you'll want to), there's a panel for this, Scene Graph Layers. Open it, see a tree-ish view of the active layers. This also lets you see the save paths at a glance per layer, handy to spot the one rogue layer which doesn't have a path set, or is trying to save to op:/obj/geo1/polyextrude.  
  
In reality, this rarely happens with lops. You'll likely be pulling in set.usd from someone else, so you don't have to worry about save paths, and you'll be told 'just put all the fx stuff into fx.usd'. In that case, just set the save style to 'flatten', walk away.
+
=== Configure Layer ===
  
There's a kind of confusing, kind of useful 'scene graph layers' pane, pop it open, click through some of the flows we've created so far, see how the layers have evovled. Also note the handy 'save path' column to tell you when things will save to dumb locations.
+
You don't have to configure 'layer save path' straight away on a sopcreate/sopimport. A 'configure layer' node also lets you do this, handy if you want to bundle your operations, eg keeping all the rops and save-path related nodes close together at the bottom of your node network.

Revision as of 23:29, 1 May 2021

Layers

We talked earlier about layering (as a verb) in the context of departments, but not layers (as a noun).

placeholder notes

Anything you do in usd is implicitly in a layer, its the broadest 'container' usd has. So when you make a primtive from scratch, its put in a layer. When you load a reference, the reference is put in a layer.

You can load stuff from disk directly into a layer, skipping the reference style 'put this thing there' requirements. This simplest possible way of loading stuff is done with a sublayer lop, because its the simplest its also the default for when you put down a file node.

This leads to a basic rule with layers; they should always be associated with a path on disk. If you load something with a sublayer, that's self evident, the path on disk is of course the usd file you loaded.

But what about when you use a sop create? That usd geo didn't come from disk, its been generated from nothing, so there's no save path defined. Strictly speaking this disk path should be defined straight away, but in practice Lops lets you go without it, as it doesn't matter to much.

Well, until you try and save stuff with a USD Rop, at which point, yes it matters quite a lot!

Save style

The rop 'save style' menu is to decide what layers should do. The text within the menu choices is pretty self descriptive, but here's my loose paraphrasing. Say you've chained together a sublayer from disk, a reference on disk, and a sopcreate within lops. The save styles let you choose between:

  • If you've loaded stuff from disk, leave them alone, just store any of the edits/overrides in the final usd file specified on the rop. OR:
  • Take all the contents of all the inputs (except references), bake them into the usd specified in the rop. OR:
  • Bake everything into the usd specified in the rop, so you have a big fat usd file, no external dependencies.

So what happens to the sopcreate if it doesn't have a path on disk, and you don't use the 'bake everything' mode?

Ideally, an error. In practice, a mess. The layer will have a pretend save path based on the houdini sop path, eg op:/obj/geo1/polyextrude. If you save you'll likely get a warning, and a subfolder like $HIP/obj/geo1/polyextrude.usd containing the sopcreate geo. Ugh.

To avoid this mess, there's usually a 'layer save path' parameter lurking somewhere. It exists on sop create and sop modify. Enable it, give it a path (eg $HIP/geo/sopcreategeo.usd).

When you click 'save' on the usd rop, it will detect any layers that also need to be saved, look at that save path, and save them there.

Why would you need this? Modularity and fine grained control, which USD excels at (arguably USD and Lops gives you too much fine grained control). You might have something like this chain of nodes:

  • A sop import for building the set
  • A sop import for doinng an RBD sim
  • A sop create for running fur,
  • A USD Rop at the end with a save path of 'master.usd'.

With the appropriate layer save paths per sopimport/sopcreate, when you save the rop you'll get seperate set.usd, rbd.usd, fur.usd, which will all be references automatically by the tiny master.usd file.

In reality, this doesn't happen often with fx and lops. Any important external stuff will already be in external usd files, and you'll just be told 'yeah, just throw all your FX work into fx.usd please.'. In that case, just set the save style to 'flatten', job done.

Scene Graph Layers pane

If you want to keep track of your layers (and sooner or later you'll want to), there's a panel for this, Scene Graph Layers. Open it, see a tree-ish view of the active layers. This also lets you see the save paths at a glance per layer, handy to spot the one rogue layer which doesn't have a path set, or is trying to save to op:/obj/geo1/polyextrude.

Configure Layer

You don't have to configure 'layer save path' straight away on a sopcreate/sopimport. A 'configure layer' node also lets you do this, handy if you want to bundle your operations, eg keeping all the rops and save-path related nodes close together at the bottom of your node network.