OGL lighting is "popping"

Started by
4 comments, last by DanG 21 years, 9 months ago
I am wroking on a very simple app where a model is rotated around on screen from user input. Everything is working good. The model is lit well and looks better than i expected. The thing is that as the model rotates, the shading on it will "pop" in and out. For example, a given vertice will be almost fully lit, but as it rotates toward being out of the picture, it abruptly changes to very dark. This makes the lighting look unrealistic, real objects change shading gradually as the angle to the light increases. Does anyone know what is causing this? Is there something I should change, like the attenuation values? All help appreciated.
Ambassador: Mr. Bush are you stoned or just really, REALLY dumb?Pres. Bush - I assure you I am not stoned.
Advertisement
sounds like your specular exponent is muffed. I''d suggest around a value of 32 odd..

glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,32.0f);
I had a similar problem

adjust your perspective settings

gluPerspective(45.0, h/w, 0.1f, 10000.0f);

fixed mine, I had those settings farked right up
but I hope it helps you too.

Im just a beginner!!!

http://www.actsofgord.com
~~~~~~~~~~~~~~~~~~~~~~~~~http://on.to/oni
Umm, i think your problem is actually Normals
you need to specify the normal for each vertex for OpenGL to do the realistic Lighting calculations you speak of

Look up "Normal Calculation In OpenGL" on Google, or you can use the Article here on Gamedev.net, its under the OpenGL Glut Tutorials,(you''ll have to ignore the Glut bit)

hope this helps
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
Its not normals. I''m using per vertex normals created using Milkshape 3D''s smoothing feature on my .ms3d model. I''ll try the specular and perspective ideas
Ambassador: Mr. Bush are you stoned or just really, REALLY dumb?Pres. Bush - I assure you I am not stoned.
GOT IT!

silvermace was right, it was in the color components. I had the specular and shinniness values set way too high. It doesn''t "pop" any more and it looks A LOT more realistic! Its a little trick to remember, darkening the colors makes models look less artificial.
Ambassador: Mr. Bush are you stoned or just really, REALLY dumb?Pres. Bush - I assure you I am not stoned.

This topic is closed to new replies.

Advertisement