Question

While looking through the tutorials I've seen the Ogre::Camera::getCameraToViewportRay method being used. I was trying understand what it does.

First I imagine a viewport, being placed somewhere in the 3D scene, let's say on the screen of the TV object. I can easily imagine how to transform the 2D coordinate on the viewport to the 3D coordinate of the scene and then to make a ray from the camera position point through that point on the VP.

But I can not understand how it's done when the VP is on the the RenderWindow(on my monitor). I mean, where is the render window in the scene, where is the point on the renderwindow's VP in the scene? How is the point on the renderwindow's VP transformed into a 3D point of the scene?

Thanks for answer!

Était-ce utile?

La solution

The viewport shows what you see through a camera, but the viewport is in front of the camera.

There is a stackoverflow post with information about the relation of camera and viewport and a nice visual illustration: https://stackoverflow.com/a/7125486/2168872

The camera to viewport ray is a worldspace ray, starting from your camera and intersecting the viewport at a certain point, e.g. where your mouse cursor points to.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top