Houdini 18.5 Solaris

LOPs Tutorial 1 Assets Department: Build

Congratulations! You have built your first USD asset and are ready to move on to the next tutorial!

On this page

About this tutorial

Prerequisites

Download the necessary support files to $HIP/LOPS_DEMO_FILES.

What you will learn

  • Creating a variant set for an asset.

  • Preparing an asset for USD.

  • Exporting an asset as USD.

Before you begin

In a regular production pipeline, the Asset department is often made up of multiple sub-departments (like Modeling and Texturing), asset building is typically complicated, and assets usually come from several different sources in many different file formats.

In this tutorial, you will walk through a simplified version of one of the early stages of a production pipeline—asset creation—and you will act as the Assets department. You will import a barrel obj model, fix a few minor issues with it, import png textures for the barrel, attach shaders to the barrel, create variants of the barrel, ready the barrel for USD, and then export the barrel USD file.

Note

  • For this tutorial, please assume that the Assets department is one department.

  • Houdini Apprentice license holders can only write out .usdnc files. This is the non-commercial versions of USD and can only be read by Houdini (not the other software packages that support USD). In all other ways, .usdnc are fully equivalent to standard .usd files.

Tip

Remember to save your scene file frequently as you work. For example, save your file as something like lops_tutorial_1.1.hip.


BEGIN

Import an asset into Houdini

The first thing you are going to do is import an asset into Houdini.

  1. Start a new Houdini session.

  2. Switch to the Solaris desktop.

    • If you do not have a Solaris desktop, make one.

    • Make sure that you can see the Scene Graph Tree in one of your panes.

  3. In the network editor, dive into /obj.

  4. Choose tab ▸ File.

    This creates a Geometry Object with a File SOP inside it.

  5. Rename the Geometry Object to Source.

    This is where you are going to import your barrels and ready them for USD.

    Note

    In some pipelines, you would import a USD directly and skip this step.

  6. Go inside Source.

    Double-click the node or select it and press Enter.

  7. Edit the File SOP to load one of the files from the LOPs support archive you downloaded for this tutorial:

    Geometry File

    $HIP/LOPS_DEMO_FILES/BaseGeo/repacked_BarrelWithLid_UV.obj

  8. Add a Match Size SOP to ensure that your props are centered in the world:

    Translate check-box

    On

    Alignment Position

    0, 0, 0

    Justify Y

    Min

  9. Wire the File SOP output to the first Match Size SOP input.

  10. Add a Null SOP and rename it to OUT_BARREL.

  11. Wire the Match Size SOP output to the OUT_BARREL input.

  12. on OUT_BARREL and notice that the barrel already has groups in it that identify the lids, the straps, and the barrels.

Import the asset into LOPs

You will now import your asset into LOPs.

  1. In the network editor, dive into /stage.

    Note

    You can create a LOP network at any level in Houdini. But for this tutorial, keep your work in /stage.

  2. Add a SOP Import LOP:

    SOP Path

    /obj/Source/OUT_BARREL

    Once geo is in a LOP, it’s referred to as a primitive (or prim). Note how this definition differs from Houdini’s native definition of a primitive.

    Load As Reference

    On

    A reference is one of the most common composition arcs, and is generally used to compose assets and props into a stage (such as assets into a set). While references may give the appearance of instancing, they are not actually instanced unless you explicitly indicate that they should be instances by turning on the Make Instanceable option.

    Think of a reference as a sort of macro that lets you compactly reuse a scene description. For example, if you used references to assemble a shelf of books, the bookshelf and the books would reference the shelf and book assets respectively.

    Primitive Path

    /Barrel/BarrelGeo

    This is where the reference to the primitive will be stored in the internal USD file structure and the LOPs scene graph.

    Layer Save Path

    $HIP/tutorial1/Geo/BarrelBase.usd

    This tells USD where to put the actual .usd file on disk that contains the prim. See the notes on the USD ROP later in this tutorial for more information.

  3. Look at the Scene Graph Tree pane.

    • You can see the layout of your USD stage here.

    • You will be referring to the Scene Graph Tree frequently to make sure your USD stage is composed logically.

      Note

      If you do not see the Kind column in the Scene Graph Tree, enable it by clicking on the gear menu and adding it.

    • You should now see Barrel as a group with BarrelGeo as a component nested under it.

      Please see the glossary for more information about these kinds of organizational structures (like assemblies, groups, components, and sub-components).

  4. In the network editor, on SOP Import and choose LOP Actions ▸ Inspect Active Layer.

    • Look at the USD you created. This is the code that contains your composed stage (also known as a scene in Houdini).

    • Barrel is a group and under that group BarrelGeo is a component.

    • The barrel is also now a payload.

Add a material library to the network

You will now build a library of materials that you can then attach to your barrel asset.

  1. In /stage, add a Material Library LOP.

    Do not wire it to anything yet.

  2. Go inside the Material Library LOP.

    Double-click the node or select it and press ENTER.

  3. Add a Principled Shader VOP and then rename it to Barrel:

    Base Color

    1,1,1

    Roughness

    1

    Metallic

    1

  4. In the Texture tab, turn on Use Texture for Base Color, Roughness, and Metallic:

    Base Color Texture

    $HIP/LOPS_DEMO_FILES/Library/Assets/Barrels/Textures/repacked_BarrelWithLid/repacked_BarrelWithLid_UV_<UDIM>_BaseColor.png

    Roughness Texture

    $HIP/LOPS_DEMO_FILES/Library/Assets/Barrels/Textures/repacked_BarrelWithLid/repacked_BarrelWithLid_UV_<UDIM>_Roughness.png

    Metallic Texture

    $HIP/LOPS_DEMO_FILES/Library/Assets/Barrels/Textures/repacked_BarrelWithLid/repacked_BarrelWithLid_UV_<UDIM>_Metallic.png

    Warning

    Please use the proper UDIM syntax as noted above and make sure to choose UDIM from the options in the file chooser. This will make sure that the appropriate UDIM syntax is inserted.

  5. Go back up to /stage.

    Tip

    Press U to move up in the network.

  6. In the Material Library LOP parameters, click Auto-fill Materials.

    This will populate the interface with the Principled shader.

    Note

    As a variation on this, you could also type * (star) in the Material VOP parameter field and turn on Include Only VOPs with Material Flag Set.

  7. Add a Configure Layer LOP:

    Save Path

    $HIP/tutorial1/Materials/BarrelMaterials.usd

    This tells USD where to store the materials.

  8. Wire the Material Library LOP output to the Configure Layer LOP input.


You now have a material library for your asset.

Apply a material to the asset

You will now begin to add materials to your prims.

  1. Select SOP Import.

  2. Add a Reference LOP:

    Primitive Path

    /Barrel/materials

    This is where the materials will be stored for the barrel asset.

    Reference Type

    Reference From Multi-input

    Note

    Think of a reference as a sort of macro for compactly reusing a scene description.

  3. Wire the SOP Import output to the first Reference LOP input.

  4. Wire the Configure Layer LOP output to the second Reference LOP input.

  5. Change the Reference LOP’s Primitive Path to just /materials and look at the Scene Graph Tree to see how things have changed.

    Now change Primitive Path back to /Barrel/materials.

  6. Add an Assign Material LOP.

  7. Wire the Reference LOP output to the Assign Material LOP input.

  8. Assign the following parameter values to the Assign Material LOP by dragging and dropping them from the Scene Graph Tree:

    Primitives

    /Barrel/BarrelGeo

    Material Path

    /Barrel/materials/Barrel


Congratulations, you now have a shaded and textured barrel asset.

Create variants of the asset

Now that you have a barrel and a material, you can make a simple variant of the asset.

You will now hide the lids to make two barrels available: one with lids and one without lids. You will also need to make the groups that are visible in SOPs available in LOPs. To do this, you are going to have to modify your existing LOP chain.

  1. Select the existing SOP Import node:

    Primitive Path

    /Barrel/BarrelGeo/Body

    This is the directory location to which the asset variant is saved in the USD internal structure. You can view this location through the Scene Graph Tree.

    Parent Primitive Kind

    Component

    This makes these parts of the barrel variant components. This will help you organize your asset.

    See the glossary for more information on these organizational structures.

    Layer Save Path

    $HIP/tutorial1/Geo/BarrelBase.usd

    This is the location on disk where this file is saved.

    Note

    This path has not changed from when you set it earlier in the tutorial.

    Import Group

    Barrel MetalStraps

    You can use the drop-down menu on the right to choose these groups.

  2. Alt-drag the existing SOP Import node to create a copy, and then drop the copy on the wire underneath the first SOP Import node:

    Primitive Path

    /Barrel/BarrelGeo/Lids

    Layer Save Path

    $HIP/tutorial1/Geo/BarrelLids.usd

    Import Group

    Lids

    Warning

    Make sure that Lids is only in the Import Group parameter as noted above. It is easy to accidentally add Lids to an existing selection.

  3. Select Assign Material LOP, add a Null LOP, and rename it to Barrel_W_Lid.

  4. Look at the Scene Graph Tree. You should now see Body and Lids as components under BarrelGeo.

  5. It would make more sense if Body and Lids were subcomponents of the BarrelGeo.

    Add a Configure Primitives LOP to the second SOP Import node

    Primitives

    /Barrel/BarrelGeo/*

    Note

    The asterisk (star) at the end of the path means match everything.

    Kind

    Subcomponent

  6. Look at the Scene Graph Tree again.

    Notice how the hierarchy goes from group to component to subcomponent. You cannot break this hierarchy (like if you had group to subcomponent to component) or your USD would fail.

    Tip

    If you had a pallet with ten barrels on it, you could also have an assembly in the hierarchy.

    Please see the glossary for more information on assemblies.


Create a simple variant

You will now make a simple barrel variant.

  1. Select the Assign Material LOP and add a Prune LOP.

    Primitive Pattern

    Drag Lids from the Scene Graph Tree and drop it in this parameter field.

  2. Wire the Assign Material LOP output to the Prune LOP input.

  3. Select Prune LOP and set its display flag.

    You should see the lids disappear in the viewport.

  4. Add a Null LOP and rename it to Barrel_No_Lid.

  5. Wire the Prune LOP output to the Barrel_No_Lid input.

  6. Add an Add Variant LOP (choose ⇥ Tab ▸ Add Variants to New Primitive).

  7. Wire the Barrel_W_Lid output to the first Add Variant LOP input, and then wire the Barrel_No_Lid output to the second Add Variant LOP input.

  8. the Add Variant LOP node and choose LOP Actions ▸ Inspect Active Layer.

  9. Look at the USD code. Notice that LOP is building a whole new barrel and then just hiding the lid.

    This is not terribly efficient. For this simple object it is not important, but imagine if you had something more complex or you had multiple assets.

    You need to make this more efficient.

Create a variant using context option block

You will now make the variant barrel more efficient.

  1. Add an Add Variants to existing Primitive block (choose ⇥ Tab ▸ Add Variants to existing Primitive).

  2. Inside the block you just added, select the variantblock_end node.

    Note

    You may be wondering what the expression `opinput(".", $IIDX)` means in the Variant Block End LOP. If you on the label, normally you would see what the expression resolves to. But in this case, it cannot resolve as it is looping over all the inputs. As a result, you will see nothing as it can’t show more than one result at a time. The opinput expression queries the current input index ($IIDX), which in turn resolves to the name of the LOP corresponding to that index. If you want to test this, temporarily replace ($IIDX) with 0 (the first thing plugged into this input), on the label, and you will then see it resolve to Barrel_w_Lid (the first node plugged into this LOP).

  3. Drag BarrelGeo from the Scene Graph Tree and drop it into its Primitive Path parameter field.

    Tip

    If you don’t want the Scene Graph Tree to change focus, select the Barrel_W_Lid node and then pin the Scene Graph Tree.

    Tip

    If you don’t want the hassle of pinning the pane and dragging and dropping, go the the Scene Graph Tree, select the path you want, ▸ Copy Path, and then paste the path in the Primitive Path parameter field.

    See the Primitive Matching Patterns page for more information on targeting primitive patterns.

  4. Add a Null LOP to the block and rename it to Lid.

  5. Add a Null LOP to the block and rename it to No_Lid.

  6. Add a Prune LOP to the block.

  7. Select the Prune LOP and then drag Lids from the Scene Graph Tree and drop it into its Primitive Path parameter field.

  8. Wire up your nodes:

    • Wire the variantblock_begin output to both the Lid and second Prune LOP’s inputs.

    • Wire the Prune LOP output to the No_Lid input.

    • Wire the Lid output to the variantblock_end input.

    • Wire the No_Lid output to the the variantblock_end input.

    • Wire the Barrel_w_Lid output to the variantblock_begin input.

    • Wire the Barrel_w_Lid output to the variantblock_end input.

    Your /stage network should now look like the image below.

    The first input for variantblock_end comes in unmodified. This is the Barrel_w_Lid. This is the node you want to modify. The other inputs are the variants.

    The second input uses the Prune LOP to prune the lid from the barrel by making it inactive.

  9. Look at the active layer by the variantblock_end node and choosing LOP Actions ▸ Inspect Active Layer.

    Compare this USD code to the USD code you created previously. Notice how much more compact the USD code is.

    All we are doing here is adding a few lines to hide the lids to create the variant instead of adding the whole barrel again and then just hiding the lids.

Choose the default variant and save your USD

You will now designate the default variant for the barrel asset and save out its USD.

Note

In LOP nodes and in the USD ROP you can specify paths to files on disk that do not yet exist, and any missing directories will be created when the ROP is executed.

  1. To choose the default variant, add a Set Variant LOP.

  2. Wire the variantblock_end output to the Set Variant LOP input.

  3. Select the Set Variant LOP and set its parameters:

    Variant Set

    model

    Variant Name

    Choose Lid or No_Lid from the drop-down menu on the right.

    This will be the default variant.

  4. Add a Null LOP and rename it to BarrelSets.

  5. Wire the Set Variant LOP output to the BarrelSets input.

  6. Add a Configure Layer LOP.

  7. Wire the BarrelSets output to the Configure Layer LOP input.

  8. Select Configure Layer LOP and define the USD file to which this set of barrels will be written:

    Default Primitive

    Choose /Barrel from the drop-down menu on the right.

    Save Path

    $HIP/tutorial1/Geo/Barrels.usd

  9. Add a USD ROP LOP.

  10. Wire the Configure Layer LOP output to the USD ROP LOP input.

    Your /stage network should now look like the image below.

  11. Select the USD ROP LOP and choose an output path. For example, $HIP/tutorial1/BarrelsAsset.usd.

  12. In the Output Processing section, make sure that Use Relative Paths is enabled.

    This is what allows you to use $HIP everywhere in this LOP network. The USD ROP examines your network for references to $HIP and replaces them with relative references when it writes the USD file. This is actually a very complex part of USD (also known as relative paths) and a real cause of confusion for new users. This control allows you to work with a file structure you are familiar with, while letting LOPs create USD-friendly paths under the hood.

  13. In the Extra Files section, notice the option for Error Saving Layers with Implicit Paths.

    This makes the ROP throw an error if you have missed configuring a layer and LOPs does not know where to save your data.

    To test this, bypass the Configure Layer LOP just above the ROP Output node. If you try to save out the file, the output node will error.

  14. At the top of the USD ROP LOP parameters list, click Save to Disk to save your USD file to disk.

Verify your changes

You will now make sure that everything worked by checking the USD you just saved out.

Load the USD back into Houdini

  1. Load the USD file you just saved out.

  2. Create a Reference LOP and do not connect this LOP to anything:

    Primitive Path

    /Barrel

    Browse to your USD file ($HIP/tutorial1/BarrelsAsset.usd) and load it. It should look exactly like the last ROP in your chain.

    Reference File

    $HIP/tutorial1/BarrelsAsset.usd

  3. Add a Set Variant LOP and choose a variant to view:

    Primitives

    Drag BarrelGeo from the Scene Graph Tree to this parameter field.

    Variant Set

    model

    Variant Name

    Choose a variant from the drop-down menu on the right.

Inspect your USD file structure

Go to the location to which you saved your USD files.

You should see five files there:

├── BarrelsAsset1.usd
├── Geo
│   ├── BarrelBase.usd
│   ├── BarrelLids.usd
│   └── Barrels.usd
└── Materials
    └── BarrelMaterials.usd

FINISH

Troubleshooting

When I load my USD back into Houdini with the reference LOP, it does not look the same as the final node in my LOP chain

Are you sure there are five files in the file structure (as seen above)? If not, you may have put the same file path in more than one LOP node. This will cause these files to stomp all over each other.

I don’t see any materials on my barrels

Did you use the proper UDIM syntax in the file parameters in the shader? Please review the section on the Material Library and the warning in particular.

Solaris

USD

Tutorials

Karma renderer