Houdini 20.5 Mantra materials

Material code caching

You can pre-compile a material as a digital asset to speed up shader compilation at render time.

On this page

Overview

Houdini can cache the VEX code generated from the node network inside a material.

  • For a Material Builder node, this happens automatically if you cook the material (by assigning it and rendering).

  • If you've turned a Material Builder into a digital asset, you can turn on caching using the Save cached code option on the Save tab of the operator type properties.

The 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.

Badge

In the network editor, nodes that can cache VEX code but do not have cached code have an “empty” Cachable badge.

If the node has cached VEX code, the badge changes to the “full” Cached badge.

How to

Tip

If you are using a Material Builder node that hasn’t been turned into an asset, you don’t need to enable caching, the node handles it automatically.

To...Do this

Have a material asset pre-compile its VEX code automatically

Turn on the Save cached code option on the Save 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.

Tips and notes

  • 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.

Mantra materials

Using materials

Textures and UVs

Creating materials

Guru level

Other renderers