X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fcommon_world.glsl;h=45e12dff48267ba71c814a07a3272ea3eb29c339;hb=f3a2490079baf440238b78e54f4476649eddbda2;hp=b5c79dfac683779b4ddfe6977f7c20c823b929f5;hpb=aa4c26eae2208872824e0eb5b71bc05c16d43242;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/common_world.glsl b/shaders/common_world.glsl index b5c79df..45e12df 100644 --- a/shaders/common_world.glsl +++ b/shaders/common_world.glsl @@ -25,6 +25,13 @@ float world_depth_sample( vec3 pos ) return texture( g_world_depth, depth_coord ).r; } +float world_water_depth( vec3 pos ) +{ + vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; + float ref_depth = g_water_plane.y*g_water_plane.w; + return texture( g_world_depth, depth_coord ).g - ref_depth; +} + float shadow_sample( vec3 vdir ) { vec3 sample_pos = aWorldCo + vdir;