User Guide > Overview > Digital Assets   

Creating an Object-Level Asset

In this lesson, you will create the same tool you were working with in the Working with Digital Assets lesson. You will learn how to package up the related Operators then create an Operator Type and build the custom user interface.

Part One: Create the Subnetwork
Part Two: Create the Operator Type
Part Three: Create High-level Parameters
Part Four: Test the Asset
Part Five: Add User Interface Elements
Part Six: Write Help
Conclusion


Load the Start File

Click the following to load a Houdini hip file that contains an object called shapes which contains five primitive geometry operations (SOPs) feeding into a switch operation.

  Load Start File


Part One: Create the Subnetwork

To create an object-level asset, you must first put all of your parts into a sub-network operator. This operator creates an outer shell for your asset and should contain all of its parts. For example related networks such as shader networks (shopnet) would also go into this location.

1. Collapse into a subnet

Select the shapes object. Press Ctrl-RMB in the Network pane and from the menu select Collapse Selected into Subnet. Rename the subnet primitives_start.

2. Hook up the input

Select the new subnet and press i to go into it. Connect the output of the Sub-network Input #1 node to the input of the shapes operator. This makes sure that transformations applied to the higher level operator drive the shapes object.

3. Add a shopnet

In the Network pane, press tab > Managers > SHOP Network and place the shopnet network manager beside the shapes object.

This will hold any shaders that you want to assign to the geometry. By putting the shaders inside the subnetwork it becomes possible to package up the results as a single asset.

4. Create a Shader

Press i to go into the shopnet. Press tab > VEX Standard > VEX Plastic. This puts this shader into the network. This shader offers a number of controls for adding color to your objects.

Change the Diffuse color to red to see the shader ball update.

5. Assign the Shader

Press u to go up to the subnet level of the network. Select the shapes object and in the Parameter pane click on the Shading tab.

Click on the plus sign button [+] next to SHOP Surface. In the Choose Operator window, open up the shopnet and select the v_plastic SHOP. This will apply the plastic shader to your current primitive.


Part Two: Create the Operator Type

Now that the sub-network contains the shapes object and the new shopnet, you can create an Operator Type. Creating an Operator Type turns your network into a Digital asset that can be set up with a custom interface and used by other artists to help populate their scenes.

1. Create Type From...

Press u to go up to the object level of the network. RMB-click on the Primitives_start object and from the menu select Create Type From. This opens a dialogue that lets you set the following:

Set the Operator Name to my_primitives and the Operator Label to My Primitives. Note that you should choose your operator name carefully because this is hard to edit down the line while the operator label is easy to change.

Set the Maximum Inputs to 1 to accommodate the Object's transformations which were already linked to one of the subnetwork's input nodes.

Set the Save to Library to: $HOME/houdini6/myOPtools.otl.

Leave Install Library To set to Current HIP File Only.

These last two settings determine which Operator Type Library your asset is being stored in and whether or not that library will be recognized by this file alone or by Houdini in general. You will learn more about working with Operator Type Libraries in a later lesson.

2. Accept these settings

Press the Accept button. This brings up the Operator Type Properties window where you can begin building up the user interface for your asset.

3. Add an Icon

In the Basic tab section, click on the Icon button. Here you can load an image file or an icon file to be used when this operator is displayed in Houdini. Go to:

$HFS/houdini/config/Icons/Sample/SOP

From here you can use one of the existing Houdini icons for your operator. Find the SOP_sphere icon and click Accept. Since our operator is focused on primitives, a sphere would make a good icon. You could also render out an image of a sphere and read this in. .pic and .jpg images can be used.

Note: This icon may not become visible in the user interface until you use the tool later.


Part Three: Create High Level Parameters

You are now going to set up the parameters for the operator. This will involve either dragging parameters directly from the network or creating empty ones that are hooked in using channel references.

These Parameters will be placed in the operator's Controls pane.

1. Click-drag Parameters

Keep the Operator Type Properties window open and click on the Parameters pane. In the Network pane, press i to go into the subnetwork then select the shopnet and press i again to enter here. The plastic shader will be selected and its parameters available in the Parameter pane.

In the Parameter pane, LMB-drag on the name Diffuse and place it in the Parameter list on the left side of the Operator Type Properties window. This adds the Diffuse(diff) parameter to the list. Repeat for Specular and Roughness.

Click Apply to set these new parameters without closing the window. In the Network Pane, press u twice to go back up to the object level. With primitives_start selected, go to the Parameter pane and click on the Controls tab. The three parameters you dragged over are now available. You can test this by changing the Diffuse color.

2. Create Shape menu

In the Network pane, press i to go into the subnetwork then select the shapes object and press i again to enter here. Select the switch operator. This node lets you set which primitive is being made visible at the object level.

In the Parameter pane, LMB-drag on the name Select input and drag it to the Parameter list. Change its Name to shape and its Label to Shape. This is an integer parameter type that is ideal for setting up a menu.

Click on the Menu button. In the first field type 0 and in the second type Plane then press Enter. This item is added to the list. Next create the following menu items:

Note: These menu items have been set up using Primitive names that are different than Houdini uses. This is intentional to show that you have the power to name these to anything you want. It also means that you may want to set up some conventions in your studio to make sure that TDs are being consistent.

Click Apply to set these new parameters then press u twice to go back up to primitives_start. The new menu has been added to the Controls tab. Change the Shape using this menu to test that it is working properly.

3. Create Empty Parameters

To control the size of the different shapes, you will set up four main parameters – radius, height, length and width. Each of these parameters will drive more than one parameter on the various primitive shapes therefore you will create them as empty parameters then link them.

At the top of the Parameters list, click on the Create New menu and select Float. This adds a floating parameter to the list. Change its Name to rad and its Label to Radius. Set its Default value to 1 and click the Range button and set it from 1 to 10. The range determines the slider range even though values outside the range can be typed in.

Repeat to create the following parameters:

Name: ht Label: Height Default: 1 Range: 1 to 10
Name: wth Label: Width Default: 1 Range: 1 to 10
Name: lgth Label: Length Default: 1 Range: 1 to 10

Before accepting these, go to the Basic tab and check Save Defaults as Initial Parameters. This makes sure that the default values defined in this window are used for the operator instead of the edits you make as you test it out.

Click Apply to set these new parameters then press u twice to go back up to primitives_start. The new parameters have been added to the Controls tab with sliders. If you test them you see that nothing happens.

4. Create Channel References

The next step will be to create channel references to allow the four parameters created in the previous step to drive the size of the different primitives. The key is that only some of the parameters will be needed depending on which primitive you are working with.

RMB-click on the primitives_start operator and select Parameters to open a floating Parameter pane. This window will remain focused on this object while you dive down and work with the network in the desktop. Keep the Operator Type Properties window open or minimize it.

In the Network pane, press i to go into the subnetwork then select the shapes object and press i again to enter here. Select the Plane SOP then set its display flag. To control the plane, you need the width and length parameters. From the floating Parameter pane, drag the Width parameter name to the Size X channel. Select Channel Reference as the Paste Method. Next drag the Length parameter to the Size Y channel and make another Channel Reference.

In the Type Properties window, click Apply to accept these references. Now if you test the Width and Length parameters you will see the plane change its size.

Note: In the plane's Parameter pane you will see the absolute reference path that was installed after the click-drag has changed to a relative reference. This is important for maintaining the integrity of the asset.

Now use the same method to set controls on the other primitives. Below is a list of the recommended channel references that create logical controls for the various primitives. Make sure that you select each primitive and set the Display flag while you are connecting and press Apply to test the sliders.

Sphere:
Connect Primitive_start > Radius to sphere > Radius X
Connect Primitive_start > Radius to sphere > Radius Y
Connect Primitive_start > Radius to sphere > Radius Z
Box:
Connect Primitive_start > Width to box > Size X
Connect Primitive_start > Height to box > Size Y
Connect Primitive_start > Length to box > Size Z
Cylinder:
Connect Primitive_start > Radius to cylinder > Radius 1
Connect Primitive_start > Radius to cylinder > Radius 2
Connect Primitive_start > Height to cylinder > Height
Cone:
Connect Primitive_start > Radius to cone > Radius 2
Connect Primitive_start > Height to cone > Height

IMPORTANT: When you are finished, MAKE SURE that the switch SOP has its Display set before you press Accept. If you forget this then the Shape menu will no longer change the shape because the switch SOP is not in control.


Part Four: Test the Asset

Ideally, your Digital Assets will fall into place on the first go. Realistically, you will have to create a solution, test it, then dive back in to make changes.

1. Use the My Primitive Tool

Press the u key twice to go up to the Object level. Click on the Primitives_start operator's Display flag to hide it.

Press tab > Generators > My Primitives. Use the Controls tab to change it to a Sphere and resize it. In the Viewer pane, press q to repeat this tool. Your Digital Asset can now be used to create multiple objects in your scene.

If you are concerned that any of the parameters are not working well, then go back to the primitives_start subnet and from the RMB menu select Type Properties to edit it.

2. Use the Primitive Tool in a new Scene

Select File > New. Discard this scene. Don't worry about losing the primitive_start hierarchy. You can get it back through the My Primitive tool.

Try and press tab > Generators > My Primitives. No tool is available. Even if it is listed at the bottom of the tab menu, this menu item will not be able to find the tool. That is because earlier you instructed the Operator Type Library (OTL) that holds this asset to only load in the previous Houdini file. Not to worry. You can re-install the OTL to get back the tool.

Select File > Install Operator Type Library. Use the [+] button to select $HOME/houdini6/myOPtools.otl then select Accept twice. Now press tab > Generators > My Primitives and press Enter. Now the operator is placed in the scene. You can test the controls to make sure they are working as they were designed.

3. Make the Operation editable

Select the my_primitives object and press i to enter it. As you navigate through the network you will find that all the low-level operations have their parameters locked. By default only the high-level controls are available for the artist to work with. These high-level parameters are also the only ones that can be keyframed. This locked down state is ideal for maintaining the TD/Artist relationship with the TD setting up the controls and the Artist using them.

Go back up to the my_primitives object. RMB-click on it and select Allow Editing of Contents. Now the low-level parameters will be available for editing. Next, RMB-click and select Type Properties to open this window.

If you are the original author of the tool then you can make updates and Accept them into the original OTL. If are not and you want to create an alternative version then you may want to change the Save To Library path to point to a different OTL (eg. localOTtools.otl). Then later you can show your ideas to the original author in case they want to incorporate any of your changes.


Part Five: Refine the Asset's User Interface

Now that the digital asset is again editable, changes can be made to spruce up the user interface. The parameters need to be better organized and the addition of handles and HUD sliders will provide interactive tools in the Viewer pane.

Another issue to address is the fact that the radius, height, length, and width parameters don't always work depending on which shape you have chosen. For instance the sphere only uses Radius while the Plane only uses Width and Length. A good user interface would disable controls for parameters that do not contribute to the definition of the chosen shape. A couple of methods are explored for solving this UI dilemma.

1. Organize the Parameters

In the Operator Type Properties window, click on the Parameters tab. From the menu at the top of the Parameter list, select Folder. Set its Label to Shape. Repeat this and set the second folder's Label to Shading. Any parameters listed below one of these will be placed in a tabbed section nested in the Controls tab.

LMB-drag the Shape folder to the top of the list. Next LMB-drag Diffuse, Specular and Roughness below the Shading folder.

Click Apply. Now in the Controls tab you can see the new sections that make it easier to find specific Parameters.

2. Create Viewer Pane Controls

In the Viewer Pane there are two places you can view Parameters. One is in the Control bar at the top and the other is when you press p to call up a Floating Tool Dialog.

To promote the Shapes parameter to the Control bar, go to the Operator Type Properties window, select Shapes (shapes) from the parameter list and set Export to All. To promote the other parameters to only the Tool Dialog, set Export to Dialog. Click Apply to accept.

Now select the my_primitives object in the Network pane and then with your Cursor over the Viewer pane press Enter to go into the editing mode for that object.

The name My Primitives will be in the top left of the Viewer pane. Select Pane > Toolbars and Controls > Operation Controls to open the Control bar. The shapes menu is now available. If you press p in the Viewer pane, the Tool Dialog opens with all the parameters listed. Now your tool is working more like any other Houdini tool.

3. Create a Custom Handle

When you are in the My Primitive operator, you do not have interactive handles for positioning the shape. You could get the Transform tool and work with that or you can add a transform handle into the interface for the operator.

In the Operator Type Properties window, click on the Handles tab. From the Create New menu at the top of the Handles list, select Transformer (xform). This puts the handle in the list and provides you with a place to map parameters.

Important: These mappings should not be directed to the parameters found in the lower levels of the network. Only the parameters that are a part of the high-level operator can be used. These parameters include those found in the Transform tab and those in the Controls tab.

Click on the arrow [>] next to rx and select Rotate rx. Repeat this for the following parameters:

ry | Rotate ry
rz |
Rotate rz
tx |
Translate tx
ty |
Translate ty
tz |
Translate tz
sx |
Scale sx
sy |
Scale sy
sz |
Scale sz

Press Apply. Now the handle is available for manipulating the transformations of this object.

4. Create Custom HUD sliders

Another useful handle type is HUD sliders. You will create HUD sliders for the four main shape attributes belonging to the object. From the Create New menu at the top of the Handles list, select HUD slider (hudslider). Set its Name to Radius then click on the arrow [>] next to value and select Radius (rad).

Repeat these steps to make HUD sliders for Height (ht), Length (lgth), and Width (wth). Be sure to set each slider's Name to match the parameter.

Click Apply to view these controls in the Viewer Pane.

5. Disable some parameters

To clean up the user interface, you should disable those parameters that are not being used when a particular shape has been chosen. In the Operator Type Properties window, go to the Parameters tab and in the Disable When field, add the following:

For Radius enter { shape 0 } { shape 2 }
For Height enter { shape 0 } { shape 1 }
For Length enter { shape 1 } { shape 3 } { shape 4 }
For Width enter { shape 1 } { shape 3 } { shape 4 }

These entries basically say when shape equals the values listed, then disable the parameter. The numbers represent the values originally found in the switch SOP.

Click Apply to view these controls in the Control section in the Parameter pane. Change the Shape to see how they work. As you pick each shape, the appropriate parameters are disabled. If you have problems, make sure that the parameter name for your Shapes parameter is entered properly as shape.

6. Disable some HUD sliders

The disabling of the HUD sliders requires a couple of more steps. You will need to create some invisible parameters that will only be used for this purpose.

Under the Parameter tab, select Create New > Integer. Set its Name to rad_hud_display and its Label to Radius HUD Display. Click on the Invisible button so that this won't appear in the Controls tab then put the following expression in the Default field:

(ch ("shape")==1) || (ch ("shape")==3) || (ch ("shape")==4)

This expression sets this parameters value to 1 if the shape is set to either the Sphere, Cylinder or Cone. These shapes all use Radius.

Now go back to the Handles tab and click on the Radius handle in the list. From the arrow [>] next to onoff, select Radius HUD Display (rad_hud_display). Now when this value is 1, the HUD slider will be on. When it is 0 then the HUD slider will be off.

Use the same technique to disable HUD sliders for height, length, and width. Remember to list the opposite shapes to those used in disabling the parameters themselves. Click Apply to accept. Again change the Shape to see how they work


Part Six: Write Help

After putting in all that hard work it would seem like your asset is ready to publish to colleagues. But they might not understand how this tool works and what all the parameters do. Therefore you need to write some help that will appear if someone clicks on the operator's Help [?] button found in the Parameter pane.

You can go to the Help tab in the Operator Type Properties window and simply enter some text to get a basic unformatted listing or if you are comfortable working with html then you can open up the Type Properties for any other Object (a light object for instance) then copy and paste the html code into your operator. You can then edit the contents using Houdini's cascading style sheets or write your own formatting.


Conclusion

How much time you put into creating the user interface for a Digital Asset will depend on how your production pipeline is set up. There can be any number of networks inside your asset that could hold shaders, motion, and even render outputs. With Digital Assets you will often find a simple interface for artists at the high-level with lots of complex networks below.