View Full Version : specular lighting looks wrong
I am just starting opengl and I have setup a basic pool table with a light hovering above it and the camera rotating around it. My problem is that the specular lighting of the table seems to highlight the wrong place. See the picture for a better idea of what I mean.
03-17-2007, 02:45 AM
I've had some similar results once with three invalid attenuation parameters (I think they where all zero) which gave me irregular noise over it from some angles. Comment out some parameter calls to use the default values.
Also, check on the specular calculation mode:
Could you post your code and the values that you pass to the light (position,attenuation,specular etc)? How are you setting up the perspective?
03-21-2007, 07:25 PM
remdul is reffering to use:
gl.glLightf(GL_LIGHT2, GL_CONSTANT_ATTENUATION, 1.0f);
gl.glLightf(GL_LIGHT2, GL_LINEAR_ATTENUATION, 0.0f);
gl.glLightf(GL_LIGHT2, GL_QUADRATIC_ATTENUATION, 0.0f);
1.0f, 0.0f, 0.0f as stated above are the default value from OpenGL 1.2 on I am quite sure.
Try setting that to see if it works.
03-22-2007, 12:13 AM
Is that per-vertex specular?
03-22-2007, 11:29 AM
From the looks of it, it seems that the highlight is being interpolated over a single quad with one normal (am i correct?). You might want to try breaking up the "table" into a grid like structure with multiple normals.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.