Skip to content
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

Set inverse-squared light attenuation as default #11842

Open
lander-vr opened this issue Feb 24, 2025 · 4 comments
Open

Set inverse-squared light attenuation as default #11842

lander-vr opened this issue Feb 24, 2025 · 4 comments

Comments

@lander-vr
Copy link

lander-vr commented Feb 24, 2025

Describe the project you are working on

Pretty Godot projects

Describe the problem or limitation you are having in your project

Default light attenuation of 1 provides flat and unrealistic lighting.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Set light attenuation to 2.0 as a default, in accordance to inverse-square light falloff in real life.

I would consider this a straight up improvement of out of the box lighting quality, and the expected default behavior in line with lighting behavior of other game engines and 3D software. Additionally the importance for correct attenuation is relatively advanced knowledge, new users might assume lights behave realistically out of the box, while they do not.

1.0 (default) 2.0
Image Image
Image Image
Blender (Eevee) Godot (Inverse square falloff) Godot (Linear falloff, exposure adjusted)
Image Image Image

(Images kindly provided by @passivestar)

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Migration code can ensure the default attenuation of peoples existing projects remains the same (i.e. set to 1) when upgrading.

If this enhancement will not be used often, can it be worked around with a few lines of script?

It would be used often.

Is there a reason why this should be core and not an add-on in the asset library?

This would improve the out-of-the-box quality of lighting.

@passivestar
Copy link

I was trying to figure out why my scene looks different in blender and godot today and I didn't think of light attenuation. It's likely safe to assume that most users won't find the docs comment about the need to set the attenuation to 2.0 because you need to at least be able to identify the problem to even look at that comment. Realistic falloff both matches other apps better and looks better, so it's a better out-of-the box experience for the user

@clayjohn
Copy link
Member

This is something I wish we had addressed when moving to 4.0. Now it is going to be much harder to justify since it will technically break every project with omni or spot lights :(

I commented on this in a bug report earlier godotengine/godot#92551 (comment) saying that I felt that the breakage would be justified. I still think it is probably the right choice. But many users are already sick of having small breakages in every minor release, so we need to tread lightly.

Additionally, I think we have a better case for changing the default for GLTF imports than we do for all lights in the engine. At least for GLTF imports, it is clearly a bug in the importer, and fundamental to ensure the lights appear as they are intended to. With non-GLTF lights, users will already have adjusted their brightness, range, etc. to fit the scene.

@Calinou
Copy link
Member

Calinou commented Feb 25, 2025

I thought this was already addressed by godotengine/godot#44941 in 4.0.

If we want to change the default without breaking existing projects, we can make it so that lights added in the editor have an attenuation of 2.0 by default (using an editor plugin approach like godotengine/godot#56145). This means the "revert" icon would display next to the attenuation after creating an OmniLight3D or SpotLight3D node though.1 Lights created via code wouldn't be affected either, but this ensures existing scenes are not affected.

Footnotes

  1. I believe there is a way to override when a property is marked as revertable (and which value to revert to). If this is possible, then we can make the editor "think" the default value is 2.0 when it's actually 1.0 in code. This way, the revert icon won't display for the new default (2.0), but it will for the old default (1.0), which is more logical.

@Jesusemora
Copy link

While 2 is a realistic value, it's too dim for most non-realistic scenes and results in lights that don't reach the limits displayed by the editor.
I thought it was 1 by default because Godot aims for a stylized look out of the box.
If you set it to 2 by default you need to increase the default energy or tweak it in other ways to compensate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants