now we're doing a bunch of them
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_depth.fs
1 out vec4 FragColor;
2
3 uniform vec3 uCamera;
4 uniform vec3 uBoard0;
5 uniform vec3 uBoard1;
6
7 #include "common_scene.glsl"
8
9 // Water blending
10 // ==============
11
12 float water_depth( vec3 pos, vec3 halfview )
13 {
14 vec3 pnorm = g_water_plane.xyz;
15 float pdist = g_water_plane.w;
16
17 float d = dot( pnorm, halfview );
18 float t = dot((pnorm*pdist - pos), pnorm) / d;
19 return t * g_water_fog;
20 }
21
22 void main()
23 {
24 vec3 halfview = normalize( uCamera - aWorldCo );
25 float depth = water_depth( aWorldCo, halfview );
26 FragColor = vec4( depth, 0.0, 0.0, 0.0 );
27 }