Jump to content
  • Advertisement
Sign in to follow this  

Trying to reproduce 3ds max's light attenuation calculation

This topic is 2909 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

I'm exporting point (omni) lights from 3ds max into my engine, and I'm trying to reproduce approximately the same appearance when I render them. However, I'm having trouble getting the attenuation to match. I'm using Inverse Square attenuation in Max (none of the near/far attenuation settings), with a Decay Radius specified to control the rate of falloff (i.e. the "size" of the light).

The docs in Max give the following bits of information about computing attenuation:


2- Inverse (Applies inverse decay. The formula is luminance=R0/R, where R0 is the radial source of the light if no attenuation is used, or the Near End value of the light if Attenuation is used. R is the radial distance of the illuminated surface from R0.)

3- Inverse Square (Applies inverse-square decay. The formula for this is (R0/R)2. This is actually the "real-world" decay of light, but you might find it too dim in the world of computer graphics.)

<light>.DecayRadius -- The distance over which the decay occurs.

The question is, what is R0, the "illuminated surface" and how does it relate to the Decay Radius parameter. The only thing I can think of, is to set up an equation like this:

attenuation = k/R^2

and tune k so that when R = DecayRadius the light has effectively fallen off to zero (and the scene looks like it does in Max).

I was hoping there would be a nicer way to figure this out than this though, so if anybody is familiar with how this works in Max or has any other ideas I'd love to hear them.


Share this post

Link to post
Share on other sites
If you have MAX SDK, you can take a look at the source code for the lights plug-in. There you can see how MAX calculates light attenuation for the different light types.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!