-
Notifications
You must be signed in to change notification settings - Fork 948
Open
Milestone
Description
Inside the metal class, the color of the reflected ray is attenuated by the constant albedo attribute.
attenuation = albedo;
This is an rather inprecise approximation for metal reflections at grazing angles and gives unnatural dark edges around the spheres (compare the original and corrected image). This issue can be easily fixed by replacing the constant albedo with Schlick's approximation
attenuation = metal_reflectance(cos_theta, albedo);
static color metal_reflectance(double cosine, const color& albedo) {
const color white = color(1, 1, 1);
// Schlick's approximation for metals
return albedo + (white - albedo) * pow(1 - cosine, 5);
}