Light Functions

Light Functions are - in essence - a Material that can be applied to filter a light's intensity.

It should be noted, however, that you cannot change the color of lights using a Light Function, only the Light Color setting can do that. Also, Static Lights cannot not use Light Functions, as this feature is only available for non-lightmapped lights, like Stationary and Movable lights.

It should be noted however that you cannot change the color of lights using a Light Function, only the Light Color setting can do that.

In the image below (click it to view it full size), a Material uses Panner and ScalarParameter nodes to move a texture while generating a flickering effect.

Creating a Light Function

You can create a Light Function by setting the Material Domain of a Material to use the Light Function attribute.

MAT_LightFunction.png

Applying a Light Function

You can apply a Light Function to a light from inside the Details panel under the Light Function Material setting.

AddLightFunction.png

Known Issues & Common Questions

The following describes known issues when using Light Functions with the Forward Render.

  • Light Function only working if cast shadows enabled - This happens because FScene::AssignAvailableShadowMapChannelForLight only assigns a Shadow Map channel to shadow casting lights. Light functions need to be rendered into a Shadow Map channel to be passed into the Base Pass in the Forward Render.
  • Light Function only working if there's one shadow casting object - This happens because FDeferredShadingSceneRenderer::RenderForwardShadingShadowProjections skips the light unless VisibleLightInfo.ShadowsToProject.Num() > 0.