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 ¶
-
Use the MtlX Volume node to define scattering, absorbtion, and emission for volumes.
-
You can bind volume fields by name with the MtlX Geompropvalue node.
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 from0
to1
range (that is, centered on0.5
). The node’snormal
andtangent
must be vectors from0
to1
.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
orprimvars:uv
(vector2
orvector3
).
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 |
Note When inside of a Karma MaterialX Builder, the tab menu is filtered to only show compatible Karma, Preview Surface, and MaterialX-compatible shaders.
|
Reference a material from an external |
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
Houdini includes some example materials in |
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.
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.
|
Use textures with the Standard Surface material |
|
Create a surface shader from scratch using a BSDF |
|
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.
|
Edit a Material Interface from the Viewer or Scene Graph Tree |
|
Edit a shader prim from the Viewer or Scene Graph Tree |
|