mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-25 06:02:49 +00:00
feat(ugc): settings for the ray tracer, hidden-face method and denoising
New UGC settings (ugcconfig.ini and the dashboard's settings page):
- ray_backend: builtin (default), embree or hiprt (falls back to embree when
the build or machine can't); the hidden faces' paths and the occlusion rays
- hsr_method: toolbox (default, LU Toolbox's paths) or fast (the renders from
around the model), and hsr_fast_resolution (1024) for the fast one
- denoise: off (default) or oidn (icons; off until a build has it)
UgcProcessOptions (dCommon/UgcKeys.h) names the choices for everything that
passes them on ("embree fast oidn", any order, left out: the setting's).
UgcJobs::ApplyOptions puts a choice over the settings and MadeWith says what a
make used after fallbacks; a made model's stats.json records it (rays,
hsrMethod, denoise). UgcServer --make-model and --make-modular take the
choices after the folder and print the CPU time and what made it.
Check: the defaults make the same files as before; the settings page shows the
four settings under UGC; UgcServer --make-model model.lxfml out embree fast.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -169,6 +169,18 @@ namespace UgcJobs {
|
||||
return parsed.dump();
|
||||
}
|
||||
|
||||
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 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)) };
|
||||
}
|
||||
|
||||
Outcome ProcessModel(const std::string& blob, UgcBricks::BrickLibrary& library, const Settings& settings, uint64_t seed, const UgcIconParams::Values& iconValues) {
|
||||
Outcome outcome;
|
||||
const auto started = std::chrono::steady_clock::now();
|
||||
@@ -355,6 +367,12 @@ namespace UgcJobs {
|
||||
{ "removeHiddenFaces", settings.hsr.enabled }, { "groundPlane", settings.hsr.groundPlane }, { "hsrSamples", settings.hsr.samples },
|
||||
{ "hsrBounces", settings.hsr.bounces }, { "hsrSampleSpacing", settings.hsr.spacing }, { "hsrMinPoints", settings.hsr.minPoints },
|
||||
{ "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;
|
||||
outcome.ok = true;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "UgcBricks.h"
|
||||
#include "UgcHsr.h"
|
||||
#include "UgcIconParams.h"
|
||||
#include "UgcKeys.h"
|
||||
#include "UgcRender.h"
|
||||
#include "UgcStorage.h"
|
||||
|
||||
@@ -64,6 +65,17 @@ namespace UgcJobs {
|
||||
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'.
|
||||
*/
|
||||
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")
|
||||
UgcProcessOptions::Choice MadeWith(const Settings& settings);
|
||||
|
||||
struct Outcome {
|
||||
bool ok{};
|
||||
std::string error; // why it failed
|
||||
@@ -72,6 +84,7 @@ namespace UgcJobs {
|
||||
bool aoBaked{};
|
||||
bool empty{}; // nothing to make (no bricks): not a failure
|
||||
std::string stats; // stats.json: bricks, triangles before and after per LOD, timings
|
||||
std::string options; // players' models: what made them (MadeWith, as UgcProcessOptions::ToString)
|
||||
};
|
||||
|
||||
// The client's download of `data` (`name` + ".gz" and ".checksum") added to `files`
|
||||
|
||||
Reference in New Issue
Block a user