Jump to content
  • Advertisement
Sign in to follow this  

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.

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

Recommended Posts



I'm currently adding light attenuation to my shaders. (forward rendering)

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:






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 this post

Link to post
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 this post

Link to post
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 this post

Link to post
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.

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!