bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Change light defaults & fix light examples

Open doonv opened this issue 1 year ago • 14 comments
trafficstars

Objective

Fix https://github.com/bevyengine/bevy/issues/11577.

Solution

Fix the examples, add a few constants to make setting light values easier, and change the default lighting settings to be more realistic. (Now designed for an overcast day instead of an indoor environment)


I did not include any example-related changes in here.

Changelogs (not including breaking changes)

bevy_pbr

  • Added light_consts module (included in prelude), which contains common lux and lumen values for lights.
  • Added AmbientLight::NONE constant, which is an ambient light with a brightness of 0.
  • Added non-EV100 variants for ExposureSettings's EV100 constants, which allow easier construction of an ExposureSettings from a EV100 constant.

Breaking changes

bevy_pbr

The several default lighting values were changed:

  • PointLight's default intensity is now 2000.0
  • SpotLight's default intensity is now 2000.0
  • DirectionalLight's default illuminance is now light_consts::lux::OVERCAST_DAY (1000.)
  • AmbientLight's default brightness is now 20.0

doonv avatar Jan 28 '24 14:01 doonv

to fix #11577, you should also change the defaults so that the default values for lights work with the default values for exposure

mockersf avatar Jan 28 '24 15:01 mockersf

you should also change the defaults so that the default values for lights work with the default values for exposure

I can't really, the default camera's exposure is designed for full sunlight while the point lights act similarly to real lightbulbs. And because of that the point lights are really dim. Theres nothing I can really do to make everything look good without compromising on realism or visual quality.

doonv avatar Jan 28 '24 15:01 doonv

you should also change the defaults so that the default values for lights work with the default values for exposure

I can't really, the default camera's exposure is designed for full sunlight while the point lights act similarly to real lightbulbs. And because of that the point lights are really dim. Theres nothing I can really do to make everything look good without compromising on realism or visual quality.

The default ExposureSettings is EV100_INDOOR, is that full sunlight? https://github.com/bevyengine/bevy/blob/397d111ea7b4353babdf448e175c24ebad935d12/crates/bevy_render/src/camera/camera.rs#L116-L122

If the default exposure is for the full sunlight, then the default directional light should be full sunlight, and the one used in examples. otherwise we should change the default exposure to be indoor so that it works correctly with point light, and use point lights in the examples

the default for exposure and for lights should make sense together, and be used in examples

mockersf avatar Jan 28 '24 15:01 mockersf

ah my bad, I just assumed it would be for full sunlight (why else would the point lights be that bright).

doonv avatar Jan 28 '24 15:01 doonv

I do think we should use EV100_OVERCAST instead, as it's more a middleground between indoor lighting and outdoor lighting

doonv avatar Jan 28 '24 15:01 doonv

I do think we should use EV100_OVERCAST instead, as it's more a middleground between indoor lighting and outdoor lighting

no strong opinion on my side, as long as the defaults make sense together 🙂

mockersf avatar Jan 28 '24 16:01 mockersf

I like the overcast as a default, and agreed that we should ensure all of our default values look sensible together.

alice-i-cecile avatar Jan 28 '24 19:01 alice-i-cecile

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Could you add some context on what users should update when this change get released in a new version of Bevy? It will be used to help writing the migration guide for the version. Putting it after a ## Migration Guide will help it get automatically picked up by our tooling.

github-actions[bot] avatar Jan 28 '24 19:01 github-actions[bot]

For those who haven't seen it this was the reasoning behind changing the default exposure to indoors: https://github.com/bevyengine/bevy/pull/8407#issuecomment-1858836978 But in the end the default exposure is pretty much arbitrary + small effort to add ExposureSettings::INDOOR so I don't have a strong opinion there

GitGhillie avatar Jan 29 '24 22:01 GitGhillie

For those who haven't seen it this was the reasoning behind changing the default exposure to indoors: #8407 (comment) But in the end the default exposure is pretty much arbitrary + small effort to add ExposureSettings::INDOOR so I don't have a strong opinion there

I like the reasoning used there, so I think I'll revert the change and use INDOOR again.

doonv avatar Jan 30 '24 11:01 doonv

While I think this PR is a step in the right direction if I follow the steps listed here I'm not sure it actually fixes #11577. Maybe there is a deeper issue? Edit: Or the distances to the pointlights before this PR were just large

GitGhillie avatar Feb 02 '24 16:02 GitGhillie

The deeper issue is that the examples are trying to use point lights as a sun, instead of a DirectionalLight. And obviously your average bulb light isn't as powerful as the sun.

doonv avatar Feb 02 '24 17:02 doonv

What's the current state of this PR?

JMS55 avatar Feb 05 '24 05:02 JMS55

What's the current state of this PR?

Ready to merge I think. But I might have missed examples outside of the 3d examples. I'll check the other examples later.

doonv avatar Feb 05 '24 11:02 doonv

I do feel like the directional lights make the examples look less appealing in general. See for example cubic_curve where the ground plane turns from a nice gradient to a single color:

I do agree with this. I think (for now) I'll revert these in most cases in the interest of render quality. Both the shadows and shading take a quality / interest-level hit.

cart avatar Feb 14 '24 22:02 cart