So I've been implementing a projected grid ocean for our latest game and I ran into a what it seems, undersampling issue when I sample my displacement heightmaps. It seems that I can't tile the heightmaps a lot over the water surface - if I do so, the surface wobbles a lot. This leaves me with relatively big lumps of water of low amplitude. The heightmaps are 512x512 (I can't go much higher than that, the implementation is for iOS devices).
How do games like Assasin's creed and others fix this aliasing problem? I couldn't see it happening in their implementation and they have massive waves.
Here is my texture sampling code for the heightmap, if someone feels like helping
float dist = 0; float3 ray = 0; // calculate the water world space vertex position from the screen space quad float3 waterWpos = reconstruct(v.vertex, dist, ray); float fade = exp(-dist * _LodExponent); float lod = _MaxLod * (1-fade); // if _GridSize becomes too small, very obvious sampling artifacts occur float4 tc = float4(waterWpos/_GridSize, 0, lod); float4 texel = tex2Dlod (_HeightsTex, tc); waterWpos = texel.r*_WaveHeight;
I have tried sampling the heightmap using a radial grid, however I have the same problem.
Any input is appreciated!