summaryrefslogtreecommitdiff
path: root/glass.frag
diff options
context:
space:
mode:
Diffstat (limited to 'glass.frag')
-rw-r--r--glass.frag7
1 files changed, 5 insertions, 2 deletions
diff --git a/glass.frag b/glass.frag
index 6575a0b..3810c52 100644
--- a/glass.frag
+++ b/glass.frag
@@ -1,9 +1,11 @@
varying vec3 light_surf;
varying vec3 eye_surf;
varying vec3 tangent_surf;
+varying vec4 shadow_coords;
varying vec2 texcoord;
uniform sampler2D normal_sampler;
uniform sampler2D heightmap_sampler;
+uniform sampler2DShadow shadow_sampler;
uniform float F0, ni;
float schlick_fresnel(float n_dot_l)
@@ -27,6 +29,7 @@ float fresnel(float v_dot_h)
void main()
{
+ float shadow = shadow2DProj(shadow_sampler, shadow_coords).x;
const vec4 material_color = vec4(0.7, 0.5, 0.3, 0.0);
vec3 l = normalize(light_surf);
vec3 v = normalize(eye_surf);
@@ -43,7 +46,7 @@ void main()
float v_dot_h = dot(v, h);
float s = .7;
float d = 1 - s;
- float Ii = 0.9; /*intensity of incoming light */
+ float Ii = 0.9 * shadow; /*intensity of incoming light */
float Iia = .1 * Ii; /*intensity of ambient light */
float cos2_alpha = n_dot_h * n_dot_h;
@@ -94,7 +97,7 @@ void main()
gl_FragColor = n_dot_l * step(0, n_dot_l) *
vec4(material_color.xyz *
- (Rd * d + Rs * s),
+ ((Rd * d + Rs * s) * Ii),
material_color.w) +
Iia * Ra * material_color.xyzw;