MaterialX
MaterialX materials render with their real colours, textures and roughness in the path tracer. Phase 1
(direct mapping), Phase 2 (node-graph programs) and 2b (procedural noise) are live; UDIM follows. Full plan:
usd/docs/Lunaris_PT_MaterialX_Plan_v002.md.
Which surface wins
When a material has both a MaterialX output and a universal UsdPreviewSurface (Houdini writes both), MaterialX wins, as in Karma. The Stage POP's Prefer UsdPreviewSurface toggle flips that for A/B comparisons; a MaterialX-only material is read as MaterialX either way.
standard_surface mapping
| standard_surface | Tracer | |
|---|---|---|
base × base_color | base colour. Defaults follow the node version: 1.0.1 = 1 × 0.8, 1.0.0 (_100) = 0.8 × 1. | in |
specular_roughness, metalness, specular_IOR | roughness, metallic, IOR | in |
specular × specular_color | scales and tints the dielectric highlight (row E). specular = 0 removes it. | in |
transmission | glass weight (opacity never turns into glass) | in |
emission × emission_color | emission | in |
opacity | coverage (colour averaged). Textured: alpha coverage; constant < 1: stochastic coverage. | in |
normal through normalmap | tangent-space normal map (texture × 2 − 1) | in |
transmission_color, coat | Phase 4 | planned |
| sheen, subsurface, thin_film, anisotropy, displacement | not supported |
Texture nodes
UsdUVTextureand MaterialX'sND_UsdUVTexture: file, channel,sourceColorSpace, scale/bias,UsdTransform2d.ND_image_*andND_tiledimage_*: the file's colour-space metadata; tiledimageuvtiling/uvoffset.- A texture that can't be read (today: any
<UDIM>path) falls back like UsdPreviewSurface: base 0.5 grey, emission black.
Node graphs: material programs (Phase 2)
When a material does maths between its textures and the surface, LunarisCore compiles each wired channel's node
graph into a short program: 8 floats per instruction (op, three operands, four constants), 24 vec4 registers, at most
64 instructions. The Stage POP's Program output carries it (one point per instruction, attributes
Op and K) and the tracer runs it at every hit. Materials that only wire textures to inputs,
and every UsdPreviewSurface material, skip this and cost nothing extra.
| Supported nodes | Notes |
|---|---|
| image, tiledimage, UsdUVTexture | One sample per texture node; its r / g / b / a outputs share it. |
| add, subtract, multiply, divide, power, min, max, absval, invert | Colour × float works component-wise. |
| mix, clamp, remap, smoothstep, ifgreater | |
| luminance, saturate, contrast, hsvadjust | MaterialX luma coefficients. |
| colorcorrect | Expanded as MaterialX's own graph: hue → saturation → gamma → lift → gain → contrast → exposure; steps left at their defaults are skipped. |
| normalmap, extract, convert, constant, dot | |
| noise2d, noise3d, fractal3d, cellnoise2d / 3d, worleynoise2d / 3d | MaterialX's own mx_noise.glsl, embedded in the tracer unchanged, so the patterns match Karma / MaterialX. Float and vector outputs; amplitude, pivot, octaves, lacunarity, diminish, jitter, style. |
| position, texcoord | An unwired noise position is the hit's object-space position (MaterialX Pobject); position with space = world gives world. An unwired 2D noise uses the texture coordinates. |
ND_lunaris_tdperlin3d_float, ND_lunaris_tdsimplex3d_float | Lunaris nodes for TouchDesigner's own TDPerlinNoise / TDSimplexNoise: position × frequency, × amplitude + offset. For materials made in TD. |
An unsupported node passes its main input through and is listed in the Stage POP warning and in its Info DAT
mtlx rows; a graph larger than the program limits falls back to the Phase 1 approximation. Opacity is
still read the Phase 1 way (it is tested at every ray candidate, where a program would be too costly).
Checked: scene_harness runs each compiled program on a CPU copy of the interpreter and compares it with values derived separately from MaterialX's definitions (the Phos graph, a full colorcorrect, ifgreater / clamp / smoothstep / invert / remap). Live, the test scene's Phos-shaped plate darkens by the amount its textures predict (linear mean 0.032 → 0.005).
Note on the Phos graph: mix(base, colorcorrect(base, gamma 0.5), ORM.r) squares the
colour where the AO channel is high (unoccluded), not in the crevices. Karma renders it the same way; it looks
like an inverted AO input worth checking in Houdini.
Phases
| Phase | Scope | |
|---|---|---|
| 1 | Direct mapping, specular weight and colour, MaterialX-wins rule, test scene, harness | live 11/19 |
| 2 | Graph compiler: each channel's node graph becomes a short program run at the hit (see above). | live 11/19 |
| 2b | Procedural noise (MaterialX's own noise + TD Perlin / Simplex), position and texcoord, per-prim object space. | live 11/19 |
| 3 | UDIM: each tile its own texture-array layer, tile table lookup, downsized texture cache in usd/cache/textures/ (2048 per tile for Phos, ~8 GB) | planned |
| 4 | Coat lobe, transmission colour | optional |
Object space
The Stage POP's Prims output gives one world → object transform per prim (three rows, indexed by the
geometry's PrimId), so noise sticks to an object when it moves. Limits: PointInstancer instances share
their prototype's PrimId, and light shapes have none, so both use world space. Noise values are not yet compared with
a Karma render of the same scene.
Storm
Storm draws MaterialX materials dark, constants included, so it cannot be the reference for MaterialX. Compare against Karma on the same scene instead.
Phos ship interior
The Phos export points at ShipInterior/v005, which is gone. usd/test_scenes/Phos_Shot1000_TDoverride_v002.usda
repoints the interior to v006/Textures/4k (same Basecolor / Normal / ORM layout) and wires the v006 Emissive map.
It is git-ignored with the other Phos files, because they reference D: paths.