I have exported a 3D scene in Blender as .gltf
and I am reading the data in my program.
For the camera I have the following values in the .gltf
File:
{
"camera" : 0,
"name" : "Camera",
"rotation" : [
0.331510511487034,
-0.018635762442412376,
0.0052512469701468945,
0.9450923238951721
],
"translation" : [
0.25607955169677734,
1.6810789010681152,
0.129119189865864
]
},
I think the values here for "rotation" and "translation" are the extrinsic camera parameters. The translation vector (x,y,z)
makes sense to me, but I don't understand why there are only 4 floats for the camera rotation. In this case, there should be more values for the matrix, or am I missing something here? Thanks in advance!
When
rotation
is specified by itself, it's a quaternion, not a matrix. That's why you're seeing only 4 values there. For reference, see: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#transformationsThe glTF camera object looks along -Z in local (node transformed) space, with +Y up. See: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#cameras