-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
I'm trying to wrap my head around the coordinate system, and it looks unlike anything I've seen before. I setup a simple test transforms.json
:
{
"camera_angle_x": 2.1273956954128375,
"scale": 1.0,
"offset": [
0.0,
0.0,
0.0
],
"frames": [
{
"file_path": "png/view_f0000f",
"transform_matrix": [
[
1.0,
0.0,
0.0,
0.8
],
[
0.0,
1.0,
0.0,
1.0
],
[
0.0,
0.0,
1.0,
1.2
],
[
0.0,
0.0,
0.0,
1.0
]
]
}
]
}
Notice how the camera I set up is having identity rotational part, and translation vector [0.8, 1.0, 1.2]
. The result looks like this:
Confusing things:
- The camera and the unit cube have different orientations for X, Y, and Z (i.e.: red, green, blue axis). (see first image)
- The position of the camera relative to the unit cube seems wrong. The the camera seems to be at x=1, and z=0.8, whereas I specified x to be 0.8, and z to be 1.2. (see second image).
- The camera is at y=1.2, whereas it should be 1.0. (see third image).
So, position in the testbed is (1, 1.2, 0.8), but it should be (0.8, 1.0, 1.2). This shuffles around ALL axis. After long searching, I found this snippet:
instant-ngp/include/neural-graphics-primitives/nerf_loader.h
Lines 50 to 70 in 409613a
auto nerf_matrix_to_ngp(const Eigen::Matrix<float, 3, 4>& nerf_matrix) { | |
Eigen::Matrix<float, 3, 4> result; | |
int X=0,Y=1,Z=2; | |
result.col(0) = Eigen::Vector3f{ nerf_matrix(X,0), nerf_matrix(Y,0), nerf_matrix(Z,0)}; | |
result.col(1) = Eigen::Vector3f{-nerf_matrix(X,1), -nerf_matrix(Y,1), -nerf_matrix(Z,1)}; | |
result.col(2) = Eigen::Vector3f{-nerf_matrix(X,2), -nerf_matrix(Y,2), -nerf_matrix(Z,2)}; | |
result.col(3) = Eigen::Vector3f{ nerf_matrix(X,3), nerf_matrix(Y,3), nerf_matrix(Z,3)} * scale + offset; | |
if (from_mitsuba) { | |
result.col(0) *= -1; | |
result.col(2) *= -1; | |
} else { | |
// Cycle axes xyz->yzx | |
Eigen::Vector4f tmp = result.row(0); | |
result.row(0) = (Eigen::Vector4f)result.row(1); | |
result.row(1) = (Eigen::Vector4f)result.row(2); | |
result.row(2) = tmp; | |
} | |
return result; | |
} |
So, my question kinda reduces to: how to think about this coordinate system, as I still haven't figured out how to convert my dataset transformations to yours.
Metadata
Metadata
Assignees
Labels
No labels