Responsible code (found in sphere's shade function)
#ifdef DEBUGGING
{
vec3f normal = hr.hitNormal;
normal.normalize();
vec3f viewDir = hr.startPt-hr.hitPoint;
vec3f refvDir = reflectVector(hr.hitNormal, viewDir);
refvDir.normalize();
viewDir.normalize();
vec3f unitvec = refvDir;
shadeRec.color = (unitvec + vec3f(1.f)) * .5;
return shadeRec;
}
#endif
This makes sense, considering the axis to color correspondence: Red- X, Green - Y, Blue - Z. Replacing "unitvec" with other variables gives different debugging images. For instance, substituting hr.hitNormals gives:
Color as function of Hit Normals:
No comments:
Post a Comment