From ecb01c737412989778599645202d49cb9fc1c0c4 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Thu, 19 Jan 2023 20:39:06 +0100 Subject: [PATCH] Start light ray a bit off the surface --- src/Ray.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ray.kt b/src/Ray.kt index 38631bf..635af1a 100644 --- a/src/Ray.kt +++ b/src/Ray.kt @@ -103,7 +103,7 @@ fun main() { if (hit != null) { var color = hit.color * ambient - val rayToLight = hit.point.rayTo(light.point) + val rayToLight = (hit.point + 0.0001f * hit.normal).rayTo(light.point) if (scene.intersects(rayToLight) == null) { val lambert = max(0f, dot(hit.normal, rayToLight.direction))