11 #include "common_world.glsl"
16 float water_depth( vec3 pos, vec3 halfview )
18 vec3 pnorm = g_water_plane.xyz;
19 float pdist = g_water_plane.w;
21 float d = dot( pnorm, halfview );
22 float t = dot((pnorm*pdist - pos), pnorm) / d;
23 return t * g_water_fog;
28 vec3 halfview = normalize( uCamera - aCo );
29 vec3 world_pos = vec3( aCo.y, aCo.x, aCo.z );
30 FragColor = vec4( world_pos, water_depth( aCo, halfview ) );