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

Don't create normals for bad points

parent 2bd07468
No related branches found
No related tags found
1 merge request!116Implements #133 point alignment
Pipeline #14761 passed
......@@ -20,14 +20,14 @@ __global__ void computeNormals_kernel(ftl::cuda::TextureObject<float4> output,
const float3 MC = make_float3(input.tex2D((int)x+0, (int)y-1)); //[(y-1)*width+(x+0)];
const float3 CM = make_float3(input.tex2D((int)x-1, (int)y+0)); //[(y+0)*width+(x-1)];
//if(CC.x != MINF && PC.x != MINF && CP.x != MINF && MC.x != MINF && CM.x != MINF) {
if(CC.x != MINF) { // && PC.x != MINF && CP.x != MINF && MC.x != MINF && CM.x != MINF) {
const float3 n = cross(PC-MC, CP-CM);
const float l = length(n);
if(l > 0.0f) {
output(x,y) = make_float4(n/-l, 1.0f);
}
//}
}
}
}
......@@ -51,6 +51,7 @@ __global__ void smooth_normals_kernel(ftl::cuda::TextureObject<float4> norms,
const float3 p = make_float3(points.tex2D((int)x+u,(int)y+v));
if (p.x == MINF) continue;
const float s = ftl::cuda::spatialWeighting(p0, p, smoothing);
//const float s = 1.0f;
if (s > 0.0f) {
const float4 n = norms.tex2D((int)x+u,(int)y+v);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment