float add;
float dist;
float addDeluxe = 0.0f, addDeluxeBounceScale = 0.25f;
- qboolean angledDeluxe = qfalse;
+ qboolean angledDeluxe = qtrue;
float colorBrightness;
+ qboolean doAddDeluxe = qtrue;
/* get light */
light = trace->light;
/* clear color */
+ trace->forceSubsampling = 0.0f; /* to make sure */
VectorClear( trace->color );
VectorClear( trace->colorNoShadow );
VectorClear( trace->directionContribution );
angle = DotProduct( trace->normal, trace->direction );
/* twosided lighting */
- if( trace->twoSided )
- angle = fabs( angle );
+ if( trace->twoSided && angle < 0 )
+ {
+ angle = -angle;
+
+ /* no deluxemap contribution from "other side" light */
+ doAddDeluxe = qfalse;
+ }
/* attenuate */
angle *= -DotProduct( light->normal, trace->direction );
return 0;
else if( angle < 0.0f &&
(trace->twoSided || (light->flags & LIGHT_TWOSIDED)) )
+ {
angle = -angle;
+ /* no deluxemap contribution from "other side" light */
+ doAddDeluxe = qfalse;
+ }
+
/* clamp the distance to prevent super hot spots */
dist = sqrt(dist * dist + light->extraDist * light->extraDist);
if( dist < 16.0f )
dist = SetupTrace( trace );
if( dist >= light->envelope )
return 0;
+
+ /* no deluxemap contribution from "other side" light */
+ doAddDeluxe = qfalse;
}
else
return 0;
}
+
+ /* also don't deluxe if the direction is on the wrong side */
+ if(DotProduct(trace->normal, trace->direction) < 0)
+ {
+ /* no deluxemap contribution from "other side" light */
+ doAddDeluxe = qfalse;
+ }
/* ydnar: moved to here */
add = factor * light->add;
float dot = DotProduct( trace->normal, trace->direction );
/* twosided lighting */
- if( trace->twoSided )
- dot = fabs( dot );
+ if( trace->twoSided && dot < 0 )
+ {
+ dot = -dot;
+
+ /* no deluxemap contribution from "other side" light */
+ doAddDeluxe = qfalse;
+ }
/* jal: optional half Lambert attenuation (http://developer.valvesoftware.com/wiki/Half_Lambert) */
if( lightAngleHL )
float dot = DotProduct( trace->normal, trace->direction );
/* twosided lighting */
- if( trace->twoSided )
- dot = fabs( dot );
+ if( trace->twoSided && dot < 0 )
+ {
+ dot = -dot;
+
+ /* no deluxemap contribution from "other side" light */
+ doAddDeluxe = qfalse;
+ }
/* jal: optional half Lambert attenuation (http://developer.valvesoftware.com/wiki/Half_Lambert) */
if( lightAngleHL )
{
/* trace */
TraceLine( trace );
+ trace->forceSubsampling *= add;
if( !(trace->compileFlags & C_SKY) || trace->opaque )
{
VectorClear( trace->color );
if( bouncing )
{
addDeluxe *= addDeluxeBounceScale;
+ /* better NOT increase it beyond the original value
if( addDeluxe < 0.00390625f )
addDeluxe = 0.00390625f;
+ */
}
- VectorScale( trace->direction, addDeluxe, trace->directionContribution );
+ if(doAddDeluxe)
+ {
+ VectorScale( trace->direction, addDeluxe, trace->directionContribution );
+ }
/* setup trace */
trace->testAll = qfalse;
/* raytrace */
TraceLine( trace );
+ trace->forceSubsampling *= add;
if( trace->passSolid || trace->opaque )
{
VectorClear( trace->color );
i++;
}
+ else if( !strcmp( argv[ i ], "-samplessearchboxsize" ) )
+ {
+ lightSamplesSearchBoxSize = atoi( argv[ i + 1 ] );
+ if( lightSamplesSearchBoxSize <= 0 )
+ lightSamplesSearchBoxSize = 1;
+ if( lightSamplesSearchBoxSize > 4 )
+ lightSamplesSearchBoxSize = 4; /* more makes no sense */
+ else if( lightSamplesSearchBoxSize != 1 )
+ Sys_Printf( "Adaptive supersampling uses %f times the normal search box size\n", lightSamplesSearchBoxSize );
+ i++;
+ }
+
else if( !strcmp( argv[ i ], "-filter" ) )
{
filter = qtrue;