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
12282b68
Commit
12282b68
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
WIP More attempts at eye poses
parent
e8fe5259
No related branches found
No related tags found
1 merge request
!110
Feature/121/vr
Pipeline
#12514
passed
5 years ago
Stage: all
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
applications/gui/src/camera.cpp
+11
-1
11 additions, 1 deletion
applications/gui/src/camera.cpp
applications/gui/src/screen.cpp
+2
-1
2 additions, 1 deletion
applications/gui/src/screen.cpp
applications/reconstruct/src/splat_render.cpp
+24
-9
24 additions, 9 deletions
applications/reconstruct/src/splat_render.cpp
with
37 additions
and
11 deletions
applications/gui/src/camera.cpp
+
11
−
1
View file @
12282b68
...
...
@@ -271,7 +271,17 @@ const GLTexture &ftl::gui::Camera::captureFrame() {
{
auto
pose
=
ConvertSteamVRMatrixToMatrix4
(
rTrackedDevicePose_
[
vr
::
k_unTrackedDeviceIndex_Hmd
].
mDeviceToAbsoluteTracking
);
pose
.
inverse
();
if
(
src_
->
hasCapabilities
(
ftl
::
rgbd
::
kCapMovable
))
src_
->
setPose
(
pose
);
// Lerp the Eye
eye_
[
0
]
+=
(
neye_
[
0
]
-
eye_
[
0
])
*
lerpSpeed_
*
delta_
;
eye_
[
1
]
+=
(
neye_
[
1
]
-
eye_
[
1
])
*
lerpSpeed_
*
delta_
;
eye_
[
2
]
+=
(
neye_
[
2
]
-
eye_
[
2
])
*
lerpSpeed_
*
delta_
;
Eigen
::
Translation3d
trans
(
eye_
);
Eigen
::
Affine3d
t
(
trans
);
Eigen
::
Matrix4d
viewPose
=
t
.
matrix
()
*
pose
;
if
(
src_
->
hasCapabilities
(
ftl
::
rgbd
::
kCapMovable
))
src_
->
setPose
(
viewPose
);
}
else
{
LOG
(
ERROR
)
<<
"No VR Pose"
;
}
...
...
This diff is collapsed.
Click to expand it.
applications/gui/src/screen.cpp
+
2
−
1
View file @
12282b68
...
...
@@ -37,7 +37,7 @@ namespace {
uv = vertex;
vec2 scaledVertex = (vertex * scaleFactor) + position;
gl_Position = vec4(2.0*scaledVertex.x - 1.0,
1.0 -
2.0*scaledVertex.y,
2.0*scaledVertex.y
- 1.0
,
0.0, 1.0);
})"
;
...
...
@@ -365,6 +365,7 @@ void ftl::gui::Screen::draw(NVGcontext *ctx) {
if
(
hasVR
()
&&
imageSize
[
0
]
>
0
&&
camera_
->
getLeft
().
isValid
()
&&
camera_
->
getRight
().
isValid
())
{
vr
::
Texture_t
leftEyeTexture
=
{(
void
*
)(
uintptr_t
)
leftEye_
,
vr
::
TextureType_OpenGL
,
vr
::
ColorSpace_Gamma
};
vr
::
VRCompositor
()
->
Submit
(
vr
::
Eye_Left
,
&
leftEyeTexture
);
glBindTexture
(
GL_TEXTURE_2D
,
rightEye_
);
vr
::
Texture_t
rightEyeTexture
=
{(
void
*
)(
uintptr_t
)
rightEye_
,
vr
::
TextureType_OpenGL
,
vr
::
ColorSpace_Gamma
};
vr
::
VRCompositor
()
->
Submit
(
vr
::
Eye_Right
,
&
rightEyeTexture
);
}
...
...
This diff is collapsed.
Click to expand it.
applications/reconstruct/src/splat_render.cpp
+
24
−
9
View file @
12282b68
...
...
@@ -13,6 +13,21 @@ Splatter::~Splatter() {
}
static
Eigen
::
Matrix4f
adjustPose
(
const
Eigen
::
Matrix4f
&
pose
,
float
baseline
)
{
Eigen
::
Affine3f
transform
(
Eigen
::
Translation3f
(
baseline
,
0.0
f
,
0.0
f
));
Eigen
::
Matrix4f
matrix
=
pose
;
Eigen
::
Matrix4f
rmat
=
pose
;
rmat
(
0
,
3
)
=
0.0
f
;
rmat
(
1
,
3
)
=
0.0
f
;
rmat
(
2
,
3
)
=
0.0
f
;
Eigen
::
Matrix4f
tmat
=
transform
.
matrix
();
tmat
(
0
,
0
)
=
0.0
f
;
tmat
(
1
,
1
)
=
0.0
f
;
tmat
(
2
,
2
)
=
0.0
f
;
tmat
(
3
,
3
)
=
0.0
f
;
return
(
tmat
*
pose
)
+
pose
;
}
void
Splatter
::
render
(
ftl
::
rgbd
::
Source
*
src
,
cudaStream_t
stream
)
{
if
(
!
src
->
isReady
())
return
;
...
...
@@ -37,8 +52,14 @@ void Splatter::render(ftl::rgbd::Source *src, cudaStream_t stream) {
// Parameters object to pass to CUDA describing the camera
SplatParams
params
;
params
.
m_flags
=
0
;
params
.
m_viewMatrix
=
MatrixConversion
::
toCUDA
(
src
->
getPose
().
cast
<
float
>
().
inverse
());
params
.
m_viewMatrixInverse
=
MatrixConversion
::
toCUDA
(
src
->
getPose
().
cast
<
float
>
());
// Adjust pose to left eye position
Eigen
::
Matrix4f
matrix
=
adjustPose
(
src
->
getPose
().
cast
<
float
>
(),
-
camera
.
baseline
/
2.0
f
);
params
.
m_viewMatrix
=
MatrixConversion
::
toCUDA
(
matrix
.
inverse
());
params
.
m_viewMatrixInverse
=
MatrixConversion
::
toCUDA
(
matrix
);
//params.m_viewMatrix = MatrixConversion::toCUDA(src->getPose().cast<float>().inverse());
//params.m_viewMatrixInverse = MatrixConversion::toCUDA(src->getPose().cast<float>());
params
.
voxelSize
=
scene_
->
getHashParams
().
m_virtualVoxelSize
;
params
.
camera
.
flags
=
0
;
params
.
camera
.
fx
=
camera
.
fx
;
...
...
@@ -82,13 +103,7 @@ void Splatter::render(ftl::rgbd::Source *src, cudaStream_t stream) {
src
->
writeFrames
(
colour1_
,
depth2_
,
stream
);
}
else
if
(
src
->
getChannel
()
==
ftl
::
rgbd
::
kChanRight
)
{
// Adjust pose to right eye position
Eigen
::
Affine3f
transform
(
Eigen
::
Translation3f
(
camera
.
baseline
,
0.0
f
,
0.0
f
));
Eigen
::
Matrix4f
tmat
=
transform
.
matrix
();
Eigen
::
Matrix4f
rmat
=
src
->
getPose
().
cast
<
float
>
();
rmat
(
3
,
0
)
=
0.0
f
;
rmat
(
3
,
1
)
=
0.0
f
;
rmat
(
3
,
2
)
=
0.0
f
;
Eigen
::
Matrix4f
matrix
=
(
rmat
*
transform
.
matrix
())
+
src
->
getPose
().
cast
<
float
>
();
Eigen
::
Matrix4f
matrix
=
adjustPose
(
src
->
getPose
().
cast
<
float
>
(),
camera
.
baseline
/
2.0
f
);
params
.
m_viewMatrix
=
MatrixConversion
::
toCUDA
(
matrix
.
inverse
());
params
.
m_viewMatrixInverse
=
MatrixConversion
::
toCUDA
(
matrix
);
...
...
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