Previous Thread  Next Thread

chat icon changes of matrix_world between 2.5 and 2.6?

_patrice_

Posted: Tue May 22, 2012 10:38 am
Joined: 28 Feb 2012
Posts: 5
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_
Reply with quote


CoDEmanX

Posted: Tue May 22, 2012 6:14 pm
Joined: 05 Apr 2009
Posts: 690
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...
Reply with quote


ldo

Posted: Wed May 23, 2012 10:14 am
Joined: 07 Nov 2010
Posts: 543
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.
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group