Original Post
Hi! Im trying to do a simple water shader with reflection. But I just cant get plane clipping to work. Doesn't matter what position or normal I use for my plane, nothing is ever clipped. The water reflects correctly except it also reflects stuff under the water.
Does anyone see any error in the code?
any help is appreciated
Does anyone see any error in the code?
any help is appreciated
D3DXPLANE clip_plane;
D3DXPlaneFromPointNormal(&clip_plane, &D3DXVECTOR3(0,-5, 0), &D3DXVECTOR3(0,1,0));
D3DXPlaneNormalize(&clip_plane, &clip_plane);
D3DXMATRIX view_projection = camera.GetViewProjectionMatrix();
D3DXMatrixInverse(&view_projection, NULL, &view_projection);
D3DXMatrixTranspose(&view_projection, &view_projection);
D3DXPLANE view_clip_plane;
D3DXPlaneTransform(&view_clip_plane, &clip_plane, &view_projection);
NGraphics::GetD3D9Device()->SetClipPlane(0, view_clip_plane);
NGraphics::GetD3D9Device()->SetRenderState(D3DRS_CLIPPLANEENABLE, D3DCLIPPLANE0);
//I draw the water here