Archived

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

Novalis

Point source lighting problems

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I have a similar problem: when moving the camera around (any light type except directional light), the polygons quickly change color and flicker.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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".

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites