Ori and the blind forest GPU Water and dynamic wave

Oh yea I for some reason thought you were only talking about the surface of the water itself.

For the fog thing you also need to figure out if the current pixel is below the water or not. The way I have solved this in the past is by transforming the screen coords into world position and then using the Z height of the derived position to compare. If you want the sim to also affect the waterline you also need to map the sim texture to those world coordinates and use the Z height of the sim as an offset to the Z of the screenpos.

Currently if you try to do a position transform from screenpos to worldpos the engine will crash. For now you can use this as a custom node. You need to add input “ScreenPos” and “Depth”. Depth should be 10 which is the near clip plane.


float2 viewpos = (ScreenPos.xy - View.ScreenPositionScaleBias.wz) / View.ScreenPositionScaleBias.xy * Depth;

float4 pos = mul( float4( viewpos, Depth, 1 ) , View.ScreenToWorld );

return pos.xyz * (1 / pos.w);