Skip to content

Variants

Ooo, first proper USD jargon, exciting!

Variants are a pretty simple idea. You've probably created Houdini setups with a switch node to allow you to swap between 2 branches of sops, or a high and low quality, or sim vs non simmed etc. Maybe you exposed that switch as part of some HDA controls cos you're amazing.

A variant is the same, but defined in the USD file format, not in the DCC. This is where USD starts to diverge from other 3D file formats; bgeo, alembic, fbx etc don't have the concept of switches or toggles within their file format, USD does.

Lops exposes variants like this:

Basically setting up a switch right? This setup lets you swap between an untextured and textured pig, the setup is pretty much as it looks:

  1. Make 2 copies of the reference node for the pig, pull them to one side
  2. Copy the material library, wire it under the second reference, drag in the reference node from the scene graph tree to the geometry path parameter to assign it
  3. Create a Add Variants to New Primitive node, wire the untextured reference and the material library to the second input

Done! Notice that in the Scene Graph Tree there's now text in the 'variants' column.

To toggle the displayed variant you can either:

  1. Append a set variant node. The variant set will be already selected. Choose the variant you want from the 'variant name' parameter.
  2. r.click on the variant in the scene graph tree, model -> choose from the reference node or the material in the menu. This will create a set variant node and fill it out for you.

You might've noticed that there's a 'model:' prefix on the variant. This is because you can have multiple variants on the one object. It's a bit tricky to understand how multiple variants interact, but ultimately you can chain multiple add variant nodes together, each with their own 'variant set' name, and they'll be presented as a list of menus:

You might've also noticed that the default naming of the nodes and variant choices are awful. By default lops uses the names of the network nodes, the fastest way to tidy this up is to use some nicely named nulls, the name of the add variant node, and a cheeky $OS call, to tidy all this up:

And how that looks in the Scene Graph Tree. Much nicer.

Little bonus thought. Cast your mind to sops. If you wanted a switch between a box and the same box coloured green, you wouldn't do this:

You'd do this:

Similarly in Lops, if the only change here is the material, you can be more elegant about what gets passed to the switch, which is just the extra material definition:

There's more detailed versions of this on the main HoudiniLops page.

More USD terminology

As we're getting deeper, it's time to start talking more native USD. One of the key concepts is primitives, or prims. While Houdini prims are things like polygons, sphere prims, packed prims, because USD is mostly concerned with scene hierarchies, it calls items within the Scene Graph Tree prims. So a reference node is a prim. A xform is a prim. A material is a prim, a shading node, a camera, a light etc. Anything that appears in the Scene Graph Tree is a prim. Cool? Cool.


prev: UsdGuide05 this: UsdGuide06 next: UsdGuide07 main menu: UsdGuide