Difference between revisions of "UsdGuide02"

From cgwiki
Line 8: Line 8:
  
 
=== Loading a USD in lops ===
 
=== Loading a USD in lops ===
 +
 +
[[File:usd_guide_02_file_load 0.png]]
  
 
# In the network editor, tab in a 'file' node
 
# In the network editor, tab in a 'file' node
Line 18: Line 20:
  
 
# Tab in a reference node
 
# Tab in a reference node
# Paste in the path, display the node. There's the pig. Note that in the scene graph tree the 'transform' is called reference1, and it's green.
+
# Paste in the path (again make sure to use the correct parameter 'reference file', not the top 'primitve path' parameter)
 +
# Display the node. There's the pig. Note that in the scene graph tree the 'transform' is called reference1, and it's green. <br>[[File:usd_guide_02_reference_load_sgt 0.png]]
 
# This is kiiiindasorta like a reference in maya. You ever try lots of references in maya to the same file? No? Well, lets try it here.
 
# This is kiiiindasorta like a reference in maya. You ever try lots of references in maya to the same file? No? Well, lets try it here.
 
# Duplicate the reference node, append it below the first. Display it. You can see in the scene graph tree there's 2 reference nodes now.
 
# Duplicate the reference node, append it below the first. Display it. You can see in the scene graph tree there's 2 reference nodes now.

Revision as of 05:31, 22 July 2021

Lops

The previous section treated usd as a cache format. You're probably aware of Solaris/Lops, the USD editing mode within Houdini. Working in Lops exposes a bunch of other things USD can do, but for now lets load in the USD's we just made, and spot the differences.

Go to the desktop menu and choose 'Solaris', this opens a few more panes we'll need.

Oh if you're wondering, Solaris is the marketing name for Lops, so Lops and Solaris is the same thing. Ok? Cool.

Loading a USD in lops

Usd guide 02 file load 0.png

  1. In the network editor, tab in a 'file' node
  2. Point it to the pig.usd you made earlier. Careful, the file parameter is about 2/3 the way down the parameter pane, not at the top where you'd expect. Don't be fooled!
  3. There's the pig, same as before. Big deal.
  4. Look at the Scene Graph Tree. This is a tree view/outliner style view of your usd file. At the moment you probably see a fully collapsed tree.
  5. Expand it out. You'll see there's a little hierarchy, very similar to the maya style thing of a transform and shape. In this case its /usdexport1/mesh_0

So far, so dull. Note that in the network editor, the node we're using is of the type sublayer, which is a USD term for loading files from disk. It's the default opalias used by Houdini when you type 'file' cos it's simple, but there's a more interesting alternative, a reference.

  1. Tab in a reference node
  2. Paste in the path (again make sure to use the correct parameter 'reference file', not the top 'primitve path' parameter)
  3. Display the node. There's the pig. Note that in the scene graph tree the 'transform' is called reference1, and it's green.
    Usd guide 02 reference load sgt 0.png
  4. This is kiiiindasorta like a reference in maya. You ever try lots of references in maya to the same file? No? Well, lets try it here.
  5. Duplicate the reference node, append it below the first. Display it. You can see in the scene graph tree there's 2 reference nodes now.
  6. Duplicate those 2, append them. Now there's 4 references. Great, buuuut there's no change in the viewport. Makes sense I guess, in that they're all in the same place. What if you wanna move stuff around to see them all?
  7. Select reference2 in the scene graph tree, move your cursor to the viewport, hit 't'. That'll bring up the translate tool, you can move that pig somewhere else. Select reference3, move it, select reference4, move it.
  8. Take a look at what's happened in the node editor and the parameter pane. Lops has appended an edit node, and the parameter has a list of nodes that have changed. You can turn on a toggle to see the modified translate values.

So this is kindasorta like a edit sop, but its also kindasorta a procedural edit node; you can move stuff, and it's recording your changes on a node.

If you want more analogies (of course you do), in terms of what we've done so far in Lops is chaining lots of file sops together, keeping them in packed disk mode, making sure each has a unique name, then appending an edit sop to move them around.

Save a USD from Lops

With all that done, lets save this to disk.

  1. Append a USD Rop node
  2. Set the save path to $HIP/geo/lops.usd, save

Easy enough. Let's load this back in.

  1. Create a file node, point it at $HIP/geo/lops.usd, display it
  2. There's your pigs, and the hierarchy all as you left it.

References to references

Still pretty dull so far, but take a closer look at the usd files you made:

$ ls -l lops.usd pig.usd 
-rw-r--r--  1 mestela  staff   1.4K 27 Apr 18:47 lops.usd
-rw-r--r--  1 mestela  staff   150K 27 Apr 14:45 pig.usd

The pig.usd is 150kb, about what you'd expect, but the collection of 4 pigs is only 1.4kb. You can guess at what's going on here, when we wrote the 4 pigs out of lops, it was clever enough to know it didn't need to bake out the geo, it just has to store a reference to the pig on disk, and a transform.

Lops lets you see this directly. Right click on the edit node, choose Lop actions -> Inspect Active Layer. That'll pop up a code editor. Ignore the fiddly bits, you should be able to understand what's going on; it loads the pig.usd as a reference 4 times, and moves each one.

So universal

That all makes sense. But think about this. While that's a trick you could do in Maya with references, or Houdini with packed disk prims, or most 3d apps in some form or another, they're all locked on their own platform. This lops.usd is now universal. You could load in Maya, or Katana, or Nuke, or Renderman, or UE4, or Arnold, they'll all see the same thing. No translation, no conversion. That's cool.

Lops is not Houdini, Lops is USD

Worth pointing this out early on. Lops is ultimately about bringing Houdini to USD, not USD to Houdini. Lops is a thin node based wrapper around all the core USD technology, so while it might look like a sops network, don't be fooled; this isn't Houdini points and prims we're manipulating here.

You'll feel the desire to rail against it. Fight that feeling. USD isn't as scary or weird as it seems, you just need to get a quick primer in its terms and workflow. Which is why you're reading this guide. :)

On to part 3!


prev: UsdGuide01 this: UsdGuide02 next: UsdGuide03
main menu: UsdGuide