if i want e.g. to reflect a scene in water, i scale about (1, -1, 1), setup a clipping plane with a normal vector pointing up and offset the scene.
now i’m trying to figure out how i have to setup the scale matrix and the clipping plane to reflect a scene about an arbitrary plane, for arbitrarily placed and oriented mirrors.
does someone know how to do that? thanks
I haven’t done this personally, but I’d start with a definition of a reflection matrix here:
So you wouldn’t be using the scale transformation but using something like glMultMatrixd on the GL_MODELVIEW_MATRIX.
If your plane isn’t through the origin then you’d have to apply a translation after the reflection.
Look at glhGeneralPlanarMirrorf_1, glhGeneralPlanarMirrorf_2
in the header file.
It’s open source so you can adapt it to your particular way of transforming your mirror to eye space.