Jump to content
  • Advertisement
Sign in to follow this  
ArnoAtWork

Lighting attenuation

This topic is 4855 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Um, you mean the distance formula coupled with

1/(ConstAtten + LinAtten * Distance + QuadAtten * Distance^2)?

Share this post


Link to post
Share on other sites
Exactly!

In 3DS file, light attenuation is given with inner and outer distance... So how to convert into opengl attenuation?

Share this post


Link to post
Share on other sites
Wow, that's weird...anyways, I would wager a guess that inner refers to quadratic, and outer refers to linear.

Share this post


Link to post
Share on other sites
I would guess that near and far refer to distances at which the light is K and 0, respectively, for some useful value of K (such as 255 or 1.0).

In the linear case, L(D) = a*D + b (L = light, D = distance)

K = a*near + b
0 = a*far + b

which solves to

a = K/(near-far)
b = -a*far

In the quadratic case L(D) = a/(D^2) + b*D (distance squared plus a linear term,;a reasonable guess)

K = a/(near^2) + b*near
0 = a/(far^2) + b*far

the solution is a litte more complex:

a = K/ [near * (1/near^3 + 1/far^3) ]
b = -a/(far^3)

Hope that gives you a good starting point.

Tom

Share this post


Link to post
Share on other sites
Hummm, in quadratic case it's not:

K = a*(near^2) + b*near
0 = a*(far^2) + b*far

rather than

K = a/(near^2) + b*near
0 = a/(far^2) + b*far

???



Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!