Hi Frank,

I think what you're seeing is the difference between a world coordinate system 
(where X is east, Y is north and Z is up) and OpenGl (where X is to the right, 
Y is up, and Z is coming out of the screen).  What was Z up becomes Y (up the 
screen) and what was Y north becomes -Z (pointing away from the viewer).  If 
you swap the Y and Z columns and multiply the new Z column with -1 you get your 
missing transformation.

> Frank Sullivan
> Subject: [osg-users] [forum] Cameras View Matrix - I am perplexed
> 
> Hello!
> 
> I was wondering if someone could help explain the camera's 
> view matrix to me. The reason I ask is that, when I look at 
> it in the debugger, it is not at all what I expected it to be.
> 
...
> matrix, which happens to be what my question is about. So 
> anyway, when I calculate the inverse of the camera's world 
> matrix, I get:
> 
> -1 0 0 0
> 0 -1 0 0
> 0 0 1 0
> 0 500 -30 1
> 
> Multiplying my world-space vector [-1, 499, 31] by this 
> matrix yields [1, 1, 1], which is what I want. So, I'm 
> satisfied that this is correct.
> 
> The problem is, when I actually call 
> osg::Camera::getViewMatrix() for this camera, what I get instead is:
> 
> 1- 0 0 0
> 0 0 1 0
> 0 1 0 0
> 0 -30 -500 1
> 
...
> 
> So I was hoping someone could explain to me why this works 
> the way that it does, perhaps by pointing out an error in my 
> reasoning. I am trying to implement a shader that is similar 
> to shadow mapping, and it's not working, and this is the only 
> step along the way that isn't working as I expected it to.
> 
> Thanks!
> Frank Sullivan[/code]
> 
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to