# Fbx light attenuation

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

## Recommended Posts

Hello,

The formula I'm using is the following:

attenuation = 1 / (attConst + attLinear * dist + attExp * dist * dist);

Now the real problem is how to put Fbx values in relation to that formula.

So far I have plugged what fbx call DecayStart as my attExp variable. It seams DecayStart is in the range 0..100 so I'm multiplying it by 0.01

Now I think this is not really what maya or 3dsMax are doing...

Fbx has also:

NearAttenuationStart

NearAttenuationEnd

FarAttenuationStart

FarAttenuationEnd

So now I'm really not sure how to compute all those, I mean I could invent something of course but I'd prefer something that is commonly used.

Is there a new attenuation formula I should use ?

Does anybody know Fbx enough to teach me how to plug all those variable together in a nice attenuation function.

Thx a lot.

##### Share on other sites

Woah, nobody's working with Fbx anymore ?!?

Or I am completly out of subject here ? Just let me know if my post needs more precision or anything that would help.

On the same register, my tech artist is saying that EmissiveFactor from Fbx is modulating the diffuse, so what is lighted is even more bright but then what is the DiffuseFactor in that case ?

When an artist is putting Emissive factor what is his ojective ? Same question for DiffuseFactor then.

Cheers !

##### Share on other sites

Using "Start Attenuation" and "End Attenuation" you can compute the attenuation factor using smoothstep :

float3 LightDirection = Light.Position - SurfaceData.Position;
float d = length(LightDirection);
float Attenuation = smoothstep(Light.EndAttenuation, Light.StartAttenuation, d);

But on the FBX doc I see the Decay param which contains : None, Linear, Quadratic and Cubic.

None = No attenuation
Linear = lerp(Light.EndAttenuation, Light.StartAttenuation, d);
Quadratic = 1.0f / dot(Attenuation, float3(1.0f, d, d*d));
Cubic = ?

From a paper of Unreal Engine 4, here the formula used :

float Factor = clamp(1.0f - pow(d / Light.EndAttenuation, 4.0f), 0.0f, 1.0f);
float Attenuation = (Factor * Factor) / ((d * d) + 1.0f);
Edited by Alundra

##### Share on other sites

Thank you for your answer. I'll have to do some tests. I'm guessing the pow(4) in unreal is for the cubic attenuation right ? I just don't like the magic numbers.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 12
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633723
• Total Posts
3013545
×