From e80adf831d03e64d37cb359796297420c15dbfab Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Wed, 28 Aug 2024 01:59:46 -0700 Subject: [PATCH] Ray-caster: correct hit detection --- app-proto/inversive-display/src/inversive.frag | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app-proto/inversive-display/src/inversive.frag b/app-proto/inversive-display/src/inversive.frag index 5620210..da2f415 100644 --- a/app-proto/inversive-display/src/inversive.frag +++ b/app-proto/inversive-display/src/inversive.frag @@ -141,11 +141,11 @@ void main() { int frag_cnt = 0; for (int i = 0; i < sphere_cnt; ++i) { vec2 hit_depths = sphere_cast(sphere_list[i], dir); - if (!isnan(hit_depths[0])) { + if (hit_depths[0] > 0.) { frags[frag_cnt] = sphere_shading(sphere_list[i], hit_depths[0] * dir, color_list[i], i); ++frag_cnt; } - if (!isnan(hit_depths[1])) { + if (hit_depths[1] > 0.) { frags[frag_cnt] = sphere_shading(sphere_list[i], hit_depths[1] * dir, color_list[i], i); ++frag_cnt; }