From 8f68600264eea1dcc0d1ff265549b24793e791a4 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Wed, 2 Oct 2019 10:56:00 +0300
Subject: [PATCH] Fix normal ray direction

---
 components/renderers/cpp/src/normals.cu | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/components/renderers/cpp/src/normals.cu b/components/renderers/cpp/src/normals.cu
index 1a5532219..2b41c6952 100644
--- a/components/renderers/cpp/src/normals.cu
+++ b/components/renderers/cpp/src/normals.cu
@@ -54,9 +54,11 @@ __global__ void vis_normals_kernel(ftl::cuda::TextureObject<float4> norm,
 
     if(x >= norm.width() || y >= norm.height()) return;
 
-    float3 ray = pose * camera.screenToCam(x,y,1.0f);
+    output(x,y) = 0.0f;
+    float3 ray = make_float3(0.0f, 0.0f, 1.0f); //pose * camera.screenToCam(x,y,1.0f);
     ray = ray / length(ray);
     float3 n = make_float3(norm.tex2D((int)x,(int)y));
+    if (n.x == MINF) return;
     n /= length(n);
 
     output(x,y) = fabs(dot(ray, n))*7.0f;
-- 
GitLab