DGUnreal Tips: UT 3 Lightmaps vs Vertex Lighting

 

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

StaticMesh Lightmaps versus Vertex-Lighting

It is a common misconception that Vertex-Lighting is a no-cost method of providing shadows on StaticMeshes, and should therefore be used to improve map performance and decrease file size.  This is false on both accounts.

Lightmaps use a flattened UV set for the mesh triangles similar to a skin texture, which can be a variable size such as 64×64 as defined by the level designer.  This provides a per-pixel style of shadow data.
Vertex-Lighting uses a data structure that contains light brightness and color information for each mesh vertex. This data structure consumes a specific non-variable amount of memory as determined by the mesh vertex count.

In most cases, StaticMeshes should be set to use Lightmaps, as this provides the best visual quality, the best performance, and can also consume less memory than Vertex-Lighting.

A comparison of Lightmaps versus Vertex-Lighting provides the following advantages:

- Lightmaps reduce both CPU and GPU load.

- Lightmaps require fewer light-object interactions to be taken into account by the CPU.

- Lightmaps don’t have to be rendered in multiple passes by the GPU.

- The Lightmap pass is integrated into the Emissive pass thereby reducing rendering time.

- Lightmaps can reproduce complex per-pixel shadows across each StaticMesh triangle, whereas Vertex-Lighting can only produce a constant shadow gradient from vertex to vertex.

- StaticMeshes designed to use Lightmaps can be optimized for the minimum number of triangles, resulting in additional improved performance. StaticMeshes designed for Vertex-Lighting are usually highly tesselated to increase the number of vertices in an attempt to improve the shadowing quality, however this has the negative side-effect of increasing the total object triangle count and impacting rendering performance.

- Lightmaps can be set to very small sizes such as 16×16 pixels or 32×32 pixels to conserve on texture memory. This is useful for StaticMeshes that are outside of the main play area, and for StaticMeshes whose shadowing is relatively even across their surface. Vertex-Lighting cannot be optimized in this manner and always consumes the same amount of memory to hold the data structure for the total number of StaticMesh vertices.

- Lightmaps can have UV layouts that are optimized to provide the best shadowing quality.  For example, a spherical rock can have all of the underside triangle UV sizes set very small so that they don’t use very much of the lightmap texture area, which results in a larger texture area for the visible top-side triangles and higher quality shadows on that section of the StaticMesh. Vertex-Lighting is always constant for the StaticMesh’s vertex count and relative 3D spacing and cannot be optimized.

A very low triangle and low vertex count StaticMesh set to Vertex-Lighting may consume less memory than a small Lightmap version, however, the Lightmap version will definitely look better and will have better performance.  Using Lightmaps also allows the level designer to optimize the shadow quality and memory requirements.

Lightmaps are clearly a better performance choice over Vertex-Lighting.

An example:

UT3 StaticMesh HU_Deco_Pipes.SM.Mesh.S_HU_Deco_Pipes_SM_Pipe01.
This mesh has 2555 triangles and 2393 vertices.

420 instances set to Vertex-Lighting consumes 11MB of lightmap memory.
420 instances set to Lightmap of 32 consumes 850kb of lightmap memory.
420 instances set to Lightmap of 64 consumes 3.3MB of lightmap memory.

The required memory amount is also reflected in the size of the map file.

A percentage of the StaticMeshes in this example can even be increased from Lightmaps of 64 to Lightmaps of 128 or higher for top-quality shadowing and still require less memory than the Vertex-Lit versions. The Lightmap versions of the StaticMesh also render 8 to 10% faster than the Vertex-Lit versions.

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