Start light ray a bit off the surface

This commit is contained in:
Sven Weidauer 2023-01-19 20:39:06 +01:00
parent 258530bef1
commit ecb01c7374

View file

@ -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))