UsdGuide10

From cgwiki

Sops in Lops

We've written out usd files from sops, and done some native lops things. But cmon. You can't be Houdini smug unless you're directly moving stuff between contexts.

Sop create and sop import

A sop create is a subnet. Inside is sops (obviously), whatever you create in the subnet will be live translated to usd when you jump back into the lops context. Eg:

  1. Create a sop create, dive inside
  2. Create a box
  3. Jump up to lops again, there you go, a box in usd.

You've already used this in fact, the lops pig, lops rubber toy, even lops grid are all just hda's that are a sop create with some vanilla houdini sops inside.

You can also do create geo in /obj/geo land, and pull it into lops with a sop import. It works pretty much as you'd expect:

  1. Jump over to /obj, create a pig, name the geo container 'pig'
  2. Jump back to /stage
  3. Create a sop import
  4. Point it to /obj/pig
  5. Hooray, a pig in lops!

Sop modify

No surprises here. Append on of these to some existing lops, dive inside, you can modify geo with sops tools, jump up, its converted back to usd.

  1. Create a box node in lops
  2. Append a sop modify
  3. Turn on 'Unpack USD primitives to polygons'
  4. Dive inside, woo, polygons to play with. You can see the output node, as long as you run stuff through to that, it will be passed back up to lops
  5. Try inserting a polyextrude, turn off 'connected components', push out the faces, see that sent to lops.

Now try something silly, just to see what happens:

  1. Get back into the sopmodify, create a grid, wire that directly to the output node
  2. Jump up, what do you see? Probably just the box again.

Why is that? Remember waaaay back in the first lesson, I mentioned the usd attributes that appear on geo when you unpack a usd prim? Similar to @name and @path and stuff for dealing with packing and unpacking geo in Houdini, these attributes are used to repack your geometry to send back to lops.

If you create a grid from scratch like you do here, there's no usd attribs to reconstruct, so the shape just gets ignored. If you want to make it work, copy the attribs from the original box to the grid.

Careful now

While this is powerful and fluid, its not without cost. Much like you can't expect to unpack 50,000 packed prims that are changing every frame and maintain 60fps, unpacking complex usd can be heavy. Playing back native heavy usd geo in lops can be incredibly quick, and lull you into a false sense of security.

What you can do of course, is write your modified geo back out to a usd file on disk as soon as you can. Worth playing with, don't be caught out when you least expect it.