The upcoming release r155
will contain a major change in context of lighting. The legacy lighting mode will be disabled by default which affects all light intensities and how point and spot lights decay.
What does that mean for me?
The release changes the default of WebGLRenderer.useLegacyLights
from true
to false
and also deprecates the property. Meaning it will be eventually removed from the engine with r165
.
Setting WebGLRenderer.useLegacyLights
to false
is one important prerequisite for achieving physically correct lighting in apps.
Disabling legacy lighting mode has two effects:
- Light intensities are not internally scaled by factor
PI
anymore. This so called artist-friendly light intensity scaling factor was in place to make it easier to achieve good looking lighting with intensities around1
. However, in context of physically correct lighting such scaling factors are incorrect and make it impossible to use proper SI units. - Point and spot lights now decay in physically correct ways.
If you are not already disabling the legacy lighting mode in your app, you will have to update light intensities when upgrading to r155
.
Migrating
If you can’t effort a migration now, you can simply set the value of WebGLRenderer.useLegacyLights
back to true
. Since the property is going to be removed in the future, you should consider to update the lighting in the next months.
The intensities for ambient, hemisphere, directional lights and light maps can be restored by multiplying PI
with the existing light intensity values.
The intensity of point and spot lights is measured in candela (cd) now which usually requires much higher intensity values than before. Restoring their decay to the previous behavior isn’t possible because of different computations in the shader. So scenes with point and spot light will look slightly different with r155
even with updated light intensities.
It’s important to understand that using the new lighting mode is just one prerequisite for physically correct lighting. You also have to:
- apply a real-world scale to your scene (meaning 1 world unit = 1 meter).
- not change the default
decay
values of2
for all spot and point lights in your scene.
Only then you can actually consider SI units for point, spot and area lights. Ambient and hemisphere lights (which are special kind of lights and essentially simplified models of light probes) as well as directional lights do not use SI units.
Motivation
The goal of this change is to provide a single lighting mode that supports physically correct lighting. We believe the engine’s lighting should have been implemented like this in the first place meaning without internal scaling factors or custom decay implementations.
Besides, WebGPURenderer
will only come with a single (physically correct) lighting mode. We are convinced it’s better to make this change in WebGLRenderer
now so a switch to WebGPU will become easier.
Questions
For general questions, please reply to this thread. If you would like help updating some existing code, consider starting a new thread with the full context, then including a link in this thread.
We also recommend to check how the official examples and the manual will be updated to get a better impression of the migration tasks. You can do that by simply comparing the example code between r155
and 154
.