Skip to content
Snippets Groups Projects
Commit 0a3561d3 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Display discon mask in render

parent 2d452394
No related branches found
No related tags found
1 merge request!116Implements #133 point alignment
Pipeline #14777 passed
......@@ -8,7 +8,7 @@
namespace ftl {
namespace render {
static const uint kShowBlockBorders = 0x00000001; // Deprecated: from voxels system
static const uint kShowDisconMask = 0x00000001;
static const uint kNoSplatting = 0x00000002;
static const uint kNoUpsampling = 0x00000004;
static const uint kNoTexturing = 0x00000008;
......
......@@ -224,9 +224,10 @@ bool Splatter::render(ftl::rgbd::VirtualSource *src, ftl::rgbd::Frame &out, cuda
// Parameters object to pass to CUDA describing the camera
SplatParams params;
params.m_flags = 0;
if (src->value("splatting", true) == false) params.m_flags |= ftl::render::kNoSplatting;
if (src->value("upsampling", true) == false) params.m_flags |= ftl::render::kNoUpsampling;
if (src->value("texturing", true) == false) params.m_flags |= ftl::render::kNoTexturing;
if (src->value("show_discontinuity_mask", false)) params.m_flags |= ftl::render::kShowDisconMask;
//if (src->value("splatting", true) == false) params.m_flags |= ftl::render::kNoSplatting;
//if (src->value("upsampling", true) == false) params.m_flags |= ftl::render::kNoUpsampling;
//if (src->value("texturing", true) == false) params.m_flags |= ftl::render::kNoTexturing;
params.m_viewMatrix = MatrixConversion::toCUDA(src->getPose().cast<float>().inverse());
params.m_viewMatrixInverse = MatrixConversion::toCUDA(src->getPose().cast<float>());
params.camera = camera;
......
......@@ -25,7 +25,7 @@ using ftl::render::SplatParams;
const int y = blockIdx.y*blockDim.y + threadIdx.y;
const float4 worldPos = points.tex2D(x, y);
if (worldPos.x == MINF || worldPos.w < 0.0f) return;
if (worldPos.x == MINF || (!(params.m_flags & ftl::render::kShowDisconMask) && worldPos.w < 0.0f)) return;
// Find the virtual screen position of current point
const float3 camPos = params.m_viewMatrix * make_float3(worldPos);
......@@ -84,12 +84,12 @@ __global__ void dibr_attribute_contrib_kernel(
const int x = (blockIdx.x*blockDim.x + threadIdx.x) / WARP_SIZE;
const int y = blockIdx.y*blockDim.y + threadIdx.y;
const float3 worldPos = make_float3(points.tex2D(x, y));
const float4 worldPos = points.tex2D(x, y);
//const float3 normal = make_float3(tex2D<float4>(camera.normal, x, y));
if (worldPos.x == MINF) return;
//const float r = (camera.poseInverse * worldPos).z / camera.params.fx;
const float3 camPos = params.m_viewMatrix * worldPos;
const float3 camPos = params.m_viewMatrix * make_float3(worldPos);
if (camPos.z < params.camera.minDepth) return;
if (camPos.z > params.camera.maxDepth) return;
const uint2 screenPos = params.camera.camToScreen<uint2>(camPos);
......@@ -103,8 +103,9 @@ __global__ void dibr_attribute_contrib_kernel(
const float d = ((float)depth_in.tex2D((int)screenPos.x, (int)screenPos.y)/1000.0f);
//if (abs(d - camPos.z) > DEPTH_THRESHOLD) return;
// TODO:(Nick) Should just one thread load these to shared mem?
const float4 colour = make_float4(colour_in.tex2D(x, y));
const float4 colour = (params.m_flags & ftl::render::kShowDisconMask && worldPos.w < 0.0f) ?
make_float4(0.0f,0.0f,255.0f,255.0f) :
make_float4(colour_in.tex2D(x, y));
//const float4 normal = tex2D<float4>(camera.normal, x, y);
// Each thread in warp takes an upsample point and updates corresponding depth buffer.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment