/usr/share/meshlab/shaders/decorate_shadow/vsm/objectVSM.frag is in meshlab 1.3.2+dfsg1-2build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | uniform mat4 mvpl;
uniform sampler2D shadowMap;
uniform float texSize;
varying vec4 shadowCoord;
uniform float shadowIntensity; // 1.0 black, 0, transparent
vec4 shadowCoordPostW;
float chebyshevUpperBound( float distance) {
// We retrive the two moments previously stored (depth and depth*depth)
vec2 moments = texture2D(shadowMap,shadowCoordPostW.xy).rb;
// Surface is fully lit. as the current fragment is before the light occluder
if (distance <= moments.x)
return 1.0 ;
float variance = moments.y - (moments.x*moments.x);
//variance = max(variance,0.00002);
variance = max(variance,0.000195);
float d = distance - moments.x;
float p_max = variance / (variance + d*d);
return p_max;
}
void main() {
shadowCoordPostW = shadowCoord / shadowCoord.w;
shadowCoordPostW = shadowCoordPostW * 0.5 + 0.5;
float shadow = chebyshevUpperBound(shadowCoordPostW.z);
vec4 kd = gl_LightSource[0].diffuse;
if (shadow > 0.4)
discard;
// gl_FragColor = vec4(vec3(0.0), 0.5 - shadow);
gl_FragColor = vec4(vec3(0.0), (shadowIntensity-shadow));
}
|