Jump to content
  • Advertisement
Sign in to follow this  
Lazy

SetClipPlane

This topic is 2570 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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



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

Share this post


Link to post
Share on other sites
Advertisement
Hidden
Very strange... Here at work everything looks great... Well... I guess everything is as it should.

Share this post


Link to post
Hidden

Very strange... Here at work everything looks great... Well... I guess everything is as it should.




Hmm.. not ok. Works at work on my 8800 GTX. But not at home on my 570 GTX. Very strange.

Share this post


Link to post
Hmm.. not ok. Works at work on my 8800 GTX. But not at home on my 570 GTX. Very strange.

Share this post


Link to post
Share on other sites
The solution at home was to check the world position in the Pixel shader and discard; the pixel if it was too low. I guess this is slower... but at least it works.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!