Updated on 14th Mar 2021

Performance and Optimization

The Simple Light Painter was built on the Idea of having an indirect lighting solution for VR that also works in runtime. Because of this, reducing Draw Calls and improving the Performance had an important role in development. The Light Painters are in most cases faster than default UE4 Point Lights, but will also deliver a different visual look. This can also be compared in the Performance Test Areas of the Demo Builds or the Playground Map.

Visibility and Occlusion Culling

The use of Static Meshes does automatically reduce Draw Calls of Meshes that your Camera does not directly see. This is also mostly true for Transparent Materials on Meshes, unless you disable Depth Tests. Disabling Depth Tests allows your Mesh and Material to always render and ignore any Objects that are between you and the Depth Test disabled Material. This must be used to see the Light Materials while you are inside a Light Mesh.

By default all Light Painters will not use a Depth Test disabled Material, which causes you to not see the Light when you are inside the Light Painter Mesh. In other words, the Light Meshes get culled by UE4 and reduce Draw Calls to save Performance.
By using the Editor Widget or the Light Updater Actor, you can of course see the Lights from inside. It works by changing the Light Mesh and its Material to an Inside Version with disabled Depth Test, but only if you are near or inside the Light Painter. This allows the SLP to reduce the total Draw Calls of the Light Painters to the absolute minimum, since only the Inside Materials and Meshes need to be always rendered to your scene. This is also the big difference from the SLP compared to other Fake Light Solutions that are based on Materials.

The Shader Complexity View Mode of the Unreal Engine does not show Depth Test disabled Materials correctly!
Which is bad, because it can make you think that the Depth Test disabled did get culled, but they did not! They will always get rendered and will drag your Performance down, since it needs more and more Draw Calls, even if they are behind multiple Walls.

Translucency Overdraw

The Light Painters are transparent objects in UE4, which makes them overlap like a glass or water material for example. While they are using the less expensive versions of translucency (Modulate and Additive Blend Mode), they will still have the same issues which can cause performance drops. The main issue is Overdraw, so you should always keep an eye out for how many Lights are overlapping each other from the Camera View. You can see how many of them are overlapping with the Shader Complexity View Mode of the Unreal Engine itself. More information about this View Mode can be found on the official UE4 Documentation

Too many Materials

This may sound scary at first, but there is some Logic in there which can reduce the Pixel Shader and Vertex Shader instruction amount. To make it simple: 1 Light Painter has 48 different Material Instances. Every Light Painter needs Materials with different setups which can be broken down to the following settings:

  • Blend Mode (Modulate, Additive, Additive with Scene Color)
  • Inside or Outside
  • Vertex Shader enabled
  • Normal Influence enabled
  • Global Illumination enabled

While Blend Mode and Inside/Outside are only 1 Choice in total for a whole set of Material Instances, the Vertex, Normal Influence and GI Switches can have a combination. For Example, you could have an Inside Material on the Additive Blend Mode with only the GI enabled. This causes the Normal Influence (Pixel Shader) and the Vertex operations like Distance Fade (Vertex Shader) to not be calculated, which saves instructions on both the Pixel and Vertex Shader.

All of the different Material Instances are stored inside Data Tables, which are used by the different Light Painters to find out which Material it needs for the current Light Painter Actor Instance.

Draw Distance and Fade

This was inspired by the Draw Distance and Fade settings of the default UE4 Lights and should work similar. Simply said, this allows you to automatically disable a Light Painter at a certain Distance and even fade it out. It will then get Distance culled by UE4, which again, reduces Draw Calls since the Engine does not need to render the Light Mesh anymore.

Global Illumination

The GI Capturing will only work if the Light Painter is visible and not culled. You could have a big multi-room Level with a lot of GI enabled Light Painters and only the Lights inside your Camera View will actually capture the Environment. More information about this can be found on the "Global Illumination" page in "Getting Started".

Forward Shading vs Deferred Renderer

The Light Painters will be in most cases faster than default unshadowed UE4 Lights, but only in Deferred Rendering. If you are using the Forward Shading Renderer, this can look totally different. The Performance Test Areas of the Demo Builds can show this pretty good. While the Performance of the Light Painters will be relatively the same in both Renderers, the situations in which they will be more expensive or less expensive in comparison to default unshadowed UE4 Lights will change.

However, they will still be faster in both. It really just depends on the Situation and how many Lights you are using. But they will also not be able to use Normal Influence or Additive with Scene Color in the Forward Shading Renderer.