Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decompose projection matrix44 to left, right, bottom, top, near and far boundary values

Can any one help me to get left, right, bottom, top, near and far boundary values from projection matrix44?

like image 306
user779554 Avatar asked May 31 '12 08:05

user779554


People also ask

What is the transformation matrix for perspective projection?

The projection matrix is typically a scale and perspective projection. The projection transformation converts the viewing frustum into a cuboid shape. The near end of the viewing frustum is smaller than the far end, which has the effect of expanding objects that are near to the camera.

What are the frustum properties of perspective projection?

The perspective projection frustum is defined by the parameters θ, n, f, h and the width of the view (near) plane. An anamorphic image appears distorted from all but a few viewpoints. They have been studied by artists and architects since the early fifteenth century.

Which projection has same proportion in XYZ direction?

An isometric view of an object can be obtained by choosing the viewing direction such that the angles between the projections of the x, y, and z axes are all the same, or 120°.


1 Answers

Here are the resolutions of the equation systems Christian Rau referred to :

For an orthographic matrix :

near   =  (1+m34)/m33;
far    = -(1-m34)/m33;
bottom =  (1-m24)/m22;
top    = -(1+m24)/m22;
left   = -(1+m14)/m11;
right  =  (1-m14)/m11;

For a perspective matrix :

near   = m34/(m33-1);
far    = m34/(m33+1);
bottom = near * (m23-1)/m22;
top    = near * (m23+1)/m22;
left   = near * (m13-1)/m11;
right  = near * (m13+1)/m11;

You can replace the values m11, m12, etc., by the formulas defined in the documentation for glOrtho and glFrustum to check it's correct.

like image 55
wip Avatar answered Dec 17 '22 23:12

wip