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

Comments for post 2011-02-10-improved-light-attenuation #7

Closed
tommadams opened this issue Apr 4, 2020 · 3 comments
Closed

Comments for post 2011-02-10-improved-light-attenuation #7

tommadams opened this issue Apr 4, 2020 · 3 comments

Comments

@tommadams
Copy link
Owner

Comments for blog post 2011-02-10-improved-light-attenuation

@tommadams
Copy link
Owner Author

comment imported from WordPress
Matt Enright said on 2011-02-10 14:05:30:

You encouraged me to take another look at my attenuation function this morning. Subtracting off the tail was indeed causing some banding.

My solution is a bit different, and would gently end any attenuation function regardless of the inner math because it is just multiplied through.

term = 1 - smoothstep(saturate(d / dmax))^4
light *= term * att

where smoothstep(x) = x*x*(3 - 2*x)

It tends to preserve the brightness of the light until about half way out.

@tommadams
Copy link
Owner Author

comment imported from WordPress
bongju kim said on 2011-11-28 06:52:39:

wow excellent~
i'm wondering how implement attenuation equation in opengl es 2.0.
thanks your post.

@tommadams
Copy link
Owner Author

comment imported from WordPress
Jesús said on 2019-01-20 16:29:30:

This post comes a bit late but I just wanted to share my attenuation function, which is simpler and (I think) has all the benefits exposed above:
f_att = (1 - min(d / dmax, 1))^2;
Thanks for the great posts in your website :-)

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

No branches or pull requests

1 participant