PDA

View Full Version : specular lighting



gl_Beginner
09-06-2012, 11:31 PM
I am trying to project a specular(spot) light with some intensity close to red color. I haven`t added ambient or diffuse components to the light. The color of my spot is white. But however, when I add some diffuse component, the spot turns red(which is how i wanted it to appear). Can anyone explain why my spot has to have a diffuse component?
Thanks

Kopelrativ
09-06-2012, 11:47 PM
The diffuse color is the material property. If you shine with a white lamp on this material, all colors brighten. That is done by multiplying the RGB values with the same constant (usually depending on the angle to the normal). Ambient like is usually done by multiplying with a small constant.

Specular light is a little different. It adds lights from the lamp, instead of multiplying. Depending on the strength of the lamp, it will override the material properties.

Are you using legacy opengl (http://www.opengl.org/wiki/Legacy_OpenGL)? If so, consider using OpenGL 3, where you program the shaders yourself. When you do that, you have full control over lighting, and don't need to know how OpenGL does it.

gl_Beginner
09-08-2012, 12:11 AM
Thank you Kopelrativ!