Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

Water issues

Started by BadgerC82 Aug 23, 2006 at 4:36 PM 3 replies 750+ views
Original Post
BadgerC82
BadgerC82
Hey guys I am in need of some help with my water :) Im getting artifacts in the water and when I render out my reflection texture it looks as though either the clipping is wrong or the culling. Here is the code I use to render the reflections Vector3 reflectPoint(0, -waterHeight,0); Vector3 reflectNormal(0, 1 ,0); //Setup Reflection Plane D3DXPlaneFromPointNormal(&mReflectionPlane, &reflectPoint, &reflectNormal); mpD3DDevice->SetClipPlane(0, mReflectionPlane); mpD3DDevice->SetRenderState( D3DRS_CLIPPLANEENABLE, D3DCLIPPLANE0); Matrix flippedView; Matrix scale; matReflect.Identity(); flippedView = matView; D3DXMatrixReflect(&matReflect, &mRefractionPlane); D3DXMatrixMultiply(&flippedView, &matReflect, &flippedView); Matrix matWorldViewProj = matWorld * flippedView * matProj; mWaterEffect.SetTexture("DiffuseMap", &diffuseTexture); mWaterEffect.SetMatrix(&matWorldViewProj, "matWorldViewProjection"); mWaterEffect.CommitChanges(); Any help would be appreciated ;)
Matt Aufderheide
Matt Aufderheide
Normally I would reflect the world matrix not the view matrix.. i dont know if your way would work..maybe it does..

Also you would normally need to revesre culling when rednering your reflection.

Can you show a screenshot so we can see the problem better?
BadgerC82
BadgerC82
Quote:
Also you would normally need to revesre culling when rednering your reflection.


Yeah I am using reverse culling

Quote:
Normally I would reflect the world matrix not the view matrix.. i dont know if your way would work..maybe it does..


I have done it both ways and it seems to make no difference at all and I checked some of Yann's stuff and he did the reflect on the view I think so I thought that was a safe bet.

Will put a screenshot up later when I get home....
jamesw
jamesw
You need to specify the clip plane in clip space for geometry drawn with a shader. There have been quite a few threads on this recently, you might try a search.

Here is one of them.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.