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

More parameters

parent 872886f1
No related branches found
No related tags found
1 merge request!121Implements #184 weight colours by normal
This commit is part of merge request !121. Comments created here will be created in the context of that merge request.
......@@ -9,9 +9,7 @@ namespace ftl {
namespace render {
static const uint kShowDisconMask = 0x00000001;
static const uint kNoSplatting = 0x00000002;
static const uint kNoUpsampling = 0x00000004;
static const uint kNoTexturing = 0x00000008;
static const uint kNormalWeightColours = 0x00000002;
struct __align__(16) SplatParams {
float4x4 m_viewMatrix;
......
......@@ -288,10 +288,8 @@ 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("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;
if (value("show_discontinuity_mask", false)) params.m_flags |= ftl::render::kShowDisconMask;
if (value("normal_weight_colours", true)) params.m_flags |= ftl::render::kNormalWeightColours;
params.m_viewMatrix = MatrixConversion::toCUDA(src->getPose().cast<float>().inverse());
params.m_viewMatrixInverse = MatrixConversion::toCUDA(src->getPose().cast<float>());
params.camera = camera;
......
......@@ -208,7 +208,10 @@ __device__ inline float make(const float4 &v) {
//t *= (params.m_viewMatrix.getFloat3x3() * ray).z;
t *= scale;
const float3 camPos3 = params.camera.screenToCam((int)(x),(int)(y),t);
const float weight = ftl::cuda::spatialWeighting(camPos, camPos3, 2.0f*(camPos3.z/params.camera.fx)) * n.w * n.w;
float weight = ftl::cuda::spatialWeighting(camPos, camPos3, 2.0f*(camPos3.z/params.camera.fx));
if (params.m_flags & ftl::render::kNormalWeightColours) weight *= n.w * n.w;
if (weight <= 0.0f) continue;
//depth += t * weight;
//contrib += weight;
......
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