On this page

Chapters

Overview

This chapter introduces material concepts in Karma and USD, as well as some tips to get up and running quickly.

Building materials for Karma is conceptually straightforward, especially if you are used rendering from Houdini to Mantra or some other renderer. You create Materials by wiring up a VOP network inside a Material Library LOP. Houdini converts the VOP nodes into USD Material prims and assigns them to geometry. During rendering, Hydra sends the primitives and materials to Karma.

When you dive inside of a Material Library node, Material Builder nodes and tools are available. This helps the VOP network mirror the USD data more accurately. It also makes it easier to keep the tab menu from offering an overwhelming number of options, most of which are incompatible with one another.

Quickstart

  1. Create a Material Library LOP.

  2. Dive inside of that node, create a Karma Material Builder.

  3. Rename that subnet node to “quickstart_material”.

  4. Go back up to the parent LOP network (i.e. /stage)

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

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

MaterialX Support

Before getting too far into the details, it’s worth describing Karma’s support for MaterialX, and how that affects an artist building materials. Karma supports MaterialX shaders, but does not rely on MaterialX’s code-generation. Instead Karma reads the shader network of MaterialX nodes described in USD, and builds the material for the renderer on-the-fly. Because of this, Karma is able to supplement missing functionality in MaterialX, with Karma or USD Preview nodes.

Most of the time, artists should start with the Karma Material Builder, when rendering with Karma. When a “pure” MaterialX network, with no custom Karma nodes or conventions, the “USD MaterialX Builder” will only offer up MaterialX nodes supported in the pure spec.

USD materials

Materials in USD can target different renderers. Primitives can only have one material binding, but that single material can host various render contexts. These contexts can be shaders for different renderers or shading languages.

Karma supports a few render contexts. If a material has more than one supported context, Karma uses the following priorities:

Priority

RenderContext

Builder

Example Nodes

1

outputs:vex

VEX Material Builder

2

outputs:kma

Karma Material Builder

3

outputs:mtlx

USD MaterialX Builder

4

outputs

USD Preview

Note

While Karma XPU and CPU support mixing MtlX/Karma/Preview nodes, this is not typically supported by other render engines.

Material bindings

Assigning materials to primitives in Solaris is straightforward. You can bind a material to a prim or GeomSubset using a Material Library or Material Assign node.

By default, the Material Binding Strength is Weaker Than Descendants. This means that bindings apply to all child prims, unless those child prims have their own material binding. Applying materials to ancestor prims, and setting the strength to Stronger than Descendants, can be used to override materials scene-wide.

Warning

Hydra may not override “weaker” materials on instances as one might expect. This behavior is expected to improve in coming versions of USD and Solaris. In the meantime, broadcasting material overrides via inherited class prims can replace materials on instances.

Material bindings in USD can also apply to only specific Purposes (USD render purposes represent different types of renders, such as previews, map generation, and final renders). By default materials apply to any purpose, but you can set a material to only bind in final renders, for example.

USD supports Collection-based material bindings, but at this point there aren’t a lot of workflow/performance advantages to strongly recommend that method. (When USD Collections can be defined as patterns, and/or Hydra supports instance-overrides via collection-based assignments, this will become a very powerful workflow.)

Building shaders

  • Shader building for Karma using VOPs is mostly the same as it was for Mantra and other renderers in Houdini.

  • Material Library tries to create a USD Preview Surface from your material automatically; it works best with Principled Shader and MtlX Standard Surface. Sometimes it’s desireable to avoid creating the automatic Usd Preview material. You can disable the preview generation using the toggle in the Material Library node.

  • Textures can slow down GL viewers, particularly Storm (Pixar’s OpenGL Hydra delegate). If you are concerned with scalability, use displayColors and displayOpacity in USD Preview shaders to color mid to background objects rather than using textures.

  • Use the Collect VOP as the final node when building materials to make it easier to add displacement shaders, as well as manual USD Preview Surfaces or other shaders to the material.

  • You can use Parameter VOPs to create a “public” material interface. This makes it easier to edit materials in downstream LOPs, avoiding the need to edit the underlying shader graph. It also makes it possible to drive different shaders with the same parameter (such as the path to a texture map).

MaterialX

  • If you need a pure MaterialX shader, which works everywhere UsdMaterialX is supported, start with a USD MaterialX Builder.

  • The Karma Material Builder simplifies creating Karma materials based on MaterialX. Inside this subnet, the ⇥ Tab menu is filtered to only show compatible Karma, USD Preview, and MaterialX nodes. This helps you avoid accidentally using VEX VOP nodes in your shader network.

  • You can use MaterialX nodes to drive the patterns on Karma Hair or other Karma-specific shaders.

  • Unlike Houdini’s Principled Shader, the MtlX Standard Surface node does not auto-bind its parameters to geometry attributes.

  • MaterialX shaders with this icon , and which have the hmtlx prefix, are implemented using pure MaterialX nodes, but are not part of the MaterialX standard distribution.

USD preview shader

  • USD PrimVar reader is compatible with MaterialX nodes in Karma.

  • Until UsdMaterialX is supported by more render delegates, the USD Preview shaders are the most common/universal way to define a material.

  • For a strict USD Preview-only material, use the USD Preview Material Builder.

VEX

  • VEX shaders only work with Karma CPU (not Karma XPU).

  • Instead of binding directly to Cd, use the Surface Color node in your shaders. This will fall back to displayColor primvars if Cd isn’t found on the geometry. This makes VEX shaders easier to port from Mantra to Karma.

  • Point Cloud or other geometry-lookup shaders should still work in Karma CPU, but they cannot access any primitives on the stage. They can only access .bgeo geometry files from disk.

Warning

Karma XPU does not support the Principled Shader. However the automatic preview shader feature on Material Library can make it seem like it does. Stats and logging information should clarify these situations, to avoid spending time debugging the wrong issues.

Textures

Karma CPU supports UV and Ptex texture maps; XPU does not yet support Ptex. Each family of materials has its own shader for reading maps.

Shading Family

Image Input Nodes

MaterialX

Karma

USD Preview

VEX

UDIMs

Both Karma CPU and XPU support UDIM textures. Solaris also ships with some utility nodes, which are designed to allow artists to hijack UDIM support, to drive texture variation using primvars. These nodes are implemented as MtlX node graphs, so in theory they should work with any UsdMaterialX renderer that allows for changing UDIM tiles at render time.

Shading Family

Image Input Nodes

MaterialX

Note

UDIMs do not currently work with MtlX Tiled Image, because of the way that node is implemented.

Formats

Use mip-mapped .exr or .rat texture files with Karma. Karma can use other formats, but may not be as efficient or predictable (especially at production-scales) as it is with .exr or .rat. Using mip-mapped, tiled textures will improve performance, particularly time-to-first pixel.

Karma supports every image formats that Houdini supports, along with many supported via Open Image IO. The texture format affects performance and color space assumptions. See color space for more.

You can use the imaketx command-line utility to generate mip-mapped .exr and .rat files from other image formats. Note that imaketx only mip-maps 1 AOV for .exr images, while .rat supports mip-mapping all channels.

Auto-Conversion

Beginning with Houdini 20.0, Karma will auto-convert any textures which aren’t mip-mapped and/or tiled by default. This behavior can be controlled by setting the HOUDINI_TEXTURE_DISK_CACHE environment variable off. If you are still using Houdini 19.5, you can set that env var to all to enable the feature. Add the logging panel, to inspect Karma’s logs and determine if textures are being converted. Or set verbosity to 3 or higher when rendering from the commandline.

[09:02:04] Texture Disk Cache: Converting image /jobs/gramophone.usdz[Gramophone_Normal.png] to texture /tmp/houdini_temp/hfsT7MYFL
[09:02:05] Texture Disk Cache: Finished writing output file /tmp/houdini_temp/hfsT7MYFL
[09:04:11] Texture Disk Cache: Converting image /jobs/maps/mandril.jpg to texture /jobs/aces/maps/mandril.jpg.rat
[09:04:11] Texture Disk Cache: Finished writing output file /jobs/maps/mandril.jpg.rat    

Color spaces

Karma renders internally in scene linear colorspace, so texture maps must be transformed into linear space. Because Hydra doesn’t send through parameter metadata, Karma determines the source color space in a few ways:

  1. If a color space input is “raw”, or the type is a vector, Karma does not transform the image colors.

  2. If a reader node is set to “Auto”, Karma to go through a process to detect the source color space:

    1. Check for role strings embedded in the file name, such as diffuse_map.rec709.exr.

    2. Check metadata in the image file for a colorspace specification.

    3. Assume sRGB for 8-bit images, linear other formats/depths.

Because Hydra doesn’t pass through parameter metadata, MtlX Image nodes with a color3 or color4 signature are always in “auto” mode. To force MtlX Image nodes to read their images in linear format (without transformation), set the parameter’s signature to a non-Color value (such as float, vector3, or vector4).

Note

The string-inputs on MaterialX nodes (i.e. file paths on the Image readers) are uniform strings, to ensure they aren’t expected to vary across the topology of an object. Some nodes, such as Paramater VOP, need the uniform toggle, to connect without error to a string input.

Primvars

Attributes and properties encoded as primvars can be used to drive parameters on shaders of your materials. Any primvar interpolation type is supported, and the supported value types are the shader signatures on the node itself. In addition to the generic reader nodes, Karma supports the specific attribute readers included with MaterialX.

Shading Family

Primvar Reader Nodes

MaterialX

USD Preview

VEX

  • Both the MaterialX and USD Preview nodes can be used by Karma CPU and XPU

  • Volumes can be bound using the Primvar reader nodes from MaterialX

  • When reading primvars in a volumetric shader, only constant-interpolated primvars on the density field can be read. Constant primvars on other fields are ignored.

Material Properties

Many of Karma’s render properties can be overridden at the geometry level. To make it easier to associate render properties with materials, The Karma Material Properties node lets users apply rendersettings via materials. The way these work, is the render properties are added as inputs to the material’s surface shader. Karma can read these inputs, and apply geometry properties as if the gprims themselves had the settings applied to them. Render Properties applied via material is weaker than those applied directly to the geometry.

Transmissive materials

Brute-force caustics and nested dielectrics.

By default Karma uses some optimizations for transmissive materials, such as glass and water.

  • Fake caustics are enabled by default

  • Internal reflections are also disabled.

This can look fine in many situations, and is pretty fast. However true caustics and internal reflections can also be enabled to get a more physically correct result..

Nested dielectrics can also be setup using material or geometry properties, to render nested transmissive materials correctly.

Emissive materials

Non-light primitives can be made emissive, so they contribute illumination at render time. The following shaders support emission:

MaterialX

  • Unlit Surface

  • Standard Surface

  • Uniform EDF (surfaces and volumes)

USD Preview

  • USD Preview Surface

VEX

  • Principled Surface

  • Classic Shader

Creating an emissive shader is usually just the first step. Sampling emissive geometry isn’t as efficient as sampling an actual light primitive. Karma has special render properties, that can improve the sampling of emissive geometry. These properties can be set on the material, or on the geometry objects.

The Karma Material Properties sets render propeties on the Material. While a Render Geometry Settings node can tell Karma to treat certain geometry primitives as light sources. Some additional parameters are also available to control the look and quality of the emissive geometry.

AOVs

Material-defined render vars (AOVs) are not defined as part of USD yet. Until such time, Houdini/Karma provide a custom solution to set these up. This workflow is much more streamlined compared to past released of Solaris.

See Karma AOV 2.0 for more details.

Next steps

For more information on building shaders and materials for Karma, see Using MaterialX in Solaris.

Chapters

Karma user guide

Chapters

Reference