add support for fast bounce lighting, which is the same as the old code
This commit is contained in:
parent
e7ae158a10
commit
6345d6b616
|
|
@ -417,6 +417,7 @@ public:
|
|||
this, {"extra", "extra4"}, 1, &performance_group, "supersampling; 2x2 (extra) or 4x4 (extra4) respectively"};
|
||||
setting_extra bounceextra{
|
||||
this, {"bounceextra", "bounceextra4"}, 1, &performance_group, "bounce light supersampling; 2x2 (bounceextra) or 4x4 (bounceextra4) respectively"};
|
||||
setting_bool fastbounce{this, "fastbounce", false, &performance_group, "use one bounce point in the middle of each face. for fast compilation."};
|
||||
setting_enum<visapprox_t> visapprox{this, "visapprox", visapprox_t::AUTO,
|
||||
{{"auto", visapprox_t::AUTO}, {"none", visapprox_t::NONE}, {"vis", visapprox_t::VIS},
|
||||
{"rays", visapprox_t::RAYS}},
|
||||
|
|
|
|||
|
|
@ -179,10 +179,10 @@ static void MakeBounceLightsThread(const settings::worldspawn_keys &cfg, const m
|
|||
const vec_t bounce_step = light_options.extra.value() / light_options.bounceextra.value();
|
||||
// color divisor;
|
||||
// extra4 + (no bounce extra) = 16, since surf.points is 16x larger than vanilla
|
||||
const vec_t bounce_divisor = bounce_step * bounce_step;
|
||||
const vec_t bounce_divisor = light_options.fastbounce.value() ? 1 : (bounce_step * bounce_step);
|
||||
|
||||
const vec_t area_divisor = sqrt(area);
|
||||
const vec_t sample_divisor = (surf.points.size() / bounce_divisor) / (surf.vanilla_extents.width() * surf.vanilla_extents.height());
|
||||
const vec_t sample_divisor = (light_options.fastbounce.value() ? 1 : (surf.points.size() / bounce_divisor)) / (surf.vanilla_extents.width() * surf.vanilla_extents.height());
|
||||
|
||||
// average them, area weighted
|
||||
std::unordered_map<int, qvec3d> sum;
|
||||
|
|
@ -221,13 +221,19 @@ static void MakeBounceLightsThread(const settings::worldspawn_keys &cfg, const m
|
|||
|
||||
qplane3d faceplane = winding.plane();
|
||||
|
||||
area /= surf.points.size() / bounce_divisor;
|
||||
if (!light_options.fastbounce.value()) {
|
||||
area /= surf.points.size() / bounce_divisor;
|
||||
|
||||
for (vec_t x = 0; x < surf.width; x += bounce_step) {
|
||||
for (vec_t y = 0; y < surf.height; y += bounce_step) {
|
||||
auto &pt = surf.points[(y * surf.width) + x];
|
||||
AddBounceLight(pt, emitcolors, faceplane.normal, area, &face, bsp);
|
||||
for (vec_t x = 0; x < surf.width; x += bounce_step) {
|
||||
for (vec_t y = 0; y < surf.height; y += bounce_step) {
|
||||
auto &pt = surf.points[(y * surf.width) + x];
|
||||
AddBounceLight(pt, emitcolors, faceplane.normal, area, &face, bsp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
area /= surf.points.size();
|
||||
|
||||
AddBounceLight(surf.extents.origin, emitcolors, faceplane.normal, area, &face, bsp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue