From: vortex Date: Mon, 17 Sep 2012 13:58:17 +0000 (+0000) Subject: New cvar r_shadows_shadowmapbias to customize bias of fake shadows. Default is -1... X-Git-Tag: xonotic-v0.8.0~96^2~194 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7a800fde0a7beb1425e8cc5534eacdd9424fa591;p=xonotic%2Fdarkplaces.git New cvar r_shadows_shadowmapbias to customize bias of fake shadows. Default is -1 - use r_shadow_shadowmapping_bias. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11844 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index 9aeff996..a242ce91 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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); diff --git a/r_shadow.c b/r_shadow.c index f8c6557d..fc53553d 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -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; diff --git a/render.h b/render.h index 998739fb..af17eb92 100644 --- 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;