fix da bugs
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_depth.fs
index 05d886bf1d0069b87a5a30184b5ce93986475953..a2b7642c2df612c6285a630d360254793c1aa303 100644 (file)
@@ -10,7 +10,7 @@ in vec3 aCo;
 in vec3 aWorldCo;
 flat in ivec4 aLights;
 
-#include "common_world.glsl"
+#include "common_scene.glsl"
 
 // Water blending
 // ==============
@@ -27,7 +27,7 @@ float water_depth( vec3 pos, vec3 halfview )
 
 void main()
 {
-   vec3 halfview = normalize( uCamera - aCo );
-   vec3 world_pos = vec3( aCo.y, aCo.x, aCo.z );
-   FragColor = vec4( world_pos, water_depth( aCo, halfview ) );
+   vec3 halfview = normalize( uCamera - aWorldCo );
+   float depth = water_depth( aWorldCo, halfview );
+   FragColor = vec4( aWorldCo.y, 0.0, 0.0,depth );
 }