If the direction of reflected light becomes equal to the direction of eye then we see a surface point P highlighted.
Calculation:
reflectedRay = lightRay.direction - 2.0f * glm::dot( lightRay.direction, normal ) * normal;
float cosAngle = glm::max(glm::dot( eye.direction, reflectedRay ),0.0f);
float spec = powf( cosAngle, specularExponent) * dot(specularColor,currentMat.color);
colors[index] += spec * lightcolor;
Image:
No comments:
Post a Comment