Arbitrary changes
This commit is contained in:
parent
71502fe38b
commit
e0038838d4
1 changed files with 5 additions and 7 deletions
|
@ -14,13 +14,11 @@ Color PhongShader::shade(Scene const &scene, Ray const &ray) const {
|
|||
for (auto &light: scene.lights()) {
|
||||
auto illum = light->illuminate(scene, ray);
|
||||
|
||||
auto omegaI = normalized(illum.direction);
|
||||
auto omegaR = 2 * dotProduct(omegaI, ray.normal) * ray.normal - omegaI;
|
||||
auto cosPsi = dotProduct(ray.direction, omegaR);
|
||||
auto colorI = diffuseCoefficient * diffuseColor / PI +
|
||||
(specularCoefficient * specularColor * std::pow(cosPsi, shininessExponent));
|
||||
|
||||
fragmentColor += illum.color * colorI;
|
||||
Vector3d omegaI = normalized(illum.direction);
|
||||
Vector3d omegaR = 2 * dotProduct(omegaI, ray.normal) * ray.normal - omegaI;
|
||||
float cosPsi = std::max(0.0f, dotProduct(ray.direction, omegaR));
|
||||
fragmentColor += illum.color * diffuseCoefficient * diffuseColor / PI
|
||||
+ illum.color * specularCoefficient * specularColor * std::pow(cosPsi, shininessExponent);
|
||||
}
|
||||
|
||||
return fragmentColor;
|
||||
|
|
Loading…
Reference in a new issue