diff --git a/components/renderers/cpp/src/CUDARender.cpp b/components/renderers/cpp/src/CUDARender.cpp index 2f753365358ca49a8913ee874087b5374270724c..c72d3dacea9684adb9abd26f458665b6c0079dbe 100644 --- a/components/renderers/cpp/src/CUDARender.cpp +++ b/components/renderers/cpp/src/CUDARender.cpp @@ -184,7 +184,7 @@ void CUDARender::_dibr(ftl::rgbd::Frame &out, const Eigen::Matrix4d &t, cudaStre auto &f = scene_->frames[i].cast<ftl::rgbd::Frame>(); //auto *s = scene_->sources[i]; - if (f.has(Channel::Colour)) { + if (!f.has(Channel::Colour)) { LOG(ERROR) << "Missing required channel"; continue; } @@ -462,7 +462,7 @@ void CUDARender::_postprocessColours(ftl::rgbd::Frame &out) { params_.camera, stream_ ); - } else if (out.hasChannel(_getDepthChannel()) && out.hasChannel(out_chan_)) { + } else if (mesh_ && out.hasChannel(_getDepthChannel()) && out.hasChannel(out_chan_)) { ftl::cuda::fix_bad_colour( out.getTexture<float>(_getDepthChannel()), out.getTexture<uchar4>(out_chan_), diff --git a/components/renderers/cpp/src/reprojection.cu b/components/renderers/cpp/src/reprojection.cu index 023208cb2269ddcf8be3fcdbf07d67b6844717c8..e58ba6fa77984ba6ed2926cc3e15c8bd053ce27a 100644 --- a/components/renderers/cpp/src/reprojection.cu +++ b/components/renderers/cpp/src/reprojection.cu @@ -239,7 +239,7 @@ __global__ void reprojection_kernel( const float d = depth_in.tex2D((int)x, (int)y); if (d > params.camera.minDepth && d < params.camera.maxDepth) { //const float2 rpt = convertScreen<VPMODE>(params, x, y); - const float3 camPos = transform * params.camera.project<PROJECT>(make_float3(x, y, d)); + const float3 camPos = transform * params.camera.unproject<PROJECT>(make_float3(x, y, d)); if (camPos.z > camera.minDepth && camPos.z < camera.maxDepth) { const float3 screenPos = camera.project<Projection::PERSPECTIVE>(camPos); @@ -250,7 +250,8 @@ __global__ void reprojection_kernel( // Boolean match (0 or 1 weight). 1.0 if depths are sufficiently close float weight = depthMatching(params, camPos.z, d2); - weight *= float(weights.tex2D(int(screenPos.x+0.5f), int(screenPos.y+0.5f))) / 32767.0f; + if (params.m_flags & ftl::render::kUseWeightsChannel) + weight *= float(weights.tex2D(int(screenPos.x+0.5f), int(screenPos.y+0.5f))) / 32767.0f; const B output = make<B>(input); // * weight; //weightInput(input, weight);