Some (what i found) helpful info related to shaders.

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
User avatar
glenneaux
Gnoblar
Posts: 22
Joined: Tue Dec 21, 2004 3:55 am

Some (what i found) helpful info related to shaders.

Post by glenneaux »

This is just some stuff I found in a help file for another app relating to the CG matrices

Taken from another app so the semantics are not identical to ogre - I still found this helpful so for anyone interested here it is.
Cg Parameter

Name

Description

world

Contains the world transform matrix, i.e. the matrix that transforms a vertex from the model (local) coordinate to world coordinate system.


view


Contains the view transform matrix, i.e. the matrix that transforms a vertex from the world coordinate to view (eye) coordinate system.


worldView

Contains the concatenated matrix of world and view transform matrices, i.e. the matrix that transforms a vertex from the model (local) coordinate to view (eye) coordinate system.


worldViewProjection

Contains the world-view-projection matrix, i.e. the matrix that transforms a vertex from the model (local) coordinate to clip space (projection) coordinate system.


worldIT

Contains the inverse transponate of the world transform matrix, i.e. the matrix that can be used to transform a vertex from the world coordinate to model (local) coordinate system, under the assumption that the scaling is uniform.


viewIT


Contains the inverse transponate of the view transform matrix, i.e. the matrix that can be used to transform a vertex from the view (eye) coordinate to world coordinate system, under the assumption that the scaling is uniform.


worldViewIT

Contains the inverse transponate of the world-view transform matrix, i.e. the matrix that can be used to transform a vertex from the view (eye) coordinate to model (local) coordinate system, under the assumption that the scaling is uniform.


worldViewProjectionIT

Contains the inverse transponate of the world-view-projection transform matrix, i.e. the matrix that can be used to transform a vertex from the clip space (projection) coordinate to model (local) coordinate system, under the assumption that the scaling is uniform.


projection


Contains the projection matrix, i.e. the matrix that transforms a vertex from the view (eye) coordinate to clip space (projection) coordinate system.


projectionIT

Contains the inverse transponate of the projection transform matrix, i.e. the matrix that can be used to transform a vertex from the clip space (projection) coordinate to view (eye) coordinate system, under the assumption that the scaling is uniform.



Note: when using the inverse transponate transforms (xxxIT), you have to reverse the matrix multiplication, i.e. change the order of the arguments to mul() function. For instance, if you want to transform a vertex P from the view coordinate to model (local) coordinate system, you have to use this line:

float4 oPos = mul( P, worldViewIT );

instead of

float4 oPos = mul( worldViewIT, P );

User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 6
Contact:

Post by haffax »

Very useful indeed, as the parameter description in the docs might be a tad bit too concise.
Is this text copyrighted? If not we should put it on the wiki.
team-pantheon programmer
creators of Rastullahs Lockenpracht

User avatar
glenneaux
Gnoblar
Posts: 22
Joined: Tue Dec 21, 2004 3:55 am

Post by glenneaux »

The text is from the helpfile for EON Studio 5.0, and unfortunately it's copyrighted. Maybe just have to change the wording, if anyone wants to have a go at it, I don't really have the time but I may get around to doing it.

Helpful none the less :\

Post Reply