kinda fix overbrightness? still needs work..
allow lmshift force on light
This commit is contained in:
parent
b30d200543
commit
2a70cafa32
|
|
@ -443,6 +443,7 @@ public:
|
|||
setting_bool nolights{this, "nolights", false, &output_group, "ignore light entities (only sunlight/minlight)"};
|
||||
setting_int32 facestyles{this, "facestyles", 4, &output_group, "max amount of styles per face; requires BSPX lump if > 4"};
|
||||
setting_bool exportobj{this, "exportobj", false, &output_group, "export an .OBJ for inspection"};
|
||||
setting_int32 lmshift{this, "lmshift", 4, &output_group, "force a specified lmshift to be applied to the entire map; this is useful if you want to re-light a map with higher quality BSPX lighting without the sources. Will add the LMSHIFT lump to the BSP."};
|
||||
|
||||
inline void CheckNoDebugModeSet()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -169,7 +169,9 @@ static void MakeBounceLightsThread(const settings::worldspawn_keys &cfg, const m
|
|||
return;
|
||||
}
|
||||
|
||||
const vec_t sample_scalar = 1.f / sqrt(area) / (options.extra.value() * options.extra.value()) * (surf.lightmapscale / 16.0);
|
||||
const vec_t sample_divisor = sqrt(area);
|
||||
const vec_t extra_divisor = (options.extra.value() * options.extra.value());
|
||||
const vec_t lmscale_divisor = (16.0 / surf.lightmapscale);
|
||||
|
||||
qplane3d faceplane = winding.plane();
|
||||
|
||||
|
|
@ -188,7 +190,9 @@ static void MakeBounceLightsThread(const settings::worldspawn_keys &cfg, const m
|
|||
qvec3d total = {};
|
||||
|
||||
for (auto &styleColor : sum) {
|
||||
styleColor.second *= sample_scalar;
|
||||
styleColor.second /= sample_divisor;
|
||||
styleColor.second /= extra_divisor;
|
||||
styleColor.second /= lmscale_divisor;
|
||||
styleColor.second *= cfg.bouncescale.value();
|
||||
total += styleColor.second;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -527,6 +527,17 @@ static void LightWorld(bspdata_t *bspdata, bool forcedscale)
|
|||
|
||||
if (forcedscale) {
|
||||
bspdata->bspx.entries.erase("LMSHIFT");
|
||||
} else if (options.lmshift.isChanged()) {
|
||||
// if we forcefully specified an lmshift lump, we have to generate one.
|
||||
bspdata->bspx.entries.erase("LMSHIFT");
|
||||
|
||||
std::vector<uint8_t> shifts(bsp.dfaces.size());
|
||||
|
||||
for (auto &shift : shifts) {
|
||||
shift = options.lmshift.value();
|
||||
}
|
||||
|
||||
bspdata->bspx.transfer("LMSHIFT", shifts);
|
||||
}
|
||||
|
||||
auto lmshift_lump = bspdata->bspx.entries.find("LMSHIFT");
|
||||
|
|
|
|||
Loading…
Reference in New Issue