Jump to content
  • Advertisement
Sign in to follow this  

virtual camera view - solution for optimal projection

This topic is 2931 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!