New scatter formula

This commit is contained in:
Phireh 2021-08-21 22:39:59 +02:00
commit 2e24fef5ac
2 changed files with 17 additions and 1 deletions

View file

@ -21,7 +21,7 @@ color ray_color(const ray& r, const hittable& world, int32_t depth)
hit_record rec;
if (world.hit(r, 0.001, INFINITY, rec))
{
point3 target = rec.p + rec.normal + random_in_unit_sphere();
point3 target = rec.p + rec.normal + random_in_hemisphere(rec.normal);
return 0.5 * ray_color(ray(rec.p, target - rec.p), world, depth-1);
}
vec3 unit_direction = normalize(r.direction);