Advertisement Jump to content
Sign in to follow this  

Light Attenuation Oval Shape ?

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

Hi guys,


I'm doing per pixel lighting with attenuation like this:


float distance=length(; // distance to point light in world units

float a=1.0f-saturate(distance/24.0f); // homemade attenuation (24.0 is light.y position*2)


...and it's pretty good. I'd like to make it an oval shape though. Maybe I can somehow split up the XZ components ? I think Doom 3 did something with boxes, that could work but I don't know much about it.


Any information would be appreciated.


Share this post

Link to post
Share on other sites

Sounds like you wanna do a spotlight of some sort. Probably even combined with projective texturing like here. Since you already familiar with shadow mapping you shouldn't have problems understanding.


Using a texture for a mask is one way, but if you're only after an oval shape a projection with an aspect ratio other than 1 and procedurally generated falloff/fadeout should suffice.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!