Houdini 20.5 Solaris and Karma

Using MaterialX in Solaris

Houdini has VOP node equivalents of the MaterialX shader nodes. You can build a shader network using these nodes, or import an existing MaterialX-based shader, and use them with Karma (Houdini’s USD renderer).

On this page

Overview

MaterialX is an open source standard for describing shading networks. MaterialX shading networks are designed to be portable between applications and renderers.

Solaris and Karma utilze MaterialX through UsdMaterialX, a plugin that allows USD to import MaterialX shaders. Houdini lets you build MaterialX materials in VOPs and translate them into a UsdShade prims automatically. While there is a script that can convert VOP nodes into .mtlx files on disk, the primary workflow Solaris supports, is MaterialX nodes encoded as USD prims. Solaris can reference MaterialX looks defined in .mtlx files on disk, but support for writing to .mtlx files is much more limited.

In Solaris, users can build pure MaterialX materials, or Karma-centric ones. The difference is Karma is able to supplement missing functionality with dedicated shader nodes. To facilitate these workflows, corresponding builder nodes are available within the Material Library.

Tip

Because Karma XPU will never support the traditional VEX-based shaders used by Mantra and Karma CPU, MaterialX is probably the future of building materials for the Karma renderer.

The official MaterialX specification and documentation used in Houdini are in the following documents:

Tip

Houdini’s MaterialX support includes the MtlX Standard Surface node, a physically-based uber-shader, similar to the Principled shader. You can use this node for most needs rather than defining your own shaders.

Limitations

  • Currently, Karma does not support MaterialX light shaders.

  • MaterialX nodes have Color Space parameters, but this is actually metadata which USD’s Hydra interface currently doesn’t pass on to the render delegate.

  • MaterialX defines a few tokens (for example {frame} for time) for use in file paths, but these are currently not used by Karma or Houdini. You can use the <UDIM> token, however.

  • Karma only supports Volume materials on volume primitives (VDBs).

  • Karma does not currently support Surface and Volume materials on the same prim.

  • The Compositing nodes are not supported by Karma.

  • String inputs are not allowed, even for simply connecting parameter inputs from a material’s public interface.

Material types

The two primary types of materials created with MaterialX are Surface and Volume materials.

Materials can contain different shader types:

BSDF

Describes how surfaces absorb, reflect, and refract light. Used in Surface materials.

VDF

Describes shading specific to volumes. Used in Volume materials.

EDF

Adds emission/illumination properties. Can be used in both Surface and Volume materials.

Surface materials

  • The MtlX Surface Material node defines a Surface material. You can wire a network of MaterialX surface shading nodes into it to define the surface shader. It also lets you wire in a displacement shader network if you want displacement. This is similar to the Collect VOP in Houdini-native materials, and in fact you can use a Collect VOP in place of a MtlX Surface Material VOP when building a network.

    (Similarly to Houdini-native materials, you can use most MaterialX surface-shading nodes as a stand-along material. However, if you want to add a displacement shader to the surface shader, you need to use a MtlX Surface Material or Collect to have a place you can wire the displacement network in.)

  • You define surface shading by wiring BSDF, EDF, and/or Opacity nodes into a MtlX Surface node.

    Use the MtlX Thin Surface node to create the look of a thin, two-sided geometry, where each side can have a different BSDF and EDF.

  • You can combine BSDFs using MtlX Layer, MtlX Add, MtlX Multiply, or MtlX Mix.

  • You define displacement using the MtlX Displacement node.

  • You can use the Uniform EDF node to add emissive properties to a MtlX Surface.

Volume materials

Textures and patterns

MaterialX includes many nodes for working with textures.

  • MtlX Image, MtlX Tiled Image, and MtlX Triplaner import texture images. You can use the <UDIM> token in texture filenames. (See limitations above.)

  • The MtlX Normalmap node can transform a normal map texture to a world-space normal, for use as input to the MtlX Standard Surface node's normal input.

    MtlX Normalmap’s in input expects a typical normal map, with a tangent-space normal vector from 0 to 1 range (that is, centered on 0.5). The node’s normal and tangent must be vectors from 0 to 1.

    Note

    When reading any normal maps with a MaterialX node, set the Signature to Vector3 to make sure a color space is not applied to the incoming data.

  • The MaterialX specification does not currently include many ready-made procedural patterns. However, the low-level math nodes are fairly complete. For an example of how to use them to make a procedural pattern, see the how to section below.

Primvars and geometry attributes

MaterialX shaders can read arbitrary primvars from USD prims. You should set the Signature to the primvar’s data type. The nodes will automatically detect the primvar’s interpolation.

  • The MtlX Geompropvalue node can read any primvar. (You do not need to include the primvars: prefix).

    • This node is very similar to the USD Primvar Reader node, but as MaterialX doesn’t currently support string inputs, we can’t wire up the primvar name to a material’s public interface. Karma lets you mix the USD Preview nodes with MaterialX nodes, so that is a current workaround until MaterialX supports string inputs.

    • In Karma CPU only, you can also use the Geompropvalue node to import global VEX variables.

  • MtlX Geometry Color reads the primvars:displayColor primvar.

  • MtlX Normal reads normals (vector3).

  • MtlX Texcoord reads primvars:st or primvars:uv (vector2 or vector3).

Colors and Color Correction

The MtlX Color Correct node provides a one-stop tool for adjusting texture maps or other color signals. Other related nodes for tweaking color include:

  • MtlX Contrast will increase or decrease the contrast of colors.

  • MtlX HSV Adjust lets you adjust RGB colors using Hue, Saturation, and Value. Internally this node takes care of the conversion to and from HSV.

  • MtlX Range remaps color ranges or applies gamma.

  • MtlX Saturate increase or decrease the saturation of color.

Additionally, MtlX RGB to HSV and MtlX HSV to RGB can be used to convert colors between RGB and HSV representations.

How To

To...Do this

Karma Materials Quickstart

  1. Create a Material Library LOP.

  2. Inside of that node, create a Karma MaterialX Builder.

  3. Rename the subnet to “quickstart_material” and dive inside.

Note

When inside of a Karma MaterialX Builder, the tab menu is filtered to only show compatible Karma, Preview Surface, and MaterialX-compatible shaders.

  1. Go back up to the parent LOP network.

  2. Connect an Assign Material to the Material Library node created earlier.

  3. On the Assign Material node, select some Primitives, then set Material Path to /materials/quickstart_material, to make the material assignment.

Reference a material from an external .mtlx file

Tip

Referencing specific materials out of a MaterialX definition file helps to keep scenes cleaner and easier to navigate. It is generally much better to reference .mtlx shaders, than it is to sublayer them.

  1. Create a Reference LOP.

  2. Set the Reference file to the file path of the MaterialX .mtlx file on disk.

  3. Use the Reference primitive pop-up menu to select the specific material to load in.

  4. Add an Assign Material node and set up its parameters to assign the referenced material to a USD prim.

Houdini includes some example materials in $HFS/houdini/materialx_resources/Materials/Examples/StandardSurface/

Create a basic Standard Surface material

The MtlX Standard Surface node is a physically-based uber-shader, similar to the Principled shader. You can use this node for most needs rather than defining your own shaders.

  1. Create a Material Library LOP.

  2. Double-click the Material Library node to dive into the VOP network inside.

  3. Inside, create a USD MaterialX Builder, and dive inside.

Note

Use this builder if you require pure-USD MaterialX graphs. But when rendering exclusively with Karma, the Karma MaterialX Builder is usually a better experience.

  1. Inside, create a MtlX Standard Surface VOP.

  2. Set up the parameters of the node. You can also load and wire textures into the Standard Surface node’s texture inputs (see below).

  3. Give the material VOP a menaingful name (for example, red_car_paint).

  4. Go back up to the parent LOP network.

  5. Use the parameters on the Material Library to import the material and assign it to USD geometry.

Use textures with the Standard Surface material

  1. See above for how to create a Standard Surface material; dive inside of the Material Library and USD MaterialX Builder.

  2. Create a MtlX Texcoord VOP. Change the Signature to Vector2.

  3. Create a MtlX Image VOP.

    • Change the Signature to Color.

    • Set the Filename to the file path of the texture image file.

    • Wire the MtlX Texcoord node’s output to the MtlX Image node’s texcoord input.

    • Wire the MtlX Image node’s output to a texture input (for example, base_color) on the Standard Surface node.

Create a surface shader from scratch using a BSDF

  1. Create a Material Library LOP. Double-click the Material Library node to dive into the VOP network inside.

  2. Create a USD MaterialX Builder (or a Karma MaterialX Builder for a Karma-only mateiral). Double-click that node to dive inside.

  3. Create a MtlX Surface Material VOP.

    (You can also use a Collect VOP as the material output. This is necessary if you want to connect multiple shaders for different renderers, or author a USD Preview shader manually.)

  4. Create a MtlX Surface. Wire its output to the MtlX Surface Material node’s surfaceshader input.

  5. Create a MaterialX BSDF node (for example, the MtlX Conductor BSDF). Wire its output into the MtlX Surface node’s bsdf input.

  6. Set up the parameters on the BSDF node.

  7. Give the MtlX Surface node a meaningful name (for example, red_metallic).

Create a procedural pattern

MaterialX includes very low-level nodes for manipulating values. With enough patience, you can use them to build procedural patterns such as stripes or checkerboards.

The following example shows how to use math nodes to make a procedural stripe texture.

  1. Create a Material Library LOP. Double-click the Material Library node to dive into the VOP network inside.

  2. Create a USD MaterialX Builder (or a Karma MaterialX Builder for a Karma-only mateiral). Double-click that node to dive inside.

  3. Create a MtlX Standard Surface VOP.

  4. Create a MtlX Texcoord VOP. Change the Signature to Vector2.

  5. Wire the MtlX Texcoord node’s output to a MtlX Separate2.

    This splits the texture coordinates vector2 output into separate wires.

  6. Create a MtlX Multiply. Wire the Separate2 node’s outx to this node’s in1.

    This node’s in2 parameter will control the stripe frequency. Set it to 5 for now.

  7. Create a MtlX Sin node and a MtlX Ceil node. Wire the MtlX Multiply’s output to the MtlX Sin’s input, and the MtlX Sin’s output to the MtlX Ceil’s input.

  8. Create a MtlX Mix node.

    • Change the Signature to Color.

    • Set the fg and bg colors to the alternating colors for the stripes.

    • Wire the MtlX Ceil’s output to the MtlX Mix’s mix input.

    • Wire the MtlX Mix’s output into the Standard Surface node’s base_color input.

Edit a Material Interface from the Viewer or Scene Graph Tree

  1. Select a Material primitive in the Viewer or Scene Graph Tree

  2. on the primitive in the Viewer or Scene Graph Tree, go to Edit Primitive ▸ New node to edit primitive…

  3. This will create an Edit Material node that corresponds to the primitive type selected.

Edit a shader prim from the Viewer or Scene Graph Tree

  1. Select a Shade primitive in the Viewer or Scene Graph Tree

  2. on the primitive in the Viewer or Scene Graph Tree, go to Edit Primitive ▸ New node to edit primitive…

  3. This will create an Edit Properties or Edit Material node that corresponds to the primitive type selected.

List of MaterialX VOP nodes

Solaris and Karma

USD

Geometry

  • SOP Geometry I/O

    Details of how Houdini converts SOP geometry to USD, and how you can control the process.

  • Component Builder

    The Component Builder tool puts down a network snippet for creating a USD model from SOPs, with support for materials, variants, payloads, and layering.

Layout

  • Stage Manager

    How to work with the Solaris stage effectively.

  • Edit node

    Interactively transforms prims in the viewer. Can use physics collisions to position props realistically.

  • Layout node

    Provides tools for populating a scene with instanced USD assets. You can place individual components, paint/scatter components in different ways using customizable brushes, and edit existing instances.

  • Custom Layout Brushes

    How to create layout brush digital assets you can use to customize the behavior of the Layout LOP.

Look Development

  • MaterialX

    Houdini has VOP node equivalents of the MaterialX shader nodes. You can build a shader network using these nodes, or import an existing MaterialX-based shader, and use them with Karma (Houdini’s USD renderer).

  • UDIM paths

    You can encode different tiles of a texture space into different texture files, each with its own resolution. You can then specify a texture filename such as kaiju.exr, and Houdini will replace the token with the specific tile address at load time.

  • Shader translation framework

    Describes the Solaris shading framework, including shader node translation to USD primitives.

Karma User Guide

Karma basics and workflows