More mirror stuff

Implemented mirrors with reflections about arbitrary planes at arbitrary distances from the origin. The math runs something like this:

Let R be the Reflection matrix (see Essential Maths for Games, pg152), then the combined matrix R‘ is: R‘ = T x R x inv(T) with T being the translation matrix of the mirror.

The complete matrix pipeline for the mirrored content is then: P x V x R‘ x M, with P=Projection matrix, V=View matrix, R‘ as above and M = Model matrix. It’s interesting that the reflection matrix sits between the model and the view matrix and it makes local transformation of objects easy: we just have to modify the Modelview matrix and can chain the object’s transforms regularly.

In the current (test app) it looks like this:

Virtual mirrors

Virtual mirrors

The big mirror is artificially defined and reflects the ground grid perfectly. The other mirrors are loaded from the detected mirrors in Ross’ house. As their angle is slightly offset, their reflection appears offset as well.

Empty mirrors are strange, so I implemented a very simple billboarded Avatar:

Avatar in mirror

Avatar in mirror

The matrix chain is similar to above, except that the resulting upper-left rotation-scale matrix is set to identity before multiplying with the projection matrix.

I also tried recursive mirrors. This should be not very expensive with this method, as each reflection is just a texture access. However, there was a strange rendering and transformation issue so I dropped it for now.

The VizHomeOOC rendering core has been modified quite a bit and now supports distinct rendering passes. Next week should see the merging of mirrors and the current rendering core. At the same time, I am looking into taking live video-feed from a kinect and streaming it onto the billboard as some kind of augmented virtuality system.