Advertisement

Point source lighting problems

Started by November 01, 2000 11:09 AM
5 comments, last by Novalis 24 years ago
Well, I had a couple of screen shows showing this problem, but I''ve got no web-space to post them on, so here''s goes... I wrote a simple OpenGL Quake BSP renderer. Once I was satisfied that was working I threw in a point light source that would move around inside the map. It seems to be more or less ok, but I see a lot of glitches. Specifically, I''ll pause the light, and pan the camera around it. As the camera moves, different parts of the lighting pop in and out of "correctness" (ie. some polygons look properly lit from one angle, but badly lit from another). Initially I had my camera transforms in the projection matrix (I know, bad boy...) but moving them into the modelview matrix seems to have had no effect at all. Any other thoughts as to what might be causing this?
If a man is talking in the forest, and there is no woman there to hear him, is he still wrong?
I have a similar problem: when moving the camera around (any light type except directional light), the polygons quickly change color and flicker.
Advertisement
changing colors ? I assume becoming darker ?? Check your normals.
Also remember that openGL does gourad shading, so the color at vertex is interpolated across the whole face. If your polygon is large and the light source is at a great distance from the vertices, then your colors across the whole face will be dim and dark even though the light is right at the center of the poly. So if your light comes and goes around the vertices, you could notice a color change or flickering across the facet.

My surface normals are constant (ie They don''t change from frame to frame), as is the location of the light source.

Under these conditions I can''t think of any reason why the shading on a polygon should change from frame to frame other then some kind of bug in my code?

NeoGL: darker/lighter is changing color But don''t forget that the light sources may not be "white light".
If a man is talking in the forest, and there is no woman there to hear him, is he still wrong?
You missed my point novalis. Your light being monochrome or color is not what I was talking about. Your light source is constant and so are the normals but you are not, hence from different positions you would get different INTENSITY(be it monochrome or color) of the shading coz the vector to the viewer is a factor in the lighting equation.
There might be a bug in your code, but if there isn''t one, then these could very well be the factors that is prohibiting your scene from looking what you want it to look like.
good luck
NeoGL.
I *could* be wrong about this, but I believe the only factor which would change is the specular and reflective components. The ambient and diffuse (which are all I''m rendering right now, and either way are the most significant except for low angles of incidence) should remain constant, should they not?

At any rate, the "popping" I''m seeing can''t be related to specular highlighting. It is clearly tied in some way to the visibility of the vertices I think...?
If a man is talking in the forest, and there is no woman there to hear him, is he still wrong?
Advertisement
this "popping" and shifting that you''re seeing could be due to OpenGL clipping vertices to the view frustum/viewport, which seems to play havoc with the interpolation during gourad shading.

Vertex lighting can look kinda weird and stuff when you try to light large polys (for the reasons that NeoGL stated).

My first reaction (when you said the intensity was changing with orientation) made me think that it was to do with the normals.

Perhaps it is a combination of these two (clipping shite and funny normals)?


there... that''s enough poorly linked statements to make me look like i know some stuff

------------------------------------------------------
"You need a weapon. Look around you... can you construct some sort of rudimentary lathe?"
- Guy Fleegman, Security Officer, NSEA Protector

This topic is closed to new replies.

Advertisement