# Calculating the illumination level of an object

In my (UE4) scene I have an object and several (point) light sources. The object can move around, getting closer and away from all those light sources. Now I need to calculate for each light source how much it affects the object at its current position (i.e. distance from the light).

Every light source has three important values:

• Intensity: How bright the light shines (integer vlaue 0..10000)
• Attenuation: Radius around light, how far it visibly influences the scene
• Falloff exponent: Radial falloff around light (inverse squared by default, or can be an integer between 2 and 8)

Now, depending on how far the object is from a light source, it is more or less affected by the light. If the object is outside the attenuation radius, it is not affected at all by the light. I am not so much interested in the light intensity, but more in the distance between the object and a light.

For each light I am interested in a value between 0 and 1. So the easy way would be to simply calc: 1 - distance / attenuation. But I would like to take the falloff exponent into account. Any ideas how to accomplish that?