-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PointLight/SpotLight: Change default decay to 2 #23897
Conversation
tl;dr — this change looks good to me! Summarizing legacy vs. physical attenuation:
1 This is not physically correct, but is a useful tool to limit the otherwise infinite range of the light to something manageable for rendering performance in a scene with many lights. Unlike in the legacy mode, In the legacy mode, attenuation is disabled by default and so the change to from In physical mode, attenuation is enabled by default, and the change in decay will more directly affect the perceived range of the light. This is not a dramatic difference but it is visible. Given that most users are probably still using the legacy mode, this seems like as good a time as any to make the change. I've created a spreadsheet, below, to illustrate the changes. I approximated the quadratic dropoff at Source: Punctual light attenuation in three.js NOTE: I've omitted it from the table, but increasing intensity by a factor of Math.PI is generally useful when switching from legacy to physical mode for the first time. |
|
Let me retract my last comment. I'd prefer to see this PR merged and |
If one was making three.js now I would definitely have decay always default to 2 and enable physical lighting mode. Over at Threekit, this is what we do. It is only because of legacy that this isn't the default in Three.js in my opinion. |
In physical lighting mode, the decay should be hardwired to 2, otherwise it is not physically-correct. How to handle artist-friendly mode (the current default), is up for debate. |
The original "physical lighting mode" didn't actually force people to be physical correct, rather it just changed the defaults and equations to be physically correct unless you changed things no? I think we just want the default to be physically correct while still allowing the user to move away to more stylized choices if they really want to. Thus I advocate changing all default behaviour to be physically correct and removing that mode. |
I like the approach @bhouston describes. Setting If/when we want to simplify further, we'll set After that, if users want lights that decay in a non-realistic way, they can do so by increasing or decreasing |
Although this PR will affect user code, the migration task is simple. Users can restore the lighting by setting I vote to merge the PR for |
After chatting with @mrdoob this will land in |
Related issue: #23614 (comment)
Description
If we aim to make the lighting physically correct we have to switch the default decay to
2
.This PR is an attempt to do the change and see if there are any side effects.
/cc @bhouston @WestLangley @donmccurdy @Mugen87 @sunag