Jan

05-16-2004, 02:25 PM

Hi

Does anyone know, how to get that matrix? Any advice is appreciated.

Thanks,

Jan.

Does anyone know, how to get that matrix? Any advice is appreciated.

Thanks,

Jan.

View Full Version : Getting the inverse Modelview*Projection Matrix

Jan

05-16-2004, 02:25 PM

Hi

Does anyone know, how to get that matrix? Any advice is appreciated.

Thanks,

Jan.

Does anyone know, how to get that matrix? Any advice is appreciated.

Thanks,

Jan.

plasmonster

05-16-2004, 02:45 PM

I'm assuming you want to avoid an explicit

inverse. If you know the transformations in the

modelview matrix, you can get the inverse by

playing some games with matrix properties. For

example, if the modelview is nothing more than

the camera transformation

MV = T R

that is, a rotation followed by a translation, then you could simplify things.

The matrix you seek is

-1

M = (P MV)

the inverse of the mvp.

Given the MV above, you have

-1

M = (P T R)

or equivalently

-1 -1 -1

M = R T P

Since R is a rotation, the inverse is the

transpose; since T is a translation, the inverse

is -T; since the inverse of P is given in the

red book (and elsewhere), you have

T -1

M = R (-T) P

If you follow this reasoning you can unroll your

matrices and solve them directly.

Here's a link to a good matrix FAQ:

http://skal.planet-d.net/demo/matrixfaq.htm#Q18

Hope this helps.

inverse. If you know the transformations in the

modelview matrix, you can get the inverse by

playing some games with matrix properties. For

example, if the modelview is nothing more than

the camera transformation

MV = T R

that is, a rotation followed by a translation, then you could simplify things.

The matrix you seek is

-1

M = (P MV)

the inverse of the mvp.

Given the MV above, you have

-1

M = (P T R)

or equivalently

-1 -1 -1

M = R T P

Since R is a rotation, the inverse is the

transpose; since T is a translation, the inverse

is -T; since the inverse of P is given in the

red book (and elsewhere), you have

T -1

M = R (-T) P

If you follow this reasoning you can unroll your

matrices and solve them directly.

Here's a link to a good matrix FAQ:

http://skal.planet-d.net/demo/matrixfaq.htm#Q18

Hope this helps.

paintor

05-17-2004, 01:46 AM

if ur using shaders theres an easy switch you can use, this is for ARB_Vertex_program type shaders. when specifying the matrix as

state.matrix.modelview

you can simply put

state.matrix.modelview.inverse

this works for state matrix's only and in shaders only. there are other matrix modifiers you can use

.invtrans

.transpose

hope this is helpful

state.matrix.modelview

you can simply put

state.matrix.modelview.inverse

this works for state matrix's only and in shaders only. there are other matrix modifiers you can use

.invtrans

.transpose

hope this is helpful

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.