From df52b44ebd55c46bd48a3fe7a8c19cf2c9312180 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Sat, 16 Nov 2019 11:02:57 +0200 Subject: [PATCH] Fix point reprojection --- components/renderers/cpp/src/reprojection.cu | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/renderers/cpp/src/reprojection.cu b/components/renderers/cpp/src/reprojection.cu index 8a075b653..dc636f359 100644 --- a/components/renderers/cpp/src/reprojection.cu +++ b/components/renderers/cpp/src/reprojection.cu @@ -203,13 +203,13 @@ __global__ void reprojection_kernel( const float3 camPos = poseInv * worldPos; if (camPos.z < camera.minDepth) return; if (camPos.z > camera.maxDepth) return; - const uint2 screenPos = camera.camToScreen<uint2>(camPos); + const float2 screenPos = camera.camToScreen<float2>(camPos); // Not on screen so stop now... if (screenPos.x >= depth_src.width() || screenPos.y >= depth_src.height()) return; - const float d2 = depth_src.tex2D((int)screenPos.x, (int)screenPos.y); - const A input = in.tex2D((int)screenPos.x, (int)screenPos.y); //generateInput(in.tex2D((int)screenPos.x, (int)screenPos.y), params, worldPos); + const float d2 = depth_src.tex2D((int)(screenPos.x+0.5f), (int)(screenPos.y+0.5f)); + const auto input = in.tex2D(screenPos.x, screenPos.y); //generateInput(in.tex2D((int)screenPos.x, (int)screenPos.y), params, worldPos); float weight = ftl::cuda::weighting(fabs(camPos.z - d2), 0.02f); const B weighted = make<B>(input) * weight; -- GitLab