Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actualalvaro

Posted 22 September 2012 - 10:17 PM

You should not add a diffuse or specular contribution if the dot product between the normal and the direction to the light is negative (you have "fabs" in there, which creates the artifact in the middle part of the sphere on the first picture).

EDIT: Wikipediaseems to agree:

Although the above formulation is the common way of presenting the Phong reflection model, each term should only be included if the term's dot product is positive. (Additionally, the specular term should only be included if the dot product of the diffuse term is positive.)


#1alvaro

Posted 22 September 2012 - 10:14 PM

You should not add a diffuse or specular contribution if the dot product between the normal and the direction to the light is negative (you have "fabs" in there, which creates the artifact in the middle part of the sphere on the first picture).

PARTNERS