Projecting All Elements Mirrored

Hey guys,

I’m working on an application where the game will be projected onto a mirror, and thus all elements need to be flipped over the X axis. I have started out with the Panda3D introductory sample of the walking 3D panda and an example text line. The problem is that I want the ability to flip the scene entirely as I will be designing everything on a monitor that isn’t mirrored. I believe the easiest way would be to draw onto a surface and flip the entire surface so any 3D models stay intact.

Any ideas on the best route to implement this into the typical design and rendering pipeline?

The code that I have pieced together from the tutorial is at:

Have you tried setting the X-component of the camera’s scale to -1?

Yes I did. In my frame loop I tried, 1, 1) and it does not produce the desired result. The environment model as well as the sample panda model gets messed up and many of their features are no longer displayed (this is why I would like to know how to project everything onto a surface and flip that entirely so all the models stay intact).

Many thanks! Any other ideas?

Hmm… What about scaling your scene - or rather the base node thereof - by -1 in the x-axis? (I’m not sure of whether the camera is parented to render; against this possibility, I suggest placing a new node just below render, having all elements of your scene be parented to that or a descendant of it, and then scaling that new node by (-1, 1, 1).)

If I’m correct, you should be able to do this just once, when creating your new node - performing the scaling in the main loop seems superfluous to me.

One approach that is often used for mirroring surfaces is to create a PlaneNode in space at the coordinates of the mirror, and then using getReflectionMat() on that. This returns a transformation matrix that flips the coordinates over that plane, so you can simply multiply the camera matrix with this reflection matrix.

I believe that almost every demo around the forums that features water with reflections uses this approach.