Jump to content
  • Advertisement


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


Newbie lighting question

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

So I have a big rectangle of untextured triangle strips that is to be the background... But when I try to put lights in front of it they act strangely. There is a screenshot at http://members.verizon.net/~vze29p4k/lighting.jpg . Here''s the settings for these lights... The rectangle you see is 6.4 units wide and 4.4 units high and at -6.0 into the screen.

const GLfloat Light1Ambient[]= { 0.1f, 0.1f, 0.1f, 1.0f }; 
const GLfloat Light2Ambient[]= { 0.1f, 0.1f, 0.1f, 1.0f };
const GLfloat Light1Diffuse[]= { 1.0f, 0.2f, 0.2f, 1.0f };
const GLfloat Light2Diffuse[]= { 0.2f, 0.2f, 1.0f, 1.0f };
GLfloat Light1Position[]= { 3.0f, -0.25f, -3.0f, 1.0f };
GLfloat Light2Position[]= { -3.0f, -0.25f, -3.0f, 1.0f };

I set it up so I could move the red light around x and z for some testing and it acts very strange. As I move around in x and get closer to the center the lighted area gets smaller, and actually disappears if it is close enough in the z axis to the rectangle. If I move the x position away from the center the lighted area gets larger until it will fill at high brightness half the screen. It also shines, as you can see in the picture, towards the center, neglecting the sides. This is especially noticeable when you are close to the rectangle on the z axis, like in the picture. Is this a problem with my normals? I do not see why the light does not just stay at constant size and strength while moving left and right. Thanks, Tim Tim

Share this post

Link to post
Share on other sites
Are you sure you set up the normals for the each vertex ?
If not you can either specify each one or calculate them(specify)

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!