From 6b6ef77808585713ab1d04f03e970865b7e7ddb8 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Tue, 22 Dec 2020 22:22:04 +0100 Subject: Fix dielectric materials refraction --- src/sphere.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sphere.cpp') diff --git a/src/sphere.cpp b/src/sphere.cpp index 611dc34..e7be715 100644 --- a/src/sphere.cpp +++ b/src/sphere.cpp @@ -32,7 +32,7 @@ bool sphere::hit(const ray& r, double t_min, double t_max, struct hit_info& info info.point = r.at(t); info.mat_ptr = mat_ptr; - vec3 out_normal = (info.point - center).unit(); + vec3 out_normal = (info.point - center) / radius; info.set_face_normal(r, out_normal); return true; -- cgit v1.3