Search public documentation:


Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 Home > Materials & Textures > Custom Lighting
UE3 Home > Lighting & Shadows > Custom Lighting
UE3 Home > Lighting Artist > Custom Lighting

Custom Lighting

Document Changelog: Created by Daniel Wright.


A lighting model defines the way that material inputs such as Emissive, Diffuse, etc are combined with light properties such as Direction, Color, etc to get the final color. The built-in lighting model in UE3 is Phong, which allows per-pixel diffuse and specular lighting. The custom lighting model allows you to provide any lighting model you wish, which is useful for prototyping. It's a good idea to implement the final lighting model in shader code so that it can be optimized more aggressively.


Custom Lighting behavior with directional lightmaps was changed in QA_APPROVED_BUILD_DEC_2009 to use the existing Specular and SpecularPower material inputs instead of the CustomLighting input.


To use the custom lighting model you just have to open the Material Editor and set LightingModel to MLM_Custom.

Interaction with light types

Custom Lighting just gives you LightVector and therefore can only handle light types where light comes from a single direction, like dynamic point, spot and directional lights. These are zero-area lights. For other light types the Custom Lighting implementation just falls back to standard Phong lighting, using different material inputs. This behavior makes Custom Lighting more complicated but allows it to be used as a full replacement for Phong.


  • CustomLighting - The CustomLighting input is where most of the custom lighting flexibility lies. This input will be evaluated for any dynamic zero-area light affecting the surface, and LightVector will be set to the light's direction. Inputs such as CameraVector, LightVector, etc are all in tangent space so hooking max(dot(lightvector, float3(0,0,1)), 0) up to the CustomLighting input will give you basic lambert diffuse lighting using the surface normal (which is 0,0,1 in tangent space). This is the only input that can depend on LightVector.
  • CustomLightingDiffuse - This input is evaluated for area dynamic lights (currently just SH lights used with light environments and sky lights) and directional lightmap diffuse. This must not be dependent on a LightVector node.
  • Specular and SpecularPower - These inputs are used with custom lighting, but only when calculating specular lighting from directional lightmaps. By using the Specular and SpecularPower inputs you can get the same lightmap specular with Custom Lighting as you would with Phong.
  • Emissive, Opacity and Opacity Mask all behave the same as with Phong.
  • Diffuse and DiffusePower are not used.
  • Normal still affects the Reflection Vector, but it is not used for lighting, except when applying directional lightmaps.

Reconstructing the Phong lighting model for dynamic lighting

Here is an example showing how to get identical results as the Phong lighting model with Custom lighting. This is the material with the Phong lighting model:


And here is the equivalent lighting model using custom lighting:


Here is a side by side comparison with the custom lighting material applied to the left column, and the Phong material applied to the right column, being lit by a dominant light and directional lightmaps. Note how specular from the dominant light is visible in both, as well as specular on the directional lightmaps (shadowed areas).


Transmission and TwoSided

Here is a Phong material that uses transmission and two sided lighting:


And here is the equivalent lighting model using custom lighting. The Transmission inputs do not need to be connected, however skylights and SH lights currently do not handle transmission correctly in conjunction with custom lighting.



Custom lighting works with both dynamic lighting and lightmaps. Currently there is no way to access per-light properties like brightness, color, etc except for LightVector. Also custom lighting does not let you control light attenuation. These other light properties are applied to the CustomLighting input automatically.