If you’ve tried using Unlit Materials in Unreal, you may have gotten frustrated when they look brighter or darker in different lighting scenarios. In some cases, like realistic outdoor lighting, they can even look pitch-black.
This will show you have to “fix” this behavior (in air-quotes, more on that later), so you can use unlit objects and still light your maps however you want.
In your unlit material, add a ViewProperty node and set it to Pre-Exposure
All we have to do is multiply our desired color by the inverse of this property.
Here it is in a base unlit Material, with a single parameter for a diffuse texture:
What we’re doing is counter-acting the scene’s exposure and its effect on the material. Under default rendering conditions, i.e. an exposure of 1.0, nothing changes. But as exposure increases (causing the material to get brighter), this will counter that and darken it back to where it started.
Why Is This Necessary?
It’s a little unintuitive why an “unlit” material changes in different lighting conditions. Afterall, it should ignore lighting, right?
It turns out unlit is behaving exactly as it says, it does in fact ignore lighting. But exposure isn’t part of lighting, it’s a property of the camera lens. So exposure is still going to affect how an unlit material looks (without our addition above).
In a High Dynamic Range lighting model like Unreal’s, colors can have a very wide range of value (i.e. brightness). Much wider than a camera could distinguish at once.
Think about what extremely bright lights do to a lit surface next to an unlit surface. A lit surface will become blazingly-bright, but your unlit material ignores lights, so its value will be constant. This causes the lit surface’s value to become very different from the unlit surface’s. It’ll be so different that a camera can’t show the two at once without clipping. This is why the unlit surface will look “wrong” – the camera’s exposure can only adjust to one surface but not both.
Hopefully this helps explain how the above addition works.
Why Use Unlit?
I use unlit materials (with the fix) a lot for editor-only objects. Things like spawnpoints, animation origins, trigger volumes, etc. It’s nice to put unlit materials on these things because they should always be visible in the editor, and it helps distinguish them from the environment that will appear in the running game.
An unlit material can also be useful for important VFX, when you want to control exactly how something should look to the player. For example, maybe you are making a shooter and you always want the player to see their bullets hitting the world. A lit particle will sometimes be hard to see, but an unlit one will look the same no matter what.