Last change
on this file since 12292 was
12115,
checked in by wiesep, 6 years ago
|
Changed folder structure, deletet some unused files and cleaned up code
|
File size:
1.0 KB
|
Rev | Line | |
---|
[12115] | 1 | #version 150 |
---|
| 2 | |
---|
| 3 | uniform float fixedDepthBias; |
---|
| 4 | uniform float gradientClamp; |
---|
| 5 | uniform float gradientScaleBias; |
---|
| 6 | uniform sampler2D shadowMap; |
---|
| 7 | uniform sampler2D diffuseMap; |
---|
| 8 | uniform vec4 vertexLight; |
---|
| 9 | |
---|
| 10 | in vec4 oUv0; |
---|
| 11 | in vec4 oShadowUV; |
---|
| 12 | |
---|
| 13 | out vec4 fragColour; |
---|
| 14 | |
---|
| 15 | //////////////////////// GRASS SHADOW RECEIVER |
---|
| 16 | void main() |
---|
| 17 | { |
---|
| 18 | if (oShadowUV.z > 0.0) |
---|
| 19 | { |
---|
| 20 | vec4 diffuse = texture(diffuseMap, oUv0.xy); |
---|
| 21 | if (diffuse.a > 0.001) |
---|
| 22 | { |
---|
| 23 | fragColour = vec4(0.0); |
---|
| 24 | } |
---|
| 25 | else |
---|
| 26 | { |
---|
| 27 | vec4 normShadowUV = oShadowUV / oShadowUV.w; |
---|
| 28 | vec4 shadowDepths = texture(shadowMap, normShadowUV.xy); |
---|
| 29 | |
---|
| 30 | float gradientFactor = gradientClamp * gradientScaleBias; |
---|
| 31 | float depthAdjust = gradientFactor + fixedDepthBias * shadowDepths.x; |
---|
| 32 | float centerdepth = shadowDepths.x + depthAdjust; |
---|
| 33 | |
---|
| 34 | fragColour = (centerdepth > normShadowUV.z) ? vec4(vertexLight.rgb, diffuse.a) : vec4(0.0, 0.0, 0.0, diffuse.a); |
---|
| 35 | } |
---|
| 36 | } |
---|
| 37 | else |
---|
| 38 | { |
---|
| 39 | fragColour = vec4(0.0); |
---|
| 40 | } |
---|
| 41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.