force subsampling only where REALLY needed

This commit is contained in:
Rudolf Polzer 2010-09-22 08:49:43 +02:00
parent 382e2da9a0
commit c13784bc3a
4 changed files with 7 additions and 5 deletions

View File

@ -758,7 +758,7 @@ int LightContributionToSample( trace_t *trace )
light = trace->light; light = trace->light;
/* clear color */ /* clear color */
trace->forceSubsampling = qfalse; /* to make sure */ trace->forceSubsampling = 0.0f; /* to make sure */
VectorClear( trace->color ); VectorClear( trace->color );
VectorClear( trace->colorNoShadow ); VectorClear( trace->colorNoShadow );
VectorClear( trace->directionContribution ); VectorClear( trace->directionContribution );
@ -1091,6 +1091,7 @@ int LightContributionToSample( trace_t *trace )
{ {
/* trace */ /* trace */
TraceLine( trace ); TraceLine( trace );
trace->forceSubsampling *= add;
if( !(trace->compileFlags & C_SKY) || trace->opaque ) if( !(trace->compileFlags & C_SKY) || trace->opaque )
{ {
VectorClear( trace->color ); VectorClear( trace->color );
@ -1145,6 +1146,7 @@ int LightContributionToSample( trace_t *trace )
/* raytrace */ /* raytrace */
TraceLine( trace ); TraceLine( trace );
trace->forceSubsampling *= add;
if( trace->passSolid || trace->opaque ) if( trace->passSolid || trace->opaque )
{ {
VectorClear( trace->color ); VectorClear( trace->color );

View File

@ -1513,7 +1513,7 @@ qboolean TraceTriangle( traceInfo_t *ti, traceTriangle_t *tt, trace_t *trace )
} }
/* force subsampling because the lighting is texture dependent */ /* force subsampling because the lighting is texture dependent */
trace->forceSubsampling = qtrue; trace->forceSubsampling = 1.0;
/* try to avoid double shadows near triangle seams */ /* try to avoid double shadows near triangle seams */
if( u < -ASLF_EPSILON || u > (1.0f + ASLF_EPSILON) || if( u < -ASLF_EPSILON || u > (1.0f + ASLF_EPSILON) ||

View File

@ -1817,7 +1817,7 @@ static void SubsampleRawLuxel_r( rawLightmap_t *lm, trace_t *trace, vec3_t sampl
/* sample light */ /* sample light */
LightContributionToSample( trace ); LightContributionToSample( trace );
if(trace->forceSubsampling) if(trace->forceSubsampling > 1.0f)
{ {
/* alphashadow: we subsample as deep as we can */ /* alphashadow: we subsample as deep as we can */
++lighted; ++lighted;
@ -2152,7 +2152,7 @@ void IlluminateRawLightmap( int rawLightmapNum )
VectorAdd( deluxel, trace.directionContribution, deluxel ); VectorAdd( deluxel, trace.directionContribution, deluxel );
/* check for evilness */ /* check for evilness */
if(trace.forceSubsampling && lightSamples > 1 && luxelFilterRadius == 0) if(trace.forceSubsampling > 1.0f && lightSamples > 1 && luxelFilterRadius == 0)
{ {
totalLighted++; totalLighted++;
*flag |= FLAG_FORCE_SUBSAMPLING; /* force */ *flag |= FLAG_FORCE_SUBSAMPLING; /* force */

View File

@ -1363,7 +1363,7 @@ typedef struct
int compileFlags; /* for determining surface compile flags traced through */ int compileFlags; /* for determining surface compile flags traced through */
qboolean passSolid; qboolean passSolid;
qboolean opaque; qboolean opaque;
qboolean forceSubsampling; /* needs subsampling (alphashadow) */ vec_t forceSubsampling; /* needs subsampling (alphashadow), value = max color contribution possible from it */
/* working data */ /* working data */
int numTestNodes; int numTestNodes;