View Full Version : Lights Flickering.
04-16-2001, 04:12 AM
The problem is that the lights in the scene (no meter if it's a spot poin or directional light ) flickers while interactively rotating the object ( a simple cube ).
My configuration is win2k, ATI rage-128. but it's happens also in software mode.
Any ideas ????????
04-16-2001, 04:58 AM
how is your cube subdivided? are you using stock gl lights or doing the lighting by hand?
If your case is the former, dividing the faces of the cube should yield better results. A 6 or 12 poly cube just won't look good unless you use some combiner, lightmap, or per-pixel teq.
Have you read this (http://www.opengl.org/developers/code/features/KilgardTechniques/oglpitfall/oglpitfall.html) ?
[This message has been edited by lpVoid (edited 04-16-2001).]
04-16-2001, 05:16 AM
This is a simple cube with 6 faces ( 6 quads ). and yes I use the gl lights stack.
Dividing the faces should yield better results in the way the spot light's cutOff shows on the face. It's shouldn't flickers.
Try the cortona VRML viewer on such a file.
( I can send you one )
04-16-2001, 05:22 AM
ok, i'm sure in a few hours the rest of the board will wake up and probably solve your problem in one quick sentance, but something's still bugging me....
each face of the cube is one quad, and you're using hw lights. If I'm not mistaken, the light's colour contribution is computed per-vertex. So you shine a spotlight on the face and you only have five possilbe results:
no vertices are within the light's effect resulting in no light.
one vertex is under the light
all vertices are under the influence of the light.
as you rotate the cube, the number of affected vertices will change, and since there are only 5 different states possible, I don't see how flickering can be avoided.
If this isn't the problem, then I apologize for wasting your time, but when I was first playing around with lights, this issue creeped up on me more times than I'd like to remember.
04-16-2001, 05:27 AM
Well, If the cube is made of 12 triangles it should solve the problem???
04-16-2001, 05:45 AM
in my rather shaky opinion, I don't think 12 is going to give you the expected results. I've bumped the poly resolution to 100 per face and still seen some fragmentation. I guess this is just one of the limitations of gouraurd shading, and you can see evidence of this in some of the newer games, especially MechWarrior4 ( not OGL, but the theory is still the same ).
I'd recommend coding up various levels of subdivision and choose the one that works best for your requirements. I use the same video board as you here at work, and it's limited set of extensions have caused me a few headaches as well.
04-16-2001, 05:54 AM
I tried a cube with 12 triangles, and it's still flickering. I can't change the mesh for better results, since my engine should support any mesh, Anyway, in cortona it doesn't append.
04-16-2001, 05:59 AM
sorry I was of no help. But fear not, there's a lot of talent on this board, and they'll be able to solve your problem. As a side effect, I'll end up learning a bit too.
04-16-2001, 07:19 AM
You could try to fake lighting by using a texture instead, if you want to light a low-poly model. Using the normals as texture coordinates... I used this heavily to fake phong shading during my demo coding days, it's basically environment mapping with a special 'light' texture that is bright in the middle and black at the edges.
There is no way to get good lighting on a cube with such low polys. Gouraud simply does not work that way. Using a GF3 and pixel shaders will do the trick, but the standard OpenGL lighting model simply does not work that way.
04-16-2001, 07:21 AM
I am afraid there isnt much you can do other than add per-pixel lighting(PPL) support (which is a bit more difficult, and not universally support by graphics cards). Sure, make your engine support any size mesh, but unless you do PPL, your graphics artists are just going to have to understand that if they use very low resolution meshes they are going to see bad lighting. And even if you do support PPL, on cards that dont support it you are going to have to drop back to using regular lighting, and the error will show up again.
Of course, there is also the chance that we are not understanding your problem correctly (althouh I doubt it...sounds pretty clear cut). Could you post some screenshot on a web page somewhere?
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.