diff --git a/include/light/light.hh b/include/light/light.hh index 640f7439..e96cba9d 100644 --- a/include/light/light.hh +++ b/include/light/light.hh @@ -430,7 +430,7 @@ public: setting_extra extra{ this, {"extra", "extra4"}, 1, &performance_group, "supersampling; 2x2 (extra) or 4x4 (extra4) respectively"}; setting_enum visapprox{ - this, "visapprox", visapprox_t::AUTO, { { "auto", visapprox_t::AUTO }, { "none", visapprox_t::NONE }, { "vis", visapprox_t::VIS }, { "rays", visapprox_t::RAYS } }, &debug_group, "change approximate visibility algorithm. auto = choose default based on format. vis = use BSP vis data. rays = use sphere culling with fired rays"}; + this, "visapprox", visapprox_t::AUTO, { { "auto", visapprox_t::AUTO }, { "none", visapprox_t::NONE }, { "vis", visapprox_t::VIS }, { "rays", visapprox_t::RAYS } }, &debug_group, "change approximate visibility algorithm. auto = choose default based on format. vis = use BSP vis data (slow but precise). rays = use sphere culling with fired rays (fast but may miss faces)"}; setting_func lit{this, "lit", [&]() { write_litfile |= lightfile::external; }, &output_group, "write .lit file"}; setting_func lit2{ this, "lit2", [&]() { write_litfile = lightfile::lit2; }, &experimental_group, "write .lit2 file"}; diff --git a/light/light.cc b/light/light.cc index fb8c9bc8..241082a0 100644 --- a/light/light.cc +++ b/light/light.cc @@ -1209,11 +1209,7 @@ int light_main(int argc, const char **argv) // check vis approx type if (options.visapprox.value() == visapprox_t::AUTO) { - if (bspdata.loadversion->game->id == GAME_QUAKE_II) { - options.visapprox.setValue(visapprox_t::VIS); - } else { - options.visapprox.setValue(visapprox_t::RAYS); - } + options.visapprox.setValue(visapprox_t::RAYS); } load_textures(&bsp); diff --git a/light/ltface.cc b/light/ltface.cc index 854e29f8..445cb179 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -2106,8 +2106,7 @@ LightFace_SurfaceLight(const mbsp_t *bsp, lightsurf_t *lightsurf, lightmapdict_t const qvec3d &lightsurf_pos = lightsurf->points[i]; const qvec3d &lightsurf_normal = lightsurf->normals[i]; - // Push 1 unit behind the surflight (fixes darkening near surflight face on neighbouring faces) - qvec3f pos = vpl.points[c] - vpl.surfnormal; + qvec3f pos = vpl.points[c]; qvec3f dir = lightsurf_pos - pos; float dist = qv::length(dir); @@ -2120,16 +2119,6 @@ LightFace_SurfaceLight(const mbsp_t *bsp, lightsurf_t *lightsurf, lightmapdict_t if (LightSample_Brightness(indirect) < 0.01f) // Each point contributes very little to the final result continue; - // Push 1 unit in front of the surflight, so embree can properly process it ... - pos = vpl.points[c] + vpl.surfnormal; - dir = lightsurf_pos - pos; - dist = qv::length(dir); - - if (dist == 0.0f) - dir = lightsurf_normal; - else - dir /= dist; - rs.pushRay(i, pos, dir, dist, &indirect); } diff --git a/light/surflight.cc b/light/surflight.cc index 72f19473..41ee42d2 100644 --- a/light/surflight.cc +++ b/light/surflight.cc @@ -71,7 +71,7 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys // Dice winding... vector points; - winding.dice(cfg.surflightsubdivision.value(), [&points](winding_t &w) { points.push_back(w.center()); }); + winding.dice(cfg.surflightsubdivision.value(), [&points, &facenormal](winding_t &w) { points.push_back(w.center() + facenormal); }); total_surflight_points += points.size(); // Calculate emit color and intensity... @@ -107,7 +107,7 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys surfacelight_t l; l.surfnormal = facenormal; l.omnidirectional = !is_directional; - l.points = points; + l.points = std::move(points); l.style = style; // Init bbox... @@ -115,11 +115,11 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys l.bounds = EstimateVisibleBoundsAtPoint(facemidpoint); } - for (auto &pt : points) { + for (auto &pt : l.points) { if (options.visapprox.value() == visapprox_t::VIS) { - l.leaves.push_back(Light_PointInLeaf(bsp, pt + l.surfnormal)); + l.leaves.push_back(Light_PointInLeaf(bsp, pt)); } else if (options.visapprox.value() == visapprox_t::RAYS) { - l.bounds += EstimateVisibleBoundsAtPoint(pt + l.surfnormal); + l.bounds += EstimateVisibleBoundsAtPoint(pt); } } @@ -127,7 +127,7 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys // Store surfacelight settings... l.totalintensity = intensity * facearea; - l.intensity = l.totalintensity / points.size(); + l.intensity = l.totalintensity / l.points.size(); l.color = texture_color.value(); // Store light...