On this page

Previous Materials

Overview

This chapter is a continuation of the previous chapter on materials, but is focused on texture maps specifically. 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 live by passing op: prefixed paths to COP nodes, in-place of disk file paths.

  • When the USD is written to disk, these textures get written out as well.

  • Quick Surface Material has shortcuts to setup COP textures.

Formats

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

Using mip-mapped, tiled textures can significantly improve performance, particularly time-to-first pixel. Generally it’s best to stick with mip-mapped .exr or .rat texture files. 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

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    

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

Next steps

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

Next Rendering

Karma User Guide

Appendices