PDA

View Full Version : Two Problems with Lighting



B. Jacob
06-09-2001, 10:49 AM
I have programmed a textured mountain and I have the following problems :
1. The triangles get darker and darker as I walk towards them.
2. When I try to set the light "at infinity" by setting its w-coordinate to 0, I get a blank screen.
Please help !

MrShoe
06-09-2001, 05:46 PM
1. Have you set the normals (just checking)
2. Why do you need the lightsource at infinity? Try setting it to a normal coordinate.

RandyU
06-10-2001, 12:32 AM
If you set w=0 then light (x,y,z) means light direction but not position. (0,0,0) will mean no direction.
Default lighting is not bad(its a directional light that points into the screen), so try it.
If screen is blank, you turned ambient light off. What for?

Korval
06-10-2001, 12:49 AM
If the lighting is changing at all, then you aren't setting up the light position/direction in the right place. You should do this after you set gluLookAt (or whatever you use for your camera matrix), since light position/direction is transformed through the modelview matrix.

B. Jacob
06-10-2001, 02:29 AM
I thank very much for your answers !