   [MDX] Water Displacement Problem
  Having just figured out how to work clip planes, I now have another problem...if I enable displacement of the texutre coordinate via a per-pixel normal, I get this band of no reflection, which increases as I increase the displacement factor:Here is some hlsl showing what I mean by displacement factor (I've pretty much taken it from Yann's water article):[source lang='c#']    float disp = 1.0;    float4 dPos;    dPos.xy = inPos.xy + disp * normal.xy;    dPos.z = inPos.z;    dPos.w = 1.0;    float4 texProj = mul(dPos, matProjectiveTexture);    float3 reflection = tex2Dproj(samplerReflection, texProj);So if anyone has had this problem and knows how to solve, please help.If more code/info is needed, then please say.Cheers,James   
  Ahh isn't that a beautiful article.  Many a water shader has been developed from that article.  Too bad he never got around to any more on water.  But I digress...  Are you sure the clipping plane is set to the right height?  It looks like it's being clipped too low.  Could you put up a bigger screenshot?  When you distort the texture coordinates it causes glitches where the water meets the ground in which you can see the sky, but it shouldn't be that drastic.  Here (second one down) is what that glitch looks like in a program from a while back, the third one down is what the glitch looks like in farcry.  Does that look like what you're having?   ;  Thanks for your reply.My clipping plane is corrently set to the water height at y=0, and I get this same problem without setting the clip plane.My projective remapping matrix is = Matrix.Scaling(0.5f, -0.5f, 0.5f) * Matrix.Translation(0.5f, 0.5f, 0.5f);Below are screenshots showing the problem with different values of 'disp' from the HLSL in my previous post:disp = 0.0f;disp = 1.0f;disp = 2.0f;And here's a link to a large screenshot with disp = 1.0fSo I kinda think it's a problem with my projective texturing as the displacement factor alters it.As for the glich you link to, I think I do get that aswell, as can be seen in my disp = 0.0f screenshot.[Edited by - jameswren on July 4, 2006 12:54:45 PM];  Heres my first thoughts:The "normal map" you are using, is well, probably designed for a surface. As such, it's likely to have a normal more or less pointing up. This means that in almost any case, the y value will be larger than 0.5f, and should never dip below 0.If you want truely "random" values, in the [-1, 1] range, like I suspect the X value is giving you, try getting the value from the Z value. Alternatively, try a different normal map with Y values on the range of [-1, 1].If you couldn't understand what I'm saying, try this:    dPos.xy = inPos.xy + disp * normal.xz;Hope this helps :).   ;  Thanks for your reply Sirob. I tried your suggestion, but it looks EXACTLY the same, ie the ripples are no different. Here is the normal map I am using, borrowed from my copy of Freeworld3D (which has nice working water reflections).[Edited by - jameswren on July 4, 2006 12:52:12 PM]