Ticket #1738: shadow_filter_nodiv.diff

File shadow_filter_nodiv.diff, 5.9 KB (added by historic_bruno, 11 years ago)
  • binaries/data/mods/public/shaders/glsl/model_waterfall.fs

     
    4141      #if USE_SHADOW_PCF
    4242        vec2 offset = fract(v_shadow.xy - 0.5);
    4343        vec4 size = vec4(offset + 1.0, 2.0 - offset);
    44         vec4 weight = (vec4(2.0 - 1.0 / size.xy, 1.0 / size.zw - 1.0) + (v_shadow.xy - offset).xyxy) * shadowScale.zwzw;
     44        vec4 weight = (vec4(1.0, 1.0, -0.5, -0.5) + (v_shadow.xy - 0.5*offset).xyxy) * shadowScale.zwzw;
    4545        return (1.0/9.0)*dot(size.zxzx*size.wwyy,
    4646          vec4(shadow2D(shadowTex, vec3(weight.zw, v_shadow.z)).r,
    4747               shadow2D(shadowTex, vec3(weight.xw, v_shadow.z)).r,
  • binaries/data/mods/public/shaders/glsl/terrain_common.fs

     
    7676      #if USE_SHADOW_PCF
    7777        vec2 offset = fract(v_shadow.xy - 0.5);
    7878        vec4 size = vec4(offset + 1.0, 2.0 - offset);
    79         vec4 weight = (vec4(2.0 - 1.0 / size.xy, 1.0 / size.zw - 1.0) + (v_shadow.xy - offset).xyxy) * shadowScale.zwzw;
     79        vec4 weight = (vec4(1.0, 1.0, -0.5, -0.5) + (v_shadow.xy - 0.5*offset).xyxy) * shadowScale.zwzw;
    8080        return (1.0/9.0)*dot(size.zxzx*size.wwyy,
    8181          vec4(shadow2D(shadowTex, vec3(weight.zw, biasedShdwZ)).r,
    8282               shadow2D(shadowTex, vec3(weight.xw, biasedShdwZ)).r,
  • binaries/data/mods/public/shaders/glsl/model_water.fs

     
    6161      #if USE_SHADOW_PCF
    6262        vec2 offset = fract(coords.xy - 0.5);
    6363        vec4 size = vec4(offset + 1.0, 2.0 - offset);
    64         vec4 weight = (vec4(2.0 - 1.0 / size.xy, 1.0 / size.zw - 1.0) + (coords.xy - offset).xyxy) * shadowScale.zwzw;
     64        vec4 weight = (vec4(1.0, 1.0, -0.5, -0.5) + (coords.xy - 0.5*offset).xyxy) * shadowScale.zwzw;
    6565        return (1.0/9.0)*dot(size.zxzx*size.wwyy,
    6666          vec4(shadow2D(shadowTex, vec3(weight.zw, coords.z)).r,
    6767               shadow2D(shadowTex, vec3(weight.xw, coords.z)).r,
  • binaries/data/mods/public/shaders/glsl/model_common.fs

     
    7474      #if USE_SHADOW_PCF
    7575        vec2 offset = fract(v_shadow.xy - 0.5);
    7676        vec4 size = vec4(offset + 1.0, 2.0 - offset);
    77         vec4 weight = (vec4(2.0 - 1.0 / size.xy, 1.0 / size.zw - 1.0) + (v_shadow.xy - offset).xyxy) * shadowScale.zwzw;
     77        vec4 weight = (vec4(1.0, 1.0, -0.5, -0.5) + (v_shadow.xy - 0.5*offset).xyxy) * shadowScale.zwzw;
    7878        return (1.0/9.0)*dot(size.zxzx*size.wwyy,
    7979          vec4(shadow2D(shadowTex, vec3(weight.zw, biasedShdwZ)).r,
    8080               shadow2D(shadowTex, vec3(weight.xw, biasedShdwZ)).r,
  • binaries/data/mods/public/shaders/glsl/water_high.fs

     
    5858                #if USE_SHADOW_PCF
    5959                    vec2 offset = fract(coords.xy - 0.5);
    6060                    vec4 size = vec4(offset + 1.0, 2.0 - offset);
    61                     vec4 weight = (vec4(2.0 - 1.0 / size.xy, 1.0 / size.zw - 1.0) + (coords.xy - offset).xyxy) * shadowScale.zwzw;
     61                    vec4 weight = (vec4(1.0, 1.0, -0.5, -0.5) + (coords.xy - 0.5*offset).xyxy) * shadowScale.zwzw;
    6262                    return (1.0/9.0)*dot(size.zxzx*size.wwyy,
    6363                                         vec4(shadow2D(shadowTex, vec3(weight.zw, coords.z)).r,
    6464                                              shadow2D(shadowTex, vec3(weight.xw, coords.z)).r,
  • binaries/data/mods/public/shaders/arb/model_common.fp

     
    9494      FRC offset.xy, offset;
    9595      ADD size.xy, offset, 1.0;
    9696      SUB size.zw, 2.0, offset.xyxy;
    97       RCP weight.x, size.x;
    98       RCP weight.y, size.y;
    99       RCP weight.z, size.z;
    100       RCP weight.w, size.w;
    101       SUB weight.xy, 2.0, weight;
    102       SUB weight.zw, weight, 1.0;
    10397
    104       SUB offset.xy, v_shadow, offset;
     98      MAD offset.xy, -0.5, offset, v_shadow;
    10599      MOV offset.z, biasedShdw.z;
    106       ADD weight, weight, offset.xyxy;
     100      ADD weight, { 1.0, 1.0, -0.5, -0.5 }, offset.xyxy;
    107101      MUL weight, weight, shadowScale.zwzw;
    108102
    109103      MOV offset.xy, weight.zwww;
  • binaries/data/mods/public/shaders/arb/terrain_common.fp

     
    4848      FRC offset.xy, offset;
    4949      ADD size.xy, offset, 1.0;
    5050      SUB size.zw, 2.0, offset.xyxy;
    51       RCP weight.x, size.x;
    52       RCP weight.y, size.y;
    53       RCP weight.z, size.z;
    54       RCP weight.w, size.w;
    55       SUB weight.xy, 2.0, weight;
    56       SUB weight.zw, weight, 1.0;
    5751
    58       SUB offset.xy, fragment.texcoord[2], offset;
    59       MOV offset.z, biasedShdw;
    60       ADD weight, weight, offset.xyxy;
     52      MAD offset.xy, -0.5, offset, fragment.texcoord[2];
     53      MOV offset.z, biasedShdw.z;
     54      ADD weight, { 1.0, 1.0, -0.5, -0.5 }, offset.xyxy;
    6155      MUL weight, weight, shadowScale.zwzw;
    6256
    6357      MOV offset.xy, weight.zwww;