Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Pope
ftl
Commits
d8fa1364
Commit
d8fa1364
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Tidy and document
parent
dfa6a145
No related branches found
No related tags found
1 merge request
!121
Implements #184 weight colours by normal
Pipeline
#14908
passed
5 years ago
Stage: all
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/renderers/cpp/src/points.cu
+3
-1
3 additions, 1 deletion
components/renderers/cpp/src/points.cu
components/renderers/cpp/src/splatter.cu
+27
-35
27 additions, 35 deletions
components/renderers/cpp/src/splatter.cu
with
30 additions
and
36 deletions
components/renderers/cpp/src/points.cu
+
3
−
1
View file @
d8fa1364
...
...
@@ -12,7 +12,9 @@ __global__ void point_cloud_kernel(ftl::cuda::TextureObject<float4> output, ftl:
output
(
x
,
y
)
=
make_float4
(
MINF
,
MINF
,
MINF
,
MINF
);
const
float
d
=
depth
.
tex2D
((
int
)
x
,
(
int
)
y
);
float
p
=
d
;
// Calculate depth between 0.0 and 1.0
float
p
=
(
d
-
params
.
minDepth
)
/
(
params
.
maxDepth
-
params
.
minDepth
);
if
(
d
>=
params
.
minDepth
&&
d
<=
params
.
maxDepth
)
{
/* Orts-Escolano S. et al. 2016. Holoportation: Virtual 3D teleportation in real-time. */
...
...
This diff is collapsed.
Click to expand it.
components/renderers/cpp/src/splatter.cu
+
27
−
35
View file @
d8fa1364
...
...
@@ -184,42 +184,34 @@ __device__ inline float make(const float4 &v) {
const
float3
camPos
=
params
.
camera
.
screenToCam
((
int
)(
x
+
u
),(
int
)(
y
+
v
),
d
);
const
float3
camPos2
=
params
.
camera
.
screenToCam
((
int
)(
x
),(
int
)(
y
),
d
);
//if (length(camPos - camPos2) > 2.0f*(camPos.z/params.camera.fx)) continue;
const
float3
worldPos
=
params
.
m_viewMatrixInverse
*
camPos
;
//const float3 camPos2 = pose_inv * worldPos;
//const uint2 screenPos = camera.camToScreen<uint2>(camPos2);
//if (screenPos.x < points.width() && screenPos.y < points.height()) {
// Can now read points, normals and colours from source cam
// What is contribution of our current point at this pixel?
//const float3 p = make_float3(points.tex2D((int)screenPos.x, (int)screenPos.y));
//const float weight = ftl::cuda::spatialWeighting(worldPos, p, (camPos.z/params.camera.fx)); //*(camPos2.z/camera.fx));
//if (weight <= 0.0f) continue;
float4
n
=
normals
.
tex2D
((
int
)(
x
+
u
),
(
int
)(
y
+
v
));
//const float l = length(n);
//if (l == 0.0f) continue;
//n /= l;
// Does the ray intersect plane of splat?
float
t
=
1000.0
f
;
if
(
ftl
::
cuda
::
intersectPlane
(
make_float3
(
n
),
worldPos
,
origin
,
ray
,
t
))
{
//} && fabs(t-camPos.z) < 0.01f) {
//t *= (params.m_viewMatrix.getFloat3x3() * ray).z;
t
*=
scale
;
const
float3
camPos3
=
params
.
camera
.
screenToCam
((
int
)(
x
),(
int
)(
y
),
t
);
float
weight
=
ftl
::
cuda
::
spatialWeighting
(
camPos
,
camPos3
,
2.0
f
*
(
camPos3
.
z
/
params
.
camera
.
fx
));
if
(
params
.
m_flags
&
ftl
::
render
::
kNormalWeightColours
)
weight
*=
n
.
w
*
n
.
w
;
if
(
weight
<=
0.0
f
)
continue
;
//depth += t * weight;
//contrib += weight;
depth
=
min
(
depth
,
t
);
results
[
i
/
WARP_SIZE
]
=
{
weight
,
t
,
in
.
tex2D
((
int
)
x
+
u
,
(
int
)
y
+
v
)};
//make_float2(t, weight);
//atomicMin(&depth_out(x,y), (int)(depth * 1000.0f));
}
//}
// Assumed to be normalised
float4
n
=
normals
.
tex2D
((
int
)(
x
+
u
),
(
int
)(
y
+
v
));
// Does the ray intersect plane of splat?
float
t
=
1000.0
f
;
if
(
ftl
::
cuda
::
intersectPlane
(
make_float3
(
n
),
worldPos
,
origin
,
ray
,
t
))
{
//} && fabs(t-camPos.z) < 0.01f) {
// Adjust from normalised ray back to original meters units
t
*=
scale
;
const
float3
camPos3
=
params
.
camera
.
screenToCam
((
int
)(
x
),(
int
)(
y
),
t
);
float
weight
=
ftl
::
cuda
::
spatialWeighting
(
camPos
,
camPos3
,
2.0
f
*
(
camPos3
.
z
/
params
.
camera
.
fx
));
/* Buehler C. et al. 2001. Unstructured Lumigraph Rendering. */
/* Orts-Escolano S. et al. 2016. Holoportation: Virtual 3D teleportation in real-time. */
// This is the simple naive colour weighting. It might be good
// enough for our purposes if the alignment step prevents ghosting
// TODO: Use depth and perhaps the neighbourhood consistency in:
// Kuster C. et al. 2011. FreeCam: A hybrid camera system for interactive free-viewpoint video
if
(
params
.
m_flags
&
ftl
::
render
::
kNormalWeightColours
)
weight
*=
n
.
w
*
n
.
w
;
//if (params.m_flags & ftl::render::kDepthWeightColours) weight *= ???
if
(
weight
<=
0.0
f
)
continue
;
depth
=
min
(
depth
,
t
);
results
[
i
/
WARP_SIZE
]
=
{
weight
,
t
,
in
.
tex2D
((
int
)
x
+
u
,
(
int
)
y
+
v
)};
}
}
depth
=
warpMin
(
depth
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment