6uniform sampler2D blur_texture;
 
    7uniform sampler2D depth_texture;
 
    9uniform 
bool  do_positive_shadows; 
 
   10uniform 
float shadows_gamma      ; 
 
   11uniform 
float shadows_intensity  ; 
 
   12uniform 
bool  shadows_halo       ; 
 
   14float equalize_shadow(
float x) {
 
   15    return pow(x, shadows_gamma);
 
   18float unsharp_masking(vec2 uv) {
 
   19    float orig_depth  = glup_texture(depth_texture,uv).x;
 
   20    if(!shadows_halo && orig_depth == 1.0) { orig_depth = 0.5; }
 
   21    float smoothed_depth = glup_texture(blur_texture,uv).x;
 
   22    float result = smoothed_depth-orig_depth;
 
   24        result = -equalize_shadow(-result);
 
   26        if(do_positive_shadows) {
 
   27            result = equalize_shadow(result);
 
   32    return -100.0 * shadows_intensity * result;
 
   35void compute_unsharp_masking() {
 
   36    float shadow = unsharp_masking(tex_coord);
 
   37    if(!do_positive_shadows || shadow > 0.0) {
 
   38        glup_FragColor.rgb = 
vec3(0.0, 0.0, 0.0) ;
 
   39        glup_FragColor.a = shadow;
 
   41        glup_FragColor.rgb = 
vec3(1.0, 1.0, 1.0) ;
 
   42        glup_FragColor.a = -shadow;
 
   47    compute_unsharp_masking();
 
vecng< 3, Numeric::float64 > vec3
Represents points and vectors in 3d.
vecng< 2, Numeric::float64 > vec2
Represents points and vectors in 2d.