Dear Experts,
I have a problem that drives me crazy. I wrote a plugin once for blender 2.5 where I render a scene from different viewpoints and store depth as well as some parameters, see below:
| Code: |
RT = camobj.matrix_world.inverted()
# Intrinsic
C = Matrix().to_3x3()
C[0][0] = -w/2 / tan(cam.data.angle/2)
ratio = w/h
C[1][1] = -h/2. / tan(cam.data.angle/2) * ratio
C[0][2] = w / 2. #w = width of rendered image
C[1][2] = h / 2. #h = height of rendered image
C[2][2] = 1.
C.transpose()
|
( With this matrices and the depth in blender units I want to calculate instead of the depth a disparity map for each rendered view by retrace each point from the neighbored view and compare the destination positions in the rendered views. )
However, the problem now is, that the camobj.matrix_world.inverted() object for the same viewpoints in blender 2.5 looks like this:
| Code: |
[(0.0, 0.0, 1.0, 0.0),
(1.0, 0.0, 0.0, 0.0),
(0.0, 1.0, 0.0, 0.0),
(-1.0, -0.5, -20.0, 1.0)]
|
and in blender 2.6 like this:
| Code: |
[(0.0, 1.0, 0.0, 0.0)
(0.0, 0.0, 1.0 0.5)
(1.0, 0.0, 0.0 -20.0)
(0.0, 0.0, 0.0, 1.0)]
|
Is anyone able to explain me why and what I should do to get similar results?
Thanks in advance and best regards,
_patrice_
see this:
http://blenderartists.org/forum/showthread.php?240793-Changes-to-Matrices-for-Blender-2.62
matrices are now row-major instead of column major.
your 2.6 matrix transposed:
| Code: |
[(0.0, 0.0, 1.0, 0.0)
(1.0, 0.0, 0.0, 0.0)
(0.0, 1.0, 0.0, 0.0)
(0.0, 0.5, -20.0, 1.0)]
|
almost the same as your 2.5 matrix
you might have to swap the order of vectors and matrices in multiplications to get it right
_________________
I'm sitting, waiting, wishing, building Blender in superstition...
The order and meaning of operations should not have changed. The only thing that should be affected is direct examination/construction of the matrix elements.