selbe checks wie bei sphere (shadowachne und co.) eingebaut und das hat es gefixxt

This commit is contained in:
any
2026-08-26 03:32:22 +02:00
parent a9d83e82ff
commit 0712e988df
4 changed files with 4 additions and 2 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

+2
View File
@@ -44,6 +44,7 @@ vec3 collisionPlane(ray *lightray, plane *object) {
if (vec3Product(lightray->direction, object->normal) >= 0) return (vec3){-10000000, -10000000, -10000000};
r = vec3Product(object->normal, vec3Subtract(object->origin, lightray->origin)) * 1/(vec3Product(lightray->direction, object->normal));
if (r <= 1e-6) return (vec3){-10000000, -10000000, -10000000};
collisionPoint = vec3Add(lightray->origin, vec3Scale(lightray->direction, r));
return collisionPoint;
@@ -55,6 +56,7 @@ vec3 collisionQuad(ray *lightray, quad *object) {
collisionPoint = collisionPlane(lightray, &Plane);
if (collisionPoint.x <= -1000000) return collisionPoint;
if (epsilonCheck(lightray->origin, collisionPoint) == 0) return (vec3){-10000000, -10000000, -10000000};
vec3 localCollisionPoint = vec3Subtract(collisionPoint, object->origin);
+2 -2
View File
@@ -7,8 +7,8 @@
#include "helper.h"
#include <math.h>
#define epsilon 1e-8
#define RAYSPERPIXEL 10
#define lightBounces 3
#define RAYSPERPIXEL 100
#define lightBounces 6
enum objectType {
SPHERETYPE,
QUADTYPE
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 802 KiB