Advertisement Jump to content


This topic is now archived and is closed to further replies.


Light Attenuation problem

This topic is 5825 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, i am developing a game, where you look on a room from the top (you see the floor as a plane parrallel to the screen). The floor plane is at z=0. Now i want to add point lights with realistic (quadratic) attenuation. The Floor geometry is made of many little squares (GL_QUADS). They are also textured and normals are declared correctly. I''m not using any material properties. Now when I add a light like 2.0 over the floor the floor will be lit homogenous, since i didnt make the light other than constant attenuation yet. But when i set the quadratic attenuation to a nonzero value, the floor will be completely dark. I really don''t know what is wrong here. I also tried to add attenuation to the light of lesson 7 of NeHe''s tutorial with a similar result. Do I have to use material, or what else could be the problem ? The light is NOT infinite far away, it is a local light. Please help

Share this post

Link to post
Share on other sites
Well, i got it working now. Although i have to say, that i''m not sure what was the mistake. I guess it was something with the light position. Now i''m positioning the light in the Render Function, before i positioned it once at initialization.

Can make nice colored light cones playing around with CONSTANT_ATTENUATION and QUADRATIC_ATTENUATION using different colors for ambient and diffuse light.

Important is, that i can make the light stronger using values < 1 for the CONSTANT_ATTENUATION. But then you will get a cone that is 100% bright and inside that cone there''ll be no attenuation. Nice effect *g*

Share this post

Link to post
Share on other sites

  • 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!