You can pre-compile a material as a digital asset to speed up shader compilation at render time.
Material (shader builder) networks are easy to set up and flexible without the extra work of managing digital asset versions. However, converting a material to a digital asset has two benefits:
Only one copy of the VOP network.
With a plain material network, copying the network to create a variation duplicates the network inside, increasing the compilation time and requiring more memory.
Once you have converted a shader or material to a digital asset, you can create instances of the SHOP type or digital asset and edit each instance’s parameters to create variations. The underlying network will not be duplicated between instances, as it is with copies of material networks.
Pre-compile VEX code for faster renders.
When the Save cached code option on the Basic tab of the operator type properties for the digital asset is on, Houdini automatically pre-compiles the VEX code for the material whenever the asset’s network changes.
This means the renderer doesn’t have to load the asset’s node network and compile it before it can render the material.
These benefits are especially important when distributing renders, since each renderer in the farm doesn’t have to redundantly compile the material itself. Compilation time for very complex materials can take up to several minutes.
By default, the compiled HDA as the “VMantra” as the Render Mask in the Operator Type Editor. If you add the OpenGL context to that mask, ie “VMantra OGL”, the viewport will attempt to shade the objects using that shader’s parameters.
|Convert a Material Shader Builder into a digital asset|
Right-click the material builder node and choose Create digital asset. Fill in the information on where to store the asset and click Accept.
Once you have converted a network to a digital asset, you can create nodes of the new type in a shader network (such as
|Have a material asset pre-compile its VEX code automatically|
Turn on the Save cached code option on the Basic tab of the operator type properties for the digital asset.
You should usually leave this option on unless you need to edit a very complex material asset and want to turn off automatic recompilation while you work on it.
|Make the material run in the viewport (OpenGL context)|
By default, the compiled asset’s Render Mask is set to
How cached code works
Unlocking the asset causes Houdini to load its network (normally Houdini avoids loading the asset’s network and just uses the compiled VEX code).
While the asset is unlocked, Houdini uses the network to generate the material’s code dynamically.
When you re-save the asset (for example, right click the node and choose Save Operator Type, or click Accept or Apply in the type properties window), the cached VEX code is re-compiled.
When you sync the unlocked node (right click the node and choose Match Current Definition), Houdini unloads the nodes of the asset’s network to save memory and just uses the cached code.