light: bounce: force a "gate" like cutoff for bounce lights

This commit is contained in:
Eric Wasylishen 2016-04-28 23:18:49 -06:00
parent 430c4b39b7
commit 6459e53316
1 changed files with 19 additions and 15 deletions

View File

@ -1016,25 +1016,29 @@ void GetIndirectLighting (const bsp2_t *bsp, const bsp2_dface_t *face, const vec
if (dp2 < 0) if (dp2 < 0)
continue; // vpl behind sample face continue; // vpl behind sample face
// get light contribution
vec3_t color;
VectorScale(vpl.color, vpl.area, color);
// clamp away hotspots
if (dist < 128) {
dist = 128;
}
const vec_t dist2 = (dist * dist);
const vec_t scale = dp1 /* * dp2 */ * (1.0/dist2) * bouncescale;
// dp2 makes things too angle-dependent
VectorScale(color, 255 * scale, color);
if (((color[0] + color[1] + color[2]) / 3) < 0.25)
continue; // too dim
if (TestLight(vpl.pos, origin, NULL)) { if (TestLight(vpl.pos, origin, NULL)) {
vec3_t color; VectorAdd(colorout, color, colorout);
VectorScale(vpl.color, vpl.area, color);
// clamp away hotspots
if (dist < 128) {
dist = 128;
}
const vec_t dist2 = (dist * dist);
const vec_t scale = dp1 /* * dp2 */ * (1.0/dist2) * bouncescale;
// dp2 makes things too angle-dependent
// no occlusion
VectorMA(colorout, scale, color, colorout);
} }
} }
VectorScale(colorout, 255, colorout);
return; return;
} }