# 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.

## 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:

Quote:
 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.).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.

Thanks!

##### 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.

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
15
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013644
×