aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.69k stars 3.98k forks source link

Remove renderer physicallyCorrectLights property and update default lighting setup (r165) #5546

Open vincentfretin opened 4 months ago

vincentfretin commented 4 months ago

Description:

WebGLRenderer.useLegacyLights was removed in three r165, default scene now looks much darker. We really should've defaulted to useLegacyLights=false (physicallyCorrectLights true in aframe renderer) when we switched the default for colorManagement to true in aframe 1.5.0, but that's done we can't go back in the past.

We should:

mrxz commented 4 months ago

For context: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733#migrating-2:

The intensities for ambient, hemisphere, directional lights and light maps can be restored by multiplying PI with the existing light intensity values.

Also, since things won't be the exact same as before, let's also update the default decay value for lights to 2 (matching Three.js defaults). That way the A-Frame defaults should be correct for physically accurate lighting out of the box:

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 of 2 for all spot and point lights in your scene.
dmarcos commented 3 months ago

Anyone wants to open a PR?

vincentfretin commented 2 months ago

Each point I mentioned can be a separate PR, but the two first points are probably good to do together. That may be a good first time contribution if anyone wants to contribute.

@mrxz maybe you know, is there maybe some formula we can apply to find the equivalent light color to have more or less the same rendering?

mrxz commented 2 months ago

@mrxz maybe you know, is there maybe some formula we can apply to find the equivalent light color to have more or less the same rendering?

The colour itself does not need to be changed, only the intensity by a factor of PI. Since the decay/falloff is different the results won't be identical, but there isn't really anything that can be done about that. Though I expect that the difference won't really be noticeable.

dmarcos commented 2 months ago

Looking to cut A-Frame 1.7.0 and we need this fixed. Anyone want to volunteer PRs?