Original Post
Hi, i have a problem with my water reflections. it seems i dont get it to work correctly. to explain the problem better i made a video of the RTT reflection map and the result of using it. download videos
as you can see in the screenshots the white object is reflected correctly (at least i think so) but the top of the grasshill is displayed totally wrong. the vertex/pixel shader displaying the texture: the camera reflection i hope someone has an idea i tried the whole night without any major success... mfg flery
as you can see in the screenshots the white object is reflected correctly (at least i think so) but the top of the grasshill is displayed totally wrong. the vertex/pixel shader displaying the texture:
//vs
OUT.position = mul(float4(IN.position.xyz ,1.0), ModelViewProj);
OUT.project.x = 0.5 * (OUT.position.w + OUT.position.x);
OUT.project.y = 0.5 * (OUT.position.w - OUT.position.y);
OUT.project.z = OUT.position.w;
//ps
float2 projcoord = (IN.project.xy / IN.project.z);
float4 reflect = tex2D(texSampler0, projcoord.xy);
OUT.color = reflect;
D3DXMATRIXA16 matView;
D3DXMATRIXA16 matRef;
D3DXPLANE ReflectionPlane;
ReflectionPlane.a = 0;
ReflectionPlane.b = 0;
ReflectionPlane.c = 1;
ReflectionPlane.d = 0;
D3DXMatrixIdentity(&matRef);
pd3dDevice->GetTransform( D3DTS_VIEW, &matView );
D3DXMatrixReflect(&matRef, &ReflectionPlane);
D3DXMatrixMultiply(&matView2, &matRef, &matView);
pd3dDevice->SetTransform( D3DTS_VIEW, &matView );