-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
Spherical Area Light Fall-Off Attenuation #728
Comments
Thanks for the detailed report, I leave it to new developer to get experience: |
This was already implemented by @DCubix in the ge_brdf branch (eb97104#diff-cd270f0456f47fde6ee278bee899bdb7R1810). Maybe we can commit it to master. |
- Inverse Square Cutoff for Lamps. Describes here: https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/ Code by @DCubix For feature request #728
* UPBGE: Implement new Lamp Falloff - Inverse Square Cutoff for Lamps. Describes here: https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/ Original code by @DCubix. Slightly modified by me to add light preview. New Radius & CutOff parameters exposed in UI when you select "Inverse Square CutOff" falloff type in point and spot lamps For feature request #728
committed in master. Thanks for testing and proposal |
So currently this is how inverse squared calculation looks:
attenuation = 1.0 / pow(distance / the_distance_number_in_light_settings, 2);
(it may look a bit different, but that's the math.However, this does not provide the best results possible. Real lights have radius.
Sourcing for this(https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/), you can calculate spherical area light attenuation by this calculation:
attenuation = 1.0 / pow(distance / radius + 1.0, 2);
If one wanted to keep the distance setting, radius can be multiplied by the distance number in light settings.
This is not very costly calculation by itself, however, the source provides even additional optimizations for deferred rendering.
Now adding "radius" option in light settings and switching to this equation could provide pretty nice results.
The text was updated successfully, but these errors were encountered: