[osg-users] z-up & camera position & osgthirdpersonview

Robert Osfield robert.osfield at gmail.com
Sun Sep 7 00:55:36 PDT 2008


Hi Fabian,

Eye coordinates in OpenGL and OSG are Y up, X to the right, Z out from
the screen.  Eye coordinates are in the screens frame of reference.

Model coordinates in the OSG can be anything you want them to be,
but... the OSG plugins and camera manipulators default to a *model*
coordinate frame of Z up, Y to the north, X to the east.   Key to
remember is here we are talking about model coordinates, and north,
east - in real world frame of reference.

A common mistake in computer graphics is to try and tie the screen
reference frame directly to the world - forcing the world's reference
frame to be that of the eye/screen, once you do this you end up making
lots of silly mistakes about managing coordinates.

Another mistake is to get hung up with eye coordinates and how these
map to world coordinates, almost all of the time you can totally
ignore eye coordinates and just work in world or local object
coordinate frame, the camera's themselves allow you to set their
position in world coordinates - such as my using the
setViewMatrixAsLookAt(..) method.   Convenience methods like this will
create all the correct transforms for you.

Robert.

On Sun, Sep 7, 2008 at 4:12 AM, Fabian Bützow <buetz at uni-koblenz.de> wrote:
> Hi,
> let me summarise my thoughts about the osg-opengl-coordinate system issue:
> (and please comment on that)
>
> Thinking in local coordinate systems, every geometry has its own coordinate
> system, starting in WCS (0,0,0). For each coordinate system is X east, Y
> north and Z up.
> When you add transformation nodes into the scenegraph between root and
> geometry, each transformation adds up to a model matrix(top-down) that
> transforms the coordinate system.
> (imagine: the geometry is drawn into that modified coordinate system)
>
> After that, the view Matrix of the camera is applied. (camera coordinates
> are in osg Z-up)
> Basically, that means that the local coordinates are transformed into the
> eye coordinates.
>
> Still, z is up?!
> (virtual camera is in origin, looking along positive y, right-hand-system)
>
>
> I found this quote from Robert:
> "Once the scene is transformed into eye space by the View matrix of the
> Camera the coordinate system of the eye space is standard OpenGL, +ve
> Y up the screen, +ve X to the right, +Z out from the screen."
>
> And now im getting a little confused..
> Now an addtional rotation (x, 90°) should be applied, to rotate the
> coordinate system from osg into X east, Y up, Z south.
>
> That would mean camera still looks along positive y.?? that would be strange
> when it comes to the viewing volume and the perspective division..?
> (Y non linear scaled??, something's wrong here..)
>
> see, im confused ;)
> im sure you can help me,
>
> cheers
> Fabian
>
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list