Advertisement

Moving the light

Started by February 11, 2001 12:17 PM
2 comments, last by Clouds3000 23 years, 9 months ago
I learned the lighting tutorial and designed my own so that I could move the light and it seems to work ok. BUT,....why when I move the light too close to the object (in this case a cube) does the object darken as if I was taking the light away. Anyone any ideas? Thanks for any help Much appreciated Cheers
perhaps the lights going behind the object
or
u could try adding more polygons to the object

http://members.xoom.com/myBollux
Advertisement
I think zedzeek is correct, your object probably doesn''t have enough polys. I''m not sure about that, but my guess is when the light is very near the center of one of your cube faces, the dot product between the lightToFaceVertex and faceNormal vectors is almost 0, so as OpenGL computes the lighting intensities at the vertices, the center of your face will be as dark as the edges are.

Ok, this baffles me.
I have a texture mapped cube and as I said above using the arrow keys I move the light source which works well. Now, the arrow keys also move a small triangle which is drawn on the same coordinates as the light source so the user knows where the light source is situated.
Now,....thinking that the triangle looked crappy, I took it out and loaded in the bitmap of a star (from Nehe's tutorial about moving bitmaps because it looks like a light source.)
To get the blackness away from the edges of the star bitmap I had to use blending, right, I don't disable the depth buffer, I enable CULL_FACE so I can't see the other sides of the cube (I set the cubes alpha value to 1.0f and ALSO the STAR's ALPHA VALUE TO 1.0f (opaque,..yea?). Everything looks fine when lighting is disabled but when I enable it the light source(the star bitmap) loses its brightness and becomes transparent (as if it was set to 0.5f) and the clarity of the cube's texture seems to blend with the colour of the background.
This may sound abit wierd, maybe I am just blind or doing something stupid. Does anyone have any ideas?

Edited by - Clouds3000 on February 12, 2001 11:45:00 AM

This topic is closed to new replies.

Advertisement