Hi.
I am working on a script that parses a ‘Camera’ file into Blender. The file I am parsing uses a 4 x 4 matrix to transform the world into camera space as per the camera transform in a RIB file.
eg.
filmback 24.892 18.669
frame 1
#focal length 35
fov 29.97002051
transform
0.7071067812 -0.3312945782 0.6246950476 0
-2.775557562e-17 0.8834522086 0.4685212857 0
-0.7071067812 -0.3312945782 0.6246950476 0
3560.565558 -2127.414591 3464.230949 1
frame 2
#focal length 35
fov 29.97002051
transform
0.7071067812 -0.3312945782 0.6246950476 0
-2.775557562e-17 0.8834522086 0.4685212857 0
-0.7071067812 -0.3312945782 0.6246950476 0
3560.565558 -2127.414591 3464.230949 1
=====================================
THE PROBLEM
The problem is that this camera is based on a Maya camera and world which is of course Y-Up as opposed to Blenders Z-Up.
I have managed to create a camera in Blender and bake the animation, I just need to find a way to rotate the camera so it respects Blender’s world orientation.
Help please!
R.
ps. I understand that this is something that has probably been addressed before, but I am having a hard time to find the correct solution. I found this snippet where someone had a similar problem and multiplied their matrix to re-align everything. I tried similar things, but my camera went haywire. I feel I am so close, yet so far.
===================================================
All you have to do is multiply your vector or matrix from the Z-up system with the transformation matrix which converts Z-up into Y-up:
yUp = someZupVectorOrMatrix * matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,0]
This flips the axes by taking the +Z as +Y and the +Y as -Z and will convert rotation and scale parts correctly, too.
To convert from Y-up back to Z-up, just use the inverse() of the conversion matrix above which is
zUp = someYupVectorOrMatrix * matrix3 [1,0,0] [0,0,-1] [0,1,0] [0,0,0]
==================================================
Script examples will be appreciated 