diff --git a/shaders/surface.frag b/shaders/surface.frag index e5bbed52d5c3d8572daca35dff3ca6baadc51cd7..9bead146f9eb37be6a6aa91c523d3e15c38d28c9 100644 --- a/shaders/surface.frag +++ b/shaders/surface.frag @@ -12,7 +12,7 @@ uniform sampler2D ground_depth; uniform vec3 camera_pos; const float PI = 3.1415926535897f; -const float R0 = 0.04; +const float R0 = 0.0204; const float MIN_T = 0; const float MAX_T = 10.0; @@ -36,11 +36,11 @@ float fresnel(vec3 normal, vec3 view) { } vec2 tex_at(vec3 pos) { - return pos.xz * vec2(0.1f) + vec2(0.5f); + return pos.xz * vec2(-0.1, 0.1f) + vec2(0.5f); } float depth_at(vec3 pos) { - return mix(4.5, -2.0, texture(ground_depth, tex_at(pos)).r); + return mix(2.0, -4.5, texture(ground_depth, tex_at(pos)).r); } /** @@ -78,11 +78,12 @@ void main(void) // vec3 water_color = vec3(0, 0.05, 0.1); vec3 sky_color = texture(sky, sphere_uv(reflected)).rgb; - vec3 refracted = refract(view, nnormal, 0.667); + vec3 refracted = refract(view, nnormal, 0.75); vec3 water_color = refraction_ray(world_pos, refracted); //out_Color = vec4(1,0,1,1); // out_Color = vec4(refracted * vec3(0.5) + vec3(0.5), 1.0); + // out_Color = vec4(nnormal, 1.0); out_Color = vec4(mix(water_color, sky_color, R), 1.0); // out_Color = texture(ground_depth, tex_coord);