Jump to content
  • Advertisement
Sign in to follow this  
Shaarigan

3x3/3x2 orthographic projection matrix

This topic is 737 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey Volks

 

I have some trouble getting my 3x3 / 3x2 orthographic Matrix running from my 4x4 Matrix that looks like

2.0f * invRL           , 0                      , 0                      , 0
0                      , 2.0f * invTB           , 0                      , 0
0                      , 0                      , -2.0f * invFN          , 0
-(right + left) * invRL, -(top + bottom) * invTB, -(zFar + zNear) * invFN, 1

where

invRL = 1.0f / (right - left)
invTB = 1.0f / (top - bottom)
invFN = 1.0f / (zFar - zNear)

But I cant currently figure out (maybe related to the weather) how to make a 3x3 (and 3x2) Matrix from it looking same as the 4x4 one.

Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement

Are you asking how to create a 3x3/3x2 matrix from an existing 4x4 matrix(or 4x4 orthographic matrix)? 

 

If you are you normally make an orthographic or perspective matrix as a 4x4 Matrix. But if you really want to make a 3x3 matrix from a 4x4 matrix it isn't that difficult as you are just going to copy over the values of the of the X,Y, Z and ignore the W component values. However, if you want to convert a 4x4 orthographic matrix to a 3x3 matrix you're going to lose some data, in this case '-(right + left) * invRL, -(top + bottom) * invTB, -(zFar + zNear) * invFN'.

 

I hope that answers your question?

Share this post


Link to post
Share on other sites

how to make a 3x3 (and 3x2) Matrix from it looking same as the 4x4 one.

 

You can't.

How exactly is 3x3 matrix gonna transform 3d vectors, if it cannot add translation component to them by putting 1 into a 4d vector?

The translation component is :

-(right + left) * invRL, -(top + bottom) * invTB, -(zFar + zNear) * invFN, 1

and only 4d vectors with 1 as fourth component can have this base vector added, capish?

 

Now what you might be after though, is 4x2 matrix I gess?

 

With such a matrix you can transform 4d vectors into 2d vectors what I think is what you wish (the projected 2d, screen, etc)

 

Such a matrix should be simply the first 2 columns of your matrix in post as you layouted it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!