diff --git a/components/renderers/cpp/include/ftl/cuda/normals.hpp b/components/renderers/cpp/include/ftl/cuda/normals.hpp index 5481b4662a937bb6915b53b2150c3782b937af2e..0660dab19ca89e5769879210b4d34bfa403165aa 100644 --- a/components/renderers/cpp/include/ftl/cuda/normals.hpp +++ b/components/renderers/cpp/include/ftl/cuda/normals.hpp @@ -14,7 +14,7 @@ void normals(ftl::cuda::TextureObject<float4> &output, void normal_visualise(ftl::cuda::TextureObject<float4> &norm, ftl::cuda::TextureObject<float> &output, - const ftl::rgbd::Camera &camera, const float4x4 &pose, + const float3 &light, cudaStream_t stream); void normal_filter(ftl::cuda::TextureObject<float4> &norm, diff --git a/components/renderers/cpp/src/normals.cu b/components/renderers/cpp/src/normals.cu index eec540ccd1ef022b91d6fb003b3cfa1d62a0a0a6..05fe32b91d660c70a9f4b6097f2a18891b8878b4 100644 --- a/components/renderers/cpp/src/normals.cu +++ b/components/renderers/cpp/src/normals.cu @@ -90,14 +90,14 @@ void ftl::cuda::normals(ftl::cuda::TextureObject<float4> &output, __global__ void vis_normals_kernel(ftl::cuda::TextureObject<float4> norm, ftl::cuda::TextureObject<float> output, - ftl::rgbd::Camera camera, float4x4 pose) { + float3 light) { const unsigned int x = blockIdx.x*blockDim.x + threadIdx.x; const unsigned int y = blockIdx.y*blockDim.y + threadIdx.y; if(x >= norm.width() || y >= norm.height()) return; output(x,y) = 0.0f; - float3 ray = pose.getFloat3x3() * camera.screenToCam(x,y,1.0f); + float3 ray = light; //pose.getFloat3x3() * camera.screenToCam(x,y,1.0f); ray = ray / length(ray); float3 n = make_float3(norm.tex2D((int)x,(int)y)); float l = length(n); @@ -114,13 +114,13 @@ __global__ void vis_normals_kernel(ftl::cuda::TextureObject<float4> norm, void ftl::cuda::normal_visualise(ftl::cuda::TextureObject<float4> &norm, ftl::cuda::TextureObject<float> &output, - const ftl::rgbd::Camera &camera, const float4x4 &pose, + const float3 &light, cudaStream_t stream) { const dim3 gridSize((norm.width() + T_PER_BLOCK - 1)/T_PER_BLOCK, (norm.height() + T_PER_BLOCK - 1)/T_PER_BLOCK); const dim3 blockSize(T_PER_BLOCK, T_PER_BLOCK); - vis_normals_kernel<<<gridSize, blockSize, 0, stream>>>(norm, output, camera, pose); + vis_normals_kernel<<<gridSize, blockSize, 0, stream>>>(norm, output, light); cudaSafeCall( cudaGetLastError() ); #ifdef _DEBUG diff --git a/components/renderers/cpp/src/splat_render.cpp b/components/renderers/cpp/src/splat_render.cpp index 26f8e893ee3846a06adadfa6d0fd42393d1e4c83..25b2d86329e395e93129d1a488c32eb32535a5d2 100644 --- a/components/renderers/cpp/src/splat_render.cpp +++ b/components/renderers/cpp/src/splat_render.cpp @@ -323,7 +323,7 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda // Convert normal to single float value temp_.create<GpuMat>(Channel::Contribution, Format<float>(camera.width, camera.height)); - ftl::cuda::normal_visualise(out.getTexture<float4>(Channel::Normals), temp_.createTexture<float>(Channel::Contribution), camera, params.m_viewMatrixInverse, stream); + ftl::cuda::normal_visualise(out.getTexture<float4>(Channel::Normals), temp_.createTexture<float>(Channel::Contribution), make_float3(0.0f, 0.0f, 1.0f), stream); // Put in output as single float cv::cuda::swap(temp_.get<GpuMat>(Channel::Contribution), out.create<GpuMat>(Channel::Normals));