Jump to content
  • Advertisement
Sign in to follow this  
Hermes

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!