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

Alternative colour blend algorithms

parent 37e3c404
No related branches found
No related tags found
No related merge requests found
Pipeline #11780 passed
......@@ -232,10 +232,10 @@ struct HashData {
//out.color = 0.5f * (v0.color + v1.color); //exponential running average
float3 c0 = make_float3(v0.color.x, v0.color.y, v0.color.z);
float3 c1 = make_float3(v1.color.x, v1.color.y, v1.color.z);
//float3 c0 = make_float3(v0.color.x, v0.color.y, v0.color.z);
//float3 c1 = make_float3(v1.color.x, v1.color.y, v1.color.z);
float3 res = (c0.x+c0.y+c0.z == 0) ? c1 : 0.5f*c0 + 0.5f*c1;
//float3 res = (c0.x+c0.y+c0.z == 0) ? c1 : 0.5f*c0 + 0.5f*c1;
//float3 res = (c0+c1)/2;
//float3 res = (c0 * (float)v0.weight + c1 * (float)v1.weight) / ((float)v0.weight + (float)v1.weight);
//float3 res = c1;
......@@ -243,7 +243,22 @@ struct HashData {
//out.color.x = (uchar)(res.x+0.5f); out.color.y = (uchar)(res.y+0.5f); out.color.z = (uchar)(res.z+0.5f);
// Nick: reduces colour flicker but not ideal..
out.color = v1.color;
//out.color = v1.color;
// Option 3 (Nick): Use colour with minimum SDF since it should be closest to surface.
// Results in stable but pixelated output
//out.color = (v0.weight > 0 && (fabs(v0.sdf) < fabs(v1.sdf))) ? v0.color : v1.color;
// Option 4 (Nick): Merge colours based upon relative closeness
float3 c0 = make_float3(v0.color.x, v0.color.y, v0.color.z);
float3 c1 = make_float3(v1.color.x, v1.color.y, v1.color.z);
float factor = fabs(v0.sdf - v1.sdf) / 0.05f / 2.0f;
if (factor > 0.5f) factor = 0.5f;
float factor0 = (fabs(v0.sdf) < fabs(v1.sdf)) ? 1.0f - factor : factor;
float factor1 = 1.0f - factor0;
out.color.x = (v0.weight > 0) ? (uchar)(c0.x * factor0 + c1.x * factor1) : c1.x;
out.color.y = (v0.weight > 0) ? (uchar)(c0.y * factor0 + c1.y * factor1) : c1.y;
out.color.z = (v0.weight > 0) ? (uchar)(c0.z * factor0 + c1.z * factor1) : c1.z;
out.sdf = (v0.sdf * (float)v0.weight + v1.sdf * (float)v1.weight) / ((float)v0.weight + (float)v1.weight);
out.weight = min(c_hashParams.m_integrationWeightMax, (unsigned int)v0.weight + (unsigned int)v1.weight);
......
......@@ -565,10 +565,10 @@ __global__ void integrateDepthMapKernel(HashData hashData, DepthCameraData camer
uint idx = entry.ptr + i;
if (entry.flags != cameraParams.flags & 0xFF) {
entry.flags = cameraParams.flags & 0xFF;
hashData.d_SDFBlocks[idx].color = make_uchar3(0,0,0);
}
//if (entry.flags != cameraParams.flags & 0xFF) {
// entry.flags = cameraParams.flags & 0xFF;
//hashData.d_SDFBlocks[idx].color = make_uchar3(0,0,0);
//}
Voxel newVoxel;
//if (color.x == MINF) hashData.combineVoxelDepthOnly(hashData.d_SDFBlocks[idx], curr, newVoxel);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment