# OpenGL Specular Light

This topic is 5408 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi ya i 've just read the lighting chapter from the OpenGL super bible and i was wondering how is the light computed when i have ambient diffuse,specular light and material properties( ambient ,diffuse ,specular).Is that something like: Mfv=(mA+mD*poly_color)+lA+lD*poly_color*max(0,N*L)+lS*poly_color*max(0,N*H)^spec_exponent;(H=(N+L)/|N+L|) (material final color 'vector'=Mfv) Is that equation right?When does the specular material component come into play? What if i have a LightSpecular[]={-0.2f,-0.2f,-0.2f,1.0f}and float MaterialSpc[] = {0.0f, 0.0f, 0.0f, 1.0f}; how is the final color computed. ThankX for your help.

##### Share on other sites
See 'The Mathematics of Lighting' on this page for a detailed explanation of how GL does its lighting.

Quote:
 When does the specular material component come into play?

When the specular factor (i.e. max(0,N*H)^spec_exponent) is computed it is modulated (i.e. multiplied by) the specular material colour and the light's specular colour. Not the poly colour as you've indicated in your equation. Though you can get the material specular colour to be the poly colour using glColorMaterial.

• 18
• 29
• 11
• 21
• 16