DGUnreal Tips: UT 3 Materials

 

Unreal Tournament III Tips and Information
This information is provided by DGUnreal.  Please do not copy this and post it elsewhere.

Materials

ut3-tut-ut3tips-mat-mat

Materials provide the visual rendering properties, including textures, that are applied to CSG Surfaces, StaticMeshes, Terrain Layers and other engine geometry.

While most Materials can be quite high in instruction count, it is always best to optimize them for the lowest value, especially since varying video cards have differing support for pixel shader instruction size, etc.  This is especially important for Terrains, which is covered in another tip topic.

Solid Colors

For solid color Materials use a Constant3Vector expression and specify the RGB value directly.

ut3-tut-ut3tips-mat-solid

RGB Uncompressed Textures

Unreal Engine 3 doesn’t directly support uncompressed RGBA8 textures for dimension sizes above 2 pixels. Any texture that is imported that has a dimension that is 1 or 2 pixels will be uncompressed since its uncompressed and DXT compressed size would be the same.
To create an uncompressed gradient, use a 2-pixel wide texture such as 2×256.
To create an equivalent larger uncompressed texture, split the RGB into bitplanes and import each as a G8 8-bit grayscale texture, then re-combine them in the Material.

Fallback Materials

ut3-tut-ut3tips-mat-fallback

Parent (standard Material):

ut3-tut-ut3tips-mat-fallbackmat

Fallback:

ut3-tut-ut3tips-mat-isfallback

For standard Materials that have more than three TextureSample expressions or more than 50 to 70 instructions, a proper Fallback Material should be created.

Fallback Materials are used in the engine render pipeline when a specific standard Material is unable to be compiled on the target video system. The reasons for failing to compile are usually related to the material complexity such as the number of instructions being too high. For example, older video cards such as Shader Model 2 have a more limited shader system than Shader Model 3, and can only render simpler materials.

If no Fallback Material is supplied for a standard Material that fails to compile, the engine will automatically start dropping features such as Specular and attempt a re-compile, but this may still cause issues on older video cards such as Shader Model 2. So it is usually best to create Fallback Materials yourself, where you can tailor the simpler Fallback Material setup to still support the desired Material look and style.

Fallback Materials themselves cannot be assigned directly to geometry because they are not chosen for rendering unless the assigned standard Material fails to compile.
If a Fallback Material is assigned directly to such a surface, the engine will actually assume that the default checkerboard (null) Material is supposed to be the standard Material assigned, and because the default Material will never fail in the shader compile, the default checkerboard Material will be shown in-game and the Fallback Material will never be rendered.

Maximum Texture Dependency Length

ut3-tut-ut3tips-mat-mtdl

Materials that are designed so that one TextureSample’s UV is reliant on the pixel lookup of a second TextureSample will result in what is termed a “Texture Dependency”.  The “Length” value is the number of dependencies going back through the chain of expressions.

The pink hilighted TextureSample expressions are those that have a dependency length equal to the MTDL (Maximum Texture Dependency Length) value.  So in the case of the example material above, the Diffuse TextureSample is dependant on the UV Distortion TextureSample.
In other words, the rendering of the Diffuse texture is dependant on a value read directly from the UV Distortion texture. The reason it is dependent is because the UV Distortion is providing a specific texture coordinate value at each texel.  If a TextureCoord expression were used instead of the UV Distortion texture, no MTDL is required as their is no dependent lookup.
The MTDL has a performance hit because it is using a texture sample in calculating the texture coordinates for another texture, which is considered a dependent texture read, which is slower than using regular texture coordinates.
Other material expression designs that commonly incur a MTDL are those that use the BumpOffset expression feature.
MTDL’s of 4 or higher may fail shader compiling on older hardware, automatically forcing Fallback generation or the use of the specified Fallback Material.

With permission, I am hosting this information for the UT 3 editor.  A big thanks to DGUnreal for allowing this useful information to live on.  I duplicated the tutorials as they were given to me.  There may be information that was going to be added by DGUnreal. But take this information on this page as completed.

© 2010 Odedge Level Design Suffusion theme by Sayontan Sinha