Jump to content
Posted 30 August 2012 - 09:35 PM
Posted 30 August 2012 - 11:26 PM
Posted 30 August 2012 - 11:56 PM
You need to use the ModelViewProjection matrix, and divide by w, not z, to get it into screen space.
Thanks for your help, I will try these methods.
To properly obtain the coordinates, I think that you need to multiply the vertex coordinates by the projection matrix and then divide the x/y values by -z.
However, I'd recommend considering using the stencil buffer to mask out the non-mirror areas, render the reflection, then render the unreflected scene. It's a bit more complex than that, but that's the general idea. The advantage to this method is that you don't need an additional texture, and the stencil test prevents some of the unnecessary fragment processing from happening.