Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 167 vs 168 for /trunk/assets/shaders/GLSL/depthPass.glsl

Diff revisions: vs.
  @@ -71,24 +71,24 @@
71 71 out vec4 _colorOut;
72 72 //Opacity and specular maps
73 73 uniform float opacity;
74 - uniform sampler2D opacityMap;
74 + #if defined(USE_OPACITY_MAP)
75 + //Opacity and specular maps
76 + uniform sampler2D texOpacityMap;
77 + #endif
75 78
76 79 void main(){
77 80
81 + float opacityValue = opacity;
78 82 #if defined(USE_OPACITY_MAP)
79 - if(texture(opacityMap, _texCoord).a < ALPHA_DISCARD_THRESHOLD) discard;
80 - #else
81 - if(opacity < ALPHA_DISCARD_THRESHOLD) discard;
83 + opacityValue = 1.1 - texture(texOpacityMap, _texCoord).a;
82 84 #endif
83 85
84 - float depth = _vertexMV.z / _vertexMV.w ;
85 - depth = depth * 0.5 + 0.5;
86 - float moment1 = depth;
87 - float moment2 = depth * depth;
88 -
86 + /*if(opacityValue < ALPHA_DISCARD_THRESHOLD)
87 + gl_FragDepth = 1.0; //Discard for depth, basically*/
88 +
89 + float depth = (_vertexMV.z / _vertexMV.w) * 0.5 + 0.5;
89 90 // Adjusting moments (this is sort of bias per pixel) using partial derivative
90 91 float dx = dFdx(depth);
91 92 float dy = dFdy(depth);
92 - moment2 += 0.25*(dx*dx+dy*dy) ;
93 - _colorOut = vec4( moment1,moment2, 0.0, 0.0 );
93 + _colorOut = vec4(depth , (depth * depth) + 0.25 * (dx * dx + dy * dy), 0.0, 0.0);
94 94 }