Original Post
I'm currently trying to get reflections working in my water by mirroring my geometry about the water plane and rendering to a 2D texture. No problems so far.
The problem comes when I try and use this reflection texture: specifically determining the texture coordinates I need to get it to map right.
From my readings of MSDN it appears I need to use D3DTSS_TCI_CAMERASPACEPOSITION, so I set up my texture stage like this:
device->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION); device->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT3 | D3DTTFF_PROJECTED );My problem comes in supplying the matrix to transform the camera space position of the vertex. I've tried all kinds of wacky combinations of view and projection matrices, as well as scaling and translation matrices to compensate for the fact that post projection x and y coordinates are in the range [-1,1]. No matter what I do the reflection texture ends up behaving horribly. Any help or pointers would be greatly appreciated. [edited by - Thraddash on May 6, 2004 9:27:44 AM]