UE4 LightMap Directionality

12 Dec 2025

Reading time ~1 minute

…

UE4 LightMap Directionality

alt text

From UE4 Lightmap Format Analysis, Unreal encodes a direction channel in the lower half of the lightmap to interact with the pixel normal.

With directionality:

alt text

Without directionality, Unreal uses 0.6 as an empirical value:

alt text

Some mobile games discard the lower half to reduce lightmap size, resulting in very flat lighting with a normal map. If your game uses a forward pipeline, you can utilize geometry normal to interact with world normal to achieve better results with the same lightmap size.

The code is as follows:

// old directionality

// float4 SH = Lightmap1 * GetLightmapData(LightmapDataIndex).LightMapScale[1] + GetLightmapData(LightmapDataIndex).LightMapAdd[1]; // 1 vmad

// half Directionality = max( 0.0, dot( SH, float4(WorldNormal.yzx, 1) ) ); // 1 dot, 1 smax

// faked directionality

half Directionality = 0.6 * max( 0.0, dot( normalize(VertexNormal), normalize(WorldNormal) ) );

Result:

alt text

Our lightmap now has more detail. Even though we discard the directionality, we still use the empirical value of 0.6 to adjust luminance, resulting in slight differences compared to the original.



Share Tweet +1