Use true Lambertian diffusion
This commit is contained in:
parent
204180b1a7
commit
e397ee9ad9
2
main.c
2
main.c
@ -18,7 +18,7 @@ Color ray_color(Ray r, Hittable world, int depth) {
|
||||
HitRecord record;
|
||||
if (hittable_hit(&world, r, 0.001, DBL_MAX, &record)) {
|
||||
Point3 target = point3_add(
|
||||
record.p, vec3_add(record.normal, vec3_random_in_unit_sphere()));
|
||||
record.p, vec3_add(record.normal, vec3_random_unit_vector()));
|
||||
return color_mul(0.5,
|
||||
ray_color((Ray){record.p, point3_sub(target, record.p)},
|
||||
world, depth - 1));
|
||||
|
||||
4
vec3.c
4
vec3.c
@ -59,3 +59,7 @@ Vec3 vec3_random_in_unit_sphere(void) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Vec3 vec3_random_unit_vector(void) {
|
||||
return vec3_normalize(vec3_random_in_unit_sphere());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user