weirdes farb artefakte auf den kugeln wenn ein licht zu nah dran ist

This commit is contained in:
any
2026-07-30 18:12:19 +02:00
parent 82ab538095
commit 2ebc5f03bb
7 changed files with 31 additions and 4 deletions
+5
View File
@@ -1,5 +1,6 @@
#include "structs.h"
#include "math.h"
#include "helper.h"
vec3 collisionPointSphere(ray *lightray, sphere *object)
{
@@ -21,6 +22,10 @@ vec3 collisionPointSphere(ray *lightray, sphere *object)
collisionPoint.x = S * lightray->direction.x + lightray->origin.x;
collisionPoint.y = S * lightray->direction.y + lightray->origin.y;
collisionPoint.z = S * lightray->direction.z + lightray->origin.z;
if (!epsilonCheck(lightray->origin, collisionPoint)) {
return (vec3){-10000000, -10000000, -10000000};
}
return collisionPoint;
}
double S = (-b)/(2*a);