diff options
Diffstat (limited to 'ground.frag')
-rw-r--r-- | ground.frag | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ground.frag b/ground.frag index 8af0fb5..b5a733a 100644 --- a/ground.frag +++ b/ground.frag @@ -1,12 +1,13 @@ uniform vec3 light_eye; -varying vec3 shadow_coords; +varying vec4 shadow_coords; varying vec3 vertex_eye; -uniform sampler2D shadow_sampler; +uniform sampler2DShadow shadow_sampler; void main() { vec3 normal = vec3(0.0, 0.0, 1.0); - vec4 material_color = texture2DProj(shadow_sampler, shadow_coords); + vec4 material_color = vec4(1.0, 0.7, 0.5, 1.0); + float shadow = shadow2DProj(shadow_sampler, shadow_coords).x; vec3 l = normalize(light_eye - vertex_eye); vec3 v = normalize(-vertex_eye); vec3 h = normalize(l + v); @@ -14,5 +15,5 @@ void main() vec3 diffuse = material_color.xyz * n_dot_l; float specular = pow(dot(normal, h), 16.0); gl_FragColor = step(0.0, n_dot_l) * - vec4(diffuse + vec3(specular), material_color.w); + vec4((diffuse + vec3(specular)) * shadow, material_color.w); } |