Hi Theo,

As for the coordinates, I can see where you are going but I still don't know 
how can I know the boundaries of my camera view on the xz plane. I mean, if I 
use the ortho projection I can set it and my viewport to the size of my screen 
and I'll know exactly what coordinates the boundaries of my camera will be. So 
if I draw a point to 1024,768 I'll know it will be on the corner of the screen.
How can I do the same thing using the perspective projection?

Well a rectangle in 2D space will become what's known as a frustum in perspective-projected 3D space, i.e. a truncated pyramid. You can simply unproject your viewport's 4 corners (top-left, top-right, bottom-left and bottom-right) to get the frustum's 8 corners, using the same math I posted before. As you can see, that will give you two 3D points per 2D point, one near and one far. You can also do the opposite.

Then given that frustum you can find out where to place your objects.

I suggest you look up 3D projection math on Google, you will get more details. In particular I like this page, very complete and easy to navigate with the bar at the top: http://www.euclideanspace.com/

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to