Working With TexturesΒΆ

The texture workflow

Guerilla Render doesn't use directly the texture file you provide, but a texture proxy file (.tex) which is tiled and mipmapped. For convenience, you can provide Guerilla with a bitmap file, and Guerilla will automatically convert the file into a proxy.

The original texture can be in one of the following formats: TIFF, EXR, PNG, TGA, PSD, JPEG, RAW, IFF.

An original texture named 'grid.png', used with a triangle filter and a cc clamping mode (clamp U, clamp V) will be stored in the proxy file .guerilla/grid.png_triangle_cc.tex next to the original texture.

The texture proxy contains the original texture and all its mipmaps tiled in 256x256 pixels. The texture size is the same than the original (no resampling to a power of two size is performed). The texture channels and the channel depth are the same than the original texture. If the depth is 8 bits or float, the texture proxy is a TIFF file. If the depth is half, the texture proxy is an EXR file. Both file format are lossless compressed.

The path to the texture proxy can be redefined using the AutoBuildTexturePath variable in the configuration file. See also TD Guide/Technical Notes/Configuration for a complete description of this feature. In a production environment, it may not be advisable to let Guerilla automatically build and upate texture proxies. The AutoBuildTextures and RenderAutoBuildTextures configuration variables allow you to control the texture workflow in Guerilla. See also TD Guide/Technical Notes/Configuration for a complete description of these variables. Working with proxies

If you prefer, you can directly provide texture proxies (.tex files) to Guerilla Render to centralize the build process. Those textures must be built using our render application.

The textures are built using the 'render' application, see also TD Guide/Technical Notes/Command Line Help for a complete documentation on the command line arguments.

Using UDim

The default texture node is able to use the UDim textures. The udim textures are named 1001, 1002, 1003.. on the first row, then 1011, 1012, 1013 on the second row etc..

To use UDim textures with a texture node :

  1. Put in your texture path a '%d' or a '' pattern in place of the UDim number (1001, 1002, 1003 etc..)
  2. Make sure the texture mode is UDim
If you have another way to number your texture tiles, take a look to the Texture node SL code, you can easily modify it to your production needs. Using Ptex

The default texture node is able to use the Ptex textures. Guerilla Render directly uses the ptex file. No texture proxy will be done.

  1. Use your ptx file in the Texture node.
  2. The geometry must have the 'Geometry > Enable Ptex' attribute.
  3. The geometry using the Ptex texture may require one or more subdivision step if it contains non-quad polygones. To do that, set the 'Geometry > Raytracing > Subdivision Level' attribute to one.

Convert bitmaps to tex files

Use the render binary command with the --buildtex option to convert a bitmap file to a tex file. You must provide the following switches:

  • --in: specifies the location of the input bitmap
  • --out: specifies the location of the output tex file
  • --mode: specifies the wrap/clamp/environment mode for mipmap generation. Acceptable values are "cc" for u-clamp/v-clamp, "wc" for u-wrap/v-clamp, "cw" for u-clamp/v-wrap, "ww" for u-wrap/v-wrap, "cubeuppz" for cross environment maps, "latlong" for latitude/longitude environment maps, "ball" for chrome-ball like environment maps, "automatic" to to determine environment map format based on dimensions
  • --filter: specifies the mipmap filter (either "box", "triangle", "gaussian" or "bspline")
  • --tilesize: specifies the size of the texture tiles (default is 256)

Optionally, you can use the --bump switch to force the computation of the partial derivatives of a bump map, to be used with the RoughBump shaders.

Tex Storage Description

Tex files are tiled, mipmapped bitmaps. Tiles are 256x256 wide by default (see the --tilesize option in the render binary.) The source bitdepth and components are preserved in the tex file. 8bits integer, 16bits integer and 32bits float files are stored as TIFF files, while 16bits half float files are store in EXR files.

Note that only required tiles are actually loaded into the renderer, and stored in the original format and bitdepth, to preserve the memory footprint of textures.

Possible component layouts are L, LA, RGB and RGBA. Alpha associativity is left as is, and it is up to the shaders and texture shaders to treat the color the proper way.

The colorspace is not taken into account, but is used in the texture lookup at render time.

Use render --imageinfo to extract more information on any bitmap or tex file.