]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
additional high quality shadowmap filter that uses the shadow sampler rather than...
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 8 Dec 2012 02:31:28 +0000 (02:31 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 13 Dec 2012 19:19:57 +0000 (20:19 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11858 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=b205255e1b80349f082e66546ddbfd6ee9b3cc2a

r_shadow.c
shader_glsl.h

index 65eb096b9bef93849d35489546192c898df57fa0..02f8b073fb2a84a2d1e8b125bc03e61af747a6f0 100644 (file)
@@ -477,13 +477,12 @@ static void R_Shadow_SetShadowMode(void)
                        }
                        else 
                        {
+                r_shadow_shadowmapsampler = vid.support.arb_shadow && r_shadow_shadowmapshadowsampler;
                                switch (r_shadow_shadowmapfilterquality)
                                {
                                case 1:
-                                       r_shadow_shadowmapsampler = vid.support.arb_shadow && r_shadow_shadowmapshadowsampler;
                                        break;
                                case 2:
-                                       r_shadow_shadowmapsampler = vid.support.arb_shadow && r_shadow_shadowmapshadowsampler;
                                        r_shadow_shadowmappcf = 1;
                                        break;
                                case 3:
index dcb9c7051af13b7db51916d5e917d8d7fc52fd88..ebfa9b47bb9f8c66fef4729464c60d612c5b4775 100644 (file)
 "#     ifdef USESHADOWMAPPCF\n"
 "#       define texval(off) dp_shadow2D(Texture_ShadowMap2D, vec3(off, shadowmaptc.z))  \n"
 "      vec2 offset = fract(shadowmaptc.xy - 0.5);\n"
-"      vec4 size = vec4(offset + 1.0, 2.0 - offset), weight = (vec4(1.0, 1.0, -0.5, -0.5) + (shadowmaptc.xy - 0.5*offset).xyxy)*ShadowMap_TextureScale.xyxy;\n"
+"   vec4 size = vec4(offset + 1.0, 2.0 - offset);\n"
+"#       if USESHADOWMAPPCF > 1\n"
+"   vec2 center = (shadowmaptc.xy - offset + 0.5)*ShadowMap_TextureScale;\n"
+"   vec4 weight = (vec4(-1.5, -1.5, 2.0, 2.0) + (shadowmaptc.xy - 0.5*offset).xyxy)*ShadowMap_TextureScale.xyxy;\n"
+"      f = (1.0/25.0)*dot(size.zxzx*size.wwyy, vec4(texval(weight.xy), texval(weight.zy), texval(weight.xw), texval(weight.zw))) +\n"
+"              (2.0/25.0)*dot(size, vec4(texval(vec2(weight.z, center.y)), texval(vec2(center.x, weight.w)), texval(vec2(weight.x, center.y)), texval(vec2(center.x, weight.y)))) +\n"
+"              (4.0/25.0)*texval(center);\n"
+"#       else\n"
+"      vec4 weight = (vec4(1.0, 1.0, -0.5, -0.5) + (shadowmaptc.xy - 0.5*offset).xyxy)*ShadowMap_TextureScale.xyxy;\n"
 "      f = (1.0/9.0)*dot(size.zxzx*size.wwyy, vec4(texval(weight.zw), texval(weight.xw), texval(weight.zy), texval(weight.xy)));\n"
-"//#       define texval(x, y) dp_shadow2D(Texture_ShadowMap2D, vec3(center + vec2(x, y)*ShadowMap_TextureScale, shadowmaptc.z))  \n"
-"//    vec2 center = shadowmaptc.xy*ShadowMap_TextureScale;\n"
-"//    f = dot(vec4(0.25), vec4(texval(-0.4, 1.0), texval(-1.0, -0.4), texval(0.4, -1.0), texval(1.0, 0.4)));\n"
+"#       endif\n"        
 "#     else\n"
 "      f = dp_shadow2D(Texture_ShadowMap2D, vec3(shadowmaptc.xy*ShadowMap_TextureScale, shadowmaptc.z));\n"
 "#     endif\n"