Jump to content
  • Advertisement
Sign in to follow this  

Mirror the Camera or Matrix

This topic is 4744 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

hi im using render to texture to do a kind of mirror , and yes i have considered the stencil buffer but it doesnt work when mirrors reflect onto each other(Especialy if they reflect infinitely) i want to know i have the standard camera Pos[3],View[3],Up[3] how would i go about mirroring it over a plane consider that i have the Plane Equation,Plane Normal,1 point on the polygon. I also may need to mirror the matrix which i will get from opengl. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Excuse me if I'm wrong, but can't you just use glScalef with something like:

glScalef(1.0, -1.0, 1.0, 1.0);

I haven't touched OpenGL in awhile, but something like that should cause it to mirror image the scene.

Share this post


Link to post
Share on other sites
Quote:
Original post by Tyderium
Excuse me if I'm wrong, but can't you just use glScalef with something like:

glScalef(1.0, -1.0, 1.0, 1.0);

I haven't touched OpenGL in awhile, but something like that should cause it to mirror image the scene.


its glScalef(1.0, -1.0, 1.0); (put the negative on whatever axis you want inverted of course) but yeah, that should mirror the screen.

Share this post


Link to post
Share on other sites
Provided that 1. Your Mirror is placed at the Origin on the axis your mirroring
Provided that 2. Your mirror is axis aligned

Which neither are.........


So i considered scaling on the normal of the polygon but that doesnt make sense
ie you cant scale 0,1,0.

Perhaps you dont understand i need to mirror the camera not the world.
for 2 reasons.

I use bsp trees and frustum culling to determing my viewing polygons and if i just mirror(scale) the world then i will be viewing the wrong polygons and from behind anyways(since scaling also scales the normals)

Thanks anyways

Share this post


Link to post
Share on other sites
You could mirror each of camera base vetors (drections, not points) over the plane and create a new camera matrix. Or directly multiply view matrix by mirror matrix. Google should tell you how to construct a mirroring matrix from given plane.

Share this post


Link to post
Share on other sites
You could use a separate camera for the mirror, render the scene to a texture and then display the texture on a quad in your scene.

I know it's a poor man's solution. I have an example and source [here] with a [avi].

The example is a poor man's poor boy's solution. Because I just render the screen to a texture and use that as my mirror. It causes a visual distortion which was the effect I was looking for.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!