Reflection Matrices

Started by
1 comment, last by sirob 18 years, 10 months ago
Alright, so I've got a water plane. I'm calling D3DXPlaneFromPointNormal to get it in an ABCD format (just picking a point on the plane). Then, I call D3DXMatrixReflect with that plane. I add it before the world matrix to my transformations (Reflect * World * View * Proj), but it's not working. This renders nothing in my water. I'd be getting sky if I had any. I've disabled all culling. If I don't use a reflection matrix, my water is simply see through, and shows exactly what's under it. So, I know my other code is working, I'm just not getting anything projected. Any suggestions? I don't really know where to start looking.
Sirob Yes.» - status: Work-O-Rama.
Advertisement
First you have to texturize the water plane.
Second you have to render the world in two stages
1. Render the world to the water plane texture using the reflected matrix as the view matrix.
2. Render the world to the back buffer using the original view matrix.
And that's it. You'll must see a plane with the world reflected in it.
This technique is called Environment Mapping.
Forgot to mention, I'm using stencil buffering. Not rendering to a texture at all. It seems that the reflection matrix is off, but I'm not sure how to even start check if it's correct.

Any info on that?
Sirob Yes.» - status: Work-O-Rama.

This topic is closed to new replies.

Advertisement