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:
- Create a sop create, dive inside
- Create a box
- 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:
- Jump over to /obj, create a pig, name the geo container 'pig'
- Jump back to /stage
- Create a sop import
- Point it to /obj/pig
- Hooray, a pig in lops!
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.
- Create a box node in lops
- Append a sop modify
- Turn on 'Unpack USD primitives to polygons'
- 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
- 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:
- Get back into the sopmodify, create a grid, wire that directly to the output node
- 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.
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.