Sign in to follow this  
mede

virtual camera view - solution for optimal projection

Recommended Posts

Hey
I actually working on a technique rendering a correct mirror.
For this I create a virtual camera behind the mirror and render the scene from this
view into a texture which I put onto the mirror. First this sound simple to me but I got
a view problems ;(

With the mirror plane and the camera it is easily possible to calculate position of the virtual position.

--MAIN PROBLEM--
But HOW I GET the camera view direction and camera projection matrix to become
a optimal projection of the 4 mirror corners ????

Actually I used the center of mirror as view direction and I try with a lot of hacks to adapt aspect ratio and field of view angle to become all 4 corners inside the frustum.
-Because of this I have to adapt also the UV-coords to map the mirror to the skewed projection in the texture which results in perspective distortions in texture interpolation !
-the center of mirror is not the center of projection, because of this the mirror is often not complete in frustum !

Share this post


Link to post
Share on other sites
If your 3D API has support for stencil buffers, you can do this without having to render to texture. You'd just do multipass rendering instead. Here is a page that describes the stencil buffer process for planar reflections/planar mirrors:

Planar Reflections Using the Stencil Buffer

Another way to do the render to texture approach is to keep your camera in its normal position, e.g., don't reflect the camera position. Instead, reflect the objects in the scene about the mirror plane and render to texture using the normal camera. This is really analogous to what you're already doing, but I think it may avoid the texture sampling distortions you're talking about. Here is a page about that:

Planar Reflections using Texture Mapping

Well, why don't I just give you a link to the whole section of that presentation?

Techniques for Rendering Reflections

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this