Last change
on this file since 12091 was
12091,
checked in by wiesep, 6 years ago
|
Updated programs and adjusted Material to work with GLSL>150
|
File size:
1.2 KB
|
Rev | Line | |
---|
[12091] | 1 | #version 100 |
---|
| 2 | |
---|
| 3 | precision mediump int; |
---|
| 4 | precision mediump float; |
---|
| 5 | |
---|
| 6 | uniform float fixedDepthBias; |
---|
| 7 | uniform float gradientClamp; |
---|
| 8 | uniform float gradientScaleBias; |
---|
| 9 | uniform sampler2D shadowMap; |
---|
| 10 | uniform sampler2D diffuseMap; |
---|
| 11 | uniform vec4 vertexLight; |
---|
| 12 | |
---|
| 13 | varying vec4 oUv0; |
---|
| 14 | varying vec4 oShadowUV; |
---|
| 15 | |
---|
| 16 | //////////////////////// GRASS SHADOW RECEIVER |
---|
| 17 | void main() |
---|
| 18 | { |
---|
| 19 | if (oShadowUV.z > 0.0) |
---|
| 20 | { |
---|
| 21 | vec4 diffuse = texture2D(diffuseMap, oUv0.xy); |
---|
| 22 | if (diffuse.a > 0.001) |
---|
| 23 | { |
---|
| 24 | // Do manual alpha rejection because it is not built into OpenGL ES 2 |
---|
| 25 | if (diffuse.a < 0.588) |
---|
| 26 | { |
---|
| 27 | discard; |
---|
| 28 | } |
---|
| 29 | gl_FragColor = vec4(0.0); |
---|
| 30 | } |
---|
| 31 | else |
---|
| 32 | { |
---|
| 33 | vec4 normShadowUV = oShadowUV / oShadowUV.w; |
---|
| 34 | vec4 shadowDepths = texture2D(shadowMap, normShadowUV.xy); |
---|
| 35 | |
---|
| 36 | float gradientFactor = gradientClamp * gradientScaleBias; |
---|
| 37 | float depthAdjust = gradientFactor + fixedDepthBias * shadowDepths.x; |
---|
| 38 | float centerdepth = shadowDepths.x + depthAdjust; |
---|
| 39 | |
---|
| 40 | gl_FragColor = (centerdepth > normShadowUV.z) ? vec4(vertexLight.rgb, diffuse.a) : vec4(0.0, 0.0, 0.0, diffuse.a); |
---|
| 41 | } |
---|
| 42 | } |
---|
| 43 | else |
---|
| 44 | { |
---|
| 45 | gl_FragColor = vec4(0.0); |
---|
| 46 | } |
---|
| 47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.