]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
New cvar r_shadows_shadowmapbias to customize bias of fake shadows. Default is -1...
authorvortex <vortex@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 17 Sep 2012 13:58:17 +0000 (13:58 +0000)
committervortex <vortex@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 17 Sep 2012 13:58:17 +0000 (13:58 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11844 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
r_shadow.c
render.h

index 9aeff996875f11d6dc5eb4295a83fc04682b30fc..a242ce912ff7c90085806175cfc28146a7fdef61 100644 (file)
@@ -120,6 +120,7 @@ cvar_t r_shadows_drawafterrtlighting = {CVAR_SAVE, "r_shadows_drawafterrtlightin
 cvar_t r_shadows_castfrombmodels = {CVAR_SAVE, "r_shadows_castfrombmodels", "0", "do cast shadows from bmodels"};
 cvar_t r_shadows_focus = {CVAR_SAVE, "r_shadows_focus", "0 0 0", "offset the shadowed area focus"};
 cvar_t r_shadows_shadowmapscale = {CVAR_SAVE, "r_shadows_shadowmapscale", "1", "increases shadowmap quality (multiply global shadowmap precision) for fake shadows. Needs shadowmapping ON."};
+cvar_t r_shadows_shadowmapbias = {CVAR_SAVE, "r_shadows_shadowmapbias", "-1", "sets shadowmap bias for fake shadows. -1 sets the value of r_shadow_shadowmapping_bias. Needs shadowmapping ON."};
 cvar_t r_q1bsp_skymasking = {0, "r_q1bsp_skymasking", "1", "allows sky polygons in quake1 maps to obscure other geometry"};
 cvar_t r_polygonoffset_submodel_factor = {0, "r_polygonoffset_submodel_factor", "0", "biases depth values of world submodels such as doors, to prevent z-fighting artifacts in Quake maps"};
 cvar_t r_polygonoffset_submodel_offset = {0, "r_polygonoffset_submodel_offset", "14", "biases depth values of world submodels such as doors, to prevent z-fighting artifacts in Quake maps"};
@@ -4230,6 +4231,7 @@ void GL_Main_Init(void)
        Cvar_RegisterVariable(&r_shadows_throwdirection);
        Cvar_RegisterVariable(&r_shadows_focus);
        Cvar_RegisterVariable(&r_shadows_shadowmapscale);
+       Cvar_RegisterVariable(&r_shadows_shadowmapbias);
        Cvar_RegisterVariable(&r_q1bsp_skymasking);
        Cvar_RegisterVariable(&r_polygonoffset_submodel_factor);
        Cvar_RegisterVariable(&r_polygonoffset_submodel_offset);
index f8c6557dbb45f4f0abbb57ae581fcdc7b3fe95e8..fc53553dc779736f42a9aabd41c2879f89ca9003 100644 (file)
@@ -4800,7 +4800,7 @@ void R_DrawModelShadowMaps(int fbo, rtexture_t *depthtexture, rtexture_t *colort
        radius = 0.5f / scale;
        nearclip = -r_shadows_throwdistance.value;
        farclip = r_shadows_throwdistance.value;
-       bias = r_shadow_shadowmapping_bias.value * r_shadow_shadowmapping_nearclip.value / (2 * r_shadows_throwdistance.value) * (1024.0f / size);
+       bias = (r_shadows_shadowmapbias.value < 0) ? r_shadow_shadowmapping_bias.value : r_shadows_shadowmapbias.value * r_shadow_shadowmapping_nearclip.value / (2 * r_shadows_throwdistance.value) * (1024.0f / size);
 
        r_shadow_shadowmap_parameters[0] = size;
        r_shadow_shadowmap_parameters[1] = size;
index 998739fbeeaa2f808f93fb1f129fa26a93827948..af17eb92b8b76d911da57a11b12cb409584d100a 100644 (file)
--- a/render.h
+++ b/render.h
@@ -534,7 +534,7 @@ extern cvar_t r_shadows_throwdistance;
 extern cvar_t r_shadows_throwdirection;
 extern cvar_t r_shadows_focus;
 extern cvar_t r_shadows_shadowmapscale;
-
+extern cvar_t r_shadows_shadowmapbias;
 extern cvar_t r_transparent_alphatocoverage;
 extern cvar_t r_transparent_sortsurfacesbynearest;
 extern cvar_t r_transparent_useplanardistance;