Short Contents

7.5 Texture Mapping in Linear Space

A good rendering and imagine pipeline correctly "tracks" the color space of all image assets. Indeed, serious problems can arise if color space is not properly considered, from texture acquisition to the actual rendering. One can imagine the following problematic case:

  1. An artist paints a texture on his calibrated monitor using a screen gamma of 2.0 .
  2. A lighting artist puts that texture on an object with his screen gamma set to 1.7 .
  3. Since the texture in step 1 has not been properly linearized, the lighting artist will find it difficult to properly match the texture with surrounding environment because it has been created in a different color space.

The problem above can be avoided if all the artists work in linear color space and with well calibrated monitors. Still, it is sometimes difficult to get the original source image in linear color space (for example, an image could be provided by a third party) and a conversion is necessary to bring the image into linear space. Another part of the problem is that many algorithms in computer graphics are only correct in linear space; two such algorithms are texture blurring and texture filtering. A somewhat unexpected implication of this is that performing the mip-mapping process using the tdlmake utility produces wrong mipmaps if the input image is not in linear space(52). Another unexpected result is that the texture filtering performed by texture() and the likes (see texture shadeop) on non linear images also results in slightly incorrect images.
To elegantly solve the aforementioned problems, tdlmake acknowledges two options (see tdlmake options) to specify the color space of the source image: `-rgbagamma' or `-gamma' to specify the gamma and `-colorspace' to specify the name of some particular color space. For example,

tdlmake -rgbagamma 1.7 1.8 1.7 1.0 trees.tif trees.tdl

Will process the input image as if the gamma was 1.7 for red, 1.8 for green 1.7 for blue and 1.0 for alpha (the `-gamma' similarly specifies one single gamma value for all channels for the input image). The following sets the color space to sRGB:

tdlmake -colorspace sRGB intput.tif output.tdl

The actual implications of specifying a gamma (or color space) to tdlmake are the following:

3Delight 10.0. Copyright 2000-2011 The 3Delight Team. All Rights Reserved.