On this page

Previous Materials

Overview

This chapter is a continuation of the previous chapter on materials, but is focused on texture maps. 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

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.

Texture Coordinates

By default the shaders reading texture maps will use the default texture coordinate set (i.e. primvars:st, of type texcoord2d). Karma implicitly treats the unconnected texcoord input as if it’s wired to a MtlX Texture Coordinates node.

You can also author arbitrary UV coordinates. When assets have multiple UV sets, or use a non-standard name, use a primvar reader node to specify the different texture coordinates to read texture maps.

UDIMs

Both Karma CPU and XPU support UDIM textures. UDIMs do not currently work with MtlX Tiled Image, because of the way that node is implemented.

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

Copernicus

  • Copernicus networks can create or modify texture maps.

  • Materials can read COP textures by passing op: prefixed paths to COP nodes, rather than file paths.

    • COP nodes can have multiple inputs; you can specify an input by name or index:

      Index

      op:/stage/copnet1/null3[2]

      Name

      op:/stage/copnet1/null3{my_color_input}

  • When the USD ROP writes to disk, these textures get written out automatically along with the USD files. These files are written as optimizedtexture, meaning they are tiled and mip-mapped EXRs.

  • Quick Surface Material has shortcuts to setup COP textures.

Formats

Karma supports every image format supported by Houdini, along with many supported via OpenImageIO. The texture format affects performance and color space assumptions.

Using mip-mapped and tiled texture maps will significantly improve performance, particularly time-to-first pixel. Generally it’s best to stick with .exr or .rat textures. When Karma encounters non-tiled formas, it automatically converts them to .rat (see Auto-Conversion for details).

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.

Tip

You can get a list of available formats from OpenImageIO via commandline (hoiiotool --list-formats) or Python (OpenImageIO.get_string_attribute("extension_list"))

Auto-Conversion

Karma will auto-convert any textures which aren’t tiled/mip-mapped by default. These converted files live alongside the original by default, with the .rat extension added to the file name. Optimized texture maps are required by KarmaCPU.

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    

Filtering controls

Setting inputs:karma_blur to 0, 0.05, 0.2, 0.45, and 0.8

Normally Karma automatically handles choosing mip-levels and texture map filtering. Karma offers some additional controls Additional inputs can be added to mtlximage, that offer explicit control over mip levels and texture map quality.

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

  2. If a reader node is set to “Auto”, Karma goes 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).

Tangent normal maps

The normal map node takes the input normal and transforms it by the basis that’s formed by the shading normal, tangent and bitangents. However, when dealing with MikkT tangent space normal maps, you have to consider several things. There’s a recipe to add the karma_mikkt shader property. You can execute the recipe when you right-click the node and choose Recipes ▸ Karma MikkT Normal Map.

This property indicates that the tangent space normal map input should be treated as a MikkT tangent space normal map. In this case, the tangentu and signs attributes/primvars will be used to properly define the basis. If Karma MikkT Normal Map is turned off (or not present), or the tangentu primvar doesn’t exist, then the map is interpreted as a Karma-specific tangent space normal map (if the signs attribute/primvar isn’t present, it will default to -1).

  • For a Karma-specific tangent space normal map, Karma will use it’s default tangent shading frame to apply the normal map operation.

  • To make Karma-specific tangent space normal maps work in Houdini VK, the tangentu primvar must exist. You can create the primvar through the Poly Frame SOP. There, choose the Tangent UV Gradient style. Then use a Geom Prop Value to read that primvar, and wire it into the tangent or geometry_tangent inputs on your surface shader.

Next steps

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

Next Rendering

Karma User Guide

Appendices