Texturing
From Code43 Urban Warefare Wiki wiki.code43.net
Textures are regular 24bit RGB, 32bit (8bits per channel) RGBA images or DDS DXTn and A8R8G8B8, A8L8 or L8 images. They are intended for use in the user interface, world geometry in game levels, models (player, weapon and mapobject) and HUD.
Contents |
All textures must comply with these rules:
- valid widths and heights in pixels are powers of 2 (32, 64, 128, 256, 512, 1024, 2048). An example is 1024x2048. Maximum width and height of a texture is 4096x4096. The width and height are limited by GFX card (4096x4096 for most hardware). Standard size of a texture is 1024x1024.
- RGB or RGBA images. Currently supported are JPG, TGA, PNG, DDS (DDS is only partly supported.)
Special note for DDS textures
Mipmaps are supported. Please generate all mipmaps (including 1x1 pxsize), otherwise mipmaps won't work. Mipmaps of fine detailed textures that will have small scale ratio in-game (0.0625 or smaller for 1024x1024, 0.125 or smaller for 512x512) should be blurred. Otherwise you will get ugly mipmapping that will exaggerate the unwanted texture pattern.
Supported compression algorithms:
- DirectX texture compression
NOT supported compression algorithms:
- ATI 3Dc compresssion
- UberComppressor
- Palettised Texture Compression
- Grayscale texture Compression
Supported compressed DDS formats:
- DXT1
- DXT3
- DXT5
NOT supported compressed DDS formats:
- ATI2N
- DXT5ATI2N
- all strange DXT5 formats
Supported non-compressed DDS formats
- A8R8G8B8 - use this for gradients and textures that have to be very sharp.
- R8G8B8 - high quality non-compressed format without the alpha channel.
- A8l8 (alpha/luminance) - use this one for 8bit grayscale textures with regular 8bit alpha channel. Non-compressed, therefore best use for gradients.
.
Which compressed or non-compressed format is appropriate for your texture
- Normal maps should use DXT5, DXT3, DXT1, R8G8B8 or A8R8G8B8
- Displacement maps have to be incorporated in the alpha channel of the normal map, therefore the correct normalMap&displacementMap formats are DXT3, DXT5 and A8R8G8B8
- Opaque Diffuse and Color maps should use DXT1 or R8G8B8
- Diffuse and color maps with alpha channel should use DXT3, DXT5 or A8R8G8B8.
- greyscale textures without alpha channel - L8, with alpha channel - A8L8
- Specular maps should use DXT1, R8G8B8 or L8 (if they are greyscale)
- Cube maps should use the Cubemap DDS saved using DXT1, DXT5 or R8G8B8 and oriented in Horizontal strip (nVidia dds exporter layout)
Important note for DISPLACEMENT maps
Displacement maps have to be stored in the alpha channel of the DDS or TGA normal map (unless you are for some odd reason using PNG or JPG textures, in this case they have to be stored in their own files). Important difference between the displacement maps stored in the 8bit alpha channel and in standalone files is that displacement maps, stored in the alpha channel have to be inverted - black is high and white is low!
DDS tools
- My recommendation is nVIDIAs DDS plugin for PS [1]
- CrazyBump works too, but I haven't tested it much. Sometimes creates artifacts.
- Stay away from ATIs TheCompressionator! Use it (with caution) only if nVidias PS plugin doesn't work for you or if you are GIMP user. Take note that it borks some JPEG files (especially those created by Crazybump).
Types of texture maps
1.Diffuse maps
Diffuse maps represent the diffuse reflection and color of a surface. In other words they define the color and intensity of light reflected back when it strikes a surface.
The goal when creating a diffuse map is to draw a color map and darken areas where light would be absorbed. For instance, the cracks in a brick wall absorb more light than they reflect back.
Color map is a predecessor of a diffuse map. It only represents the color and has no effect on intensity of the reflected light.
2.Normal maps and height maps
Are RGB images used for bump mapping. Bump mapping adds an illusion of depth and texture to images. It doesn't actually alter geometry but rather affects the shading over a surface. There are two different kinds of bump maps supported: Normal and height maps. Normal maps define the slope or normals of a surface. In other words, they alter the direction a surface appears to be facing.
The normal for each pixel is defined by storing spatial X,Y,Z transformation data in the R,G,B channels. You can create normal maps from a diffuse or height maps using NVIDIAs PhotoShop or GIMP plug-in. Or render them from high-poly models using 3D modeling application (3DS MAX, Blender, Maya, ...)
Height maps are greyscale images that define the height of the individual pixels of a surface. They adjust the visual depth of a texture.
The height of each pixel is defined by the brightness of the image. A white pixel is as high, a black pixel is as low as it gets. grey levels in between represent different heights.
Heightmaps are usually painted in an image manipulation program. Note that height maps are converted to normalmaps by the engine when loading a game level. The use of height maps is only to allow for an easier workflow. In order to shorten loading times, please never use a heightmap. You should transform them to normal maps using one of the plugins
It should be noted however, that height maps by default do not visually displace a surface. They only serve as a means to compute surface normals for use with dynamic lighting.
What this means is that essentially, a height map is converted into a normal map. And because the only way to compute slope when dealing with height is to compare each pixel value to that of it's neighbors, a height map can never be as detailed as a normal map of the same resolution.
3.Specular maps
Specular maps represent the specular intensity and color of highlights on a surface. The brighter a specular map is, the more shine is applied to the final material. The goal when creating a specular map is to fill the image with a solid value to represent the general specularity of the surface and then darken areas where weathering would occur.
4.Displacement maps
Are 8-bit greyscale images that similarly to height maps define the height of the individual pixel of a surface. The difference between them is that displacament maps are used for controlling the relief shading. Although the displacement map can be the same as heightmap that was/is used to create a normal map, this usually won't look good in-game. Displacement maps are best made from desaturated diffuse maps using the high-pass filter and tweaking the levels. The greater the contrast of the displacement map, the greater the "displacement" (or self-occlusion) effect. Low values of high-pass filter will produce sharp self-occlusion and high values softer self-occlusion.
5. Cube maps
Are either 6-image cubemaps/environment maps that all have the same pixelsize and first part of name and different ending: [cubeMapName]_[direction].type (type is tga,png or jpg)
Valid directions:
_lf, _ft, _bk, _rt, _up , _dn
_up, _down, _left, _right, _forward, _back
_py, _ny, _nx, _px, _pz, _nz
Cubemaps and envMaps can also be in dds cubemap format - nVidias horizontal strip.
6. Miscellaneous maps
special SFX textures, glow maps, ...
Official texture nomenclature
Texture map naming convention
A material consists of multiple texture maps. Each texture map is named according to name of the material to which it belongs. Basic texture maps are:
- diffuse map - materialname_d.fileextension
- normal map/bump map - materialname_local.fileextension
- specular map - materialname_s.fileextension
- displacement map - materialname_DISP.fileextension
- special effects map - materialname_fx.fileextension
Take note that all texture maps that belong to specific material must share first part of their name. This is not a hardware limitation but rather important naming convention that is extremely useful (in terms of the organization) when you have more than dozen of textures in your project. Always obey this rule for your own good!
Versioning and material naming convention
Each material is named according to type of material that it represents and a number. Materials that base on the same diffuse map are named:
- plates1 for original and plates1a or plates1c for differences in material script
- plates1s or plates1l for differences in texture (pixel)size.
Different versions of the same texture map are named like this:
- original version: plates1_d.png
- second version: plates1_d2.png
Simple material script
Metal material with normal and specular mapping
textures/sxy_metal/plates1 {
qer_editorimage textures/sxy_metal/plates1_d.jpg
diffusemap textures/sxy_metal/plates1_d.dds specularmap textures/sxy_metal/plates1_s.dds bumpmap textures/sxy_metal/plates1_local.dds
}
Metal material with normal mapping, specular mapping and relief shading:
textures/sxy_metal/plates1 {
qer_editorimage textures/sxy_metal/plates1_d.jpg
parallax
diffusemap textures/sxy_metal/plates1_d.dds specularmap textures/sxy_metal/plates1_s.dds bumpmap textures/sxy_metal/plates1_local.dds
}

