mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-18 18:52:48 +00:00
refactor(ugc): remove the path traced hidden-face method; the renders are the only one
The path tracer that imitated LU Toolbox's Remove Hidden Faces took 17 to 100 times as long as the renders from 42 directions around the model, too heavy to use. It goes with its settings (hsr_method, hsr_samples, hsr_bounces, hsr_sample_spacing, hsr_min_points), its side by side tracing for GPUs and its tests. The renders (UgcRender::VisibleFromAround) remove hidden faces as before that method existed; their size is hsr_resolution (1024), and the memory estimate counts their buffers again. The hidden-face method is no longer a processing option: the dashboard's picker, /reprocessproperty and --make-model take only the ray backend (the occlusion's) and denoising. Options stored before (made_options, process_options, ugc_process_runs, --make-model arguments) that name toolbox or fast still parse; the word is skipped. Check: the settings page has no hsr_method or path settings and has hsr_resolution; /reprocessproperty embree toolbox still works (toolbox ignored); models made with the defaults keep their hashes (UGC tests). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,12 +54,12 @@ namespace UgcJobs {
|
||||
}
|
||||
|
||||
uint64_t EstimateMemory(size_t parts, const Settings& settings) {
|
||||
// Measured: the icon's buffers, and per brick its mesh in each LOD (positions, normals, colors, indices,
|
||||
// the occlusion tree and copies made along the way), about 40 KB at LOD 0, and the hidden faces' ray tree
|
||||
// (about 60 bytes a triangle, one LOD at a time)
|
||||
// Measured: the renders' buffers, and per brick its mesh in each LOD (positions, normals, colors, indices,
|
||||
// the occlusion tree and copies made along the way), about 40 KB at LOD 0
|
||||
const uint64_t resolution = static_cast<uint64_t>(std::clamp(settings.hsr.resolution, 64, 4096));
|
||||
const uint64_t icon = static_cast<uint64_t>(settings.icon.size) * settings.icon.supersample;
|
||||
const uint64_t fixed = icon * icon * 20 + 1024 * 1024 * 4 + 16 * 1024 * 1024;
|
||||
return fixed + static_cast<uint64_t>(parts) * (40 * 1024 * (1 + settings.lods.size()) + 16 * 1024);
|
||||
const uint64_t fixed = resolution * resolution * 8 + icon * icon * 20 + 1024 * 1024 * 4 + 16 * 1024 * 1024;
|
||||
return fixed + static_cast<uint64_t>(parts) * 40 * 1024 * (1 + settings.lods.size());
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -177,15 +177,13 @@ namespace UgcJobs {
|
||||
}
|
||||
|
||||
void ApplyOptions(Settings& settings, const UgcProcessOptions::Choice& choice) {
|
||||
if (const auto rays = UgcRays::Parse(choice.rays)) settings.hsr.rays = settings.ao.rays = settings.icon.ao.rays = *rays;
|
||||
if (const auto method = UgcHsr::Parse(choice.hsr)) settings.hsr.method = *method;
|
||||
if (const auto rays = UgcRays::Parse(choice.rays)) settings.ao.rays = settings.icon.ao.rays = *rays;
|
||||
if (const auto denoise = UgcRender::ParseDenoise(choice.denoise)) settings.icon.denoise = *denoise;
|
||||
}
|
||||
|
||||
UgcProcessOptions::Choice MadeWith(const Settings& settings) {
|
||||
const auto denoise = UgcRender::Available(settings.icon.denoise) ? settings.icon.denoise : UgcRender::eDenoise::OFF;
|
||||
return { std::string(UgcRays::Name(UgcRays::Resolve(settings.hsr.rays))), std::string(UgcHsr::Name(settings.hsr.method)),
|
||||
std::string(UgcRender::Name(denoise)) };
|
||||
return { std::string(UgcRays::Name(UgcRays::Resolve(settings.ao.rays))), std::string(UgcRender::Name(denoise)) };
|
||||
}
|
||||
|
||||
Outcome ProcessModel(const std::string& blob, UgcBricks::BrickLibrary& library, const Settings& settings, uint64_t seed, const UgcIconParams::Values& iconValues) {
|
||||
@@ -257,9 +255,7 @@ namespace UgcJobs {
|
||||
nlohmann::json entry{ { "lod", lods[i] }, { "near", ranges[i].first }, { "far", ranges[i].second },
|
||||
{ "opaqueBefore", model.opaque.TriangleCount() }, { "transparent", model.transparent.TriangleCount() } };
|
||||
step = std::chrono::steady_clock::now();
|
||||
auto hsr = settings.hsr;
|
||||
hsr.seed = seed;
|
||||
const auto optimized = UgcHsr::RemoveHiddenFaces(model, hsr);
|
||||
const auto optimized = UgcHsr::RemoveHiddenFaces(model, settings.hsr);
|
||||
hsrMs += Since(step);
|
||||
if (i == 0 && optimized.trianglesRemoved > 0) {
|
||||
if (!outcome.note.empty()) outcome.note += "; ";
|
||||
@@ -373,14 +369,11 @@ namespace UgcJobs {
|
||||
{ "icon", std::lround(iconMs) }, { "total", std::lround(Since(started)) } };
|
||||
stats["settings"] = { { "palette", settings.build.palette == UgcModel::ePalette::LU_TOOLBOX ? "lu_toolbox" : "brickdb" },
|
||||
{ "colorVariation", settings.build.colorVariation }, { "transparentOpacity", settings.build.transparentOpacity },
|
||||
{ "removeHiddenFaces", settings.hsr.enabled }, { "groundPlane", settings.hsr.groundPlane }, { "hsrSamples", settings.hsr.samples },
|
||||
{ "hsrBounces", settings.hsr.bounces }, { "hsrSampleSpacing", settings.hsr.spacing }, { "hsrMinPoints", settings.hsr.minPoints },
|
||||
{ "removeHiddenFaces", settings.hsr.enabled }, { "groundPlane", settings.hsr.groundPlane }, { "hsrResolution", settings.hsr.resolution },
|
||||
{ "ao", settings.ao.enabled }, { "aoDistance", settings.ao.distance }, { "aoSamples", settings.ao.samples }, { "aoStrength", settings.ao.strength } };
|
||||
const auto madeWith = MadeWith(settings);
|
||||
stats["settings"]["rays"] = madeWith.rays;
|
||||
stats["settings"]["hsrMethod"] = madeWith.hsr;
|
||||
stats["settings"]["denoise"] = madeWith.denoise;
|
||||
if (settings.hsr.method == UgcHsr::eMethod::FAST) stats["settings"]["hsrFastResolution"] = settings.hsr.fastResolution;
|
||||
outcome.options = UgcProcessOptions::ToString(madeWith);
|
||||
outcome.stats = stats.dump();
|
||||
outcome.files["stats.json"] = outcome.stats;
|
||||
|
||||
@@ -59,21 +59,20 @@ namespace UgcJobs {
|
||||
std::string shaderOpaque{ "01" }; // S<shader>_Opaque_...; transparent shapes are always S01
|
||||
bool combineTransparent{ false }; // one shape for all transparent bricks, else one per brick (Combine Transparent)
|
||||
Shaders shaders; // metal and glow groups (all off by default)
|
||||
UgcHsr::Options hsr; // hidden surface removal (Remove Hidden Faces)
|
||||
UgcHsr::Options hsr; // hidden surface removal
|
||||
UgcRender::AoOptions ao; // Bake Lighting (AO Only)
|
||||
UgcRender::IconOptions icon; // from the icon_* settings (UgcIconParams); presets and overrides go over it
|
||||
uint32_t maxBricks{}; // a model with more fails; 0: no limit
|
||||
};
|
||||
|
||||
/**
|
||||
* The processing options (UgcProcessOptions) staff picked for one make, over the settings: ray backend (the hidden
|
||||
* faces' paths and the occlusion rays, the icon's too), hidden-face method and denoising. Choices left empty keep
|
||||
* the settings'.
|
||||
* The processing options (UgcProcessOptions) staff picked for one make, over the settings: ray backend (the
|
||||
* occlusion rays, the icon's too) and denoising. Choices left empty keep the settings'.
|
||||
*/
|
||||
void ApplyOptions(Settings& settings, const UgcProcessOptions::Choice& choice);
|
||||
|
||||
// What the settings make with, as it is used: the ray backend after its fallback (UgcRays::Resolve), off for a
|
||||
// denoiser the build doesn't have; every choice filled ("embree toolbox off")
|
||||
// denoiser the build doesn't have; every choice filled ("embree off")
|
||||
UgcProcessOptions::Choice MadeWith(const Settings& settings);
|
||||
|
||||
struct Outcome {
|
||||
|
||||
Reference in New Issue
Block a user