mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +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:
@@ -495,15 +495,10 @@ namespace {
|
||||
c.Add(Text(UGC, "satin_colors", "Satin colors", "Satin (opal) color ids, comma separated: they stay transparent plastic (the client has no satin shader) but are made milky and less see-through. By default LEGO's satin colors 360,362,363,364,365,366,367,376 (none: off)." + notLive, "360,362,363,364,365,366,367,376"));
|
||||
c.Add(Float(UGC, "satin_opacity", "Satin opacity", "Percent: the opacity of transparent satin bricks, instead of the transparent opacity.", "75", 0, 100));
|
||||
c.Add(Float(UGC, "satin_whiten", "Satin whitening", "Percent: how far satin colors go towards white.", "20", 0, 100));
|
||||
c.Add(Bool(UGC, "remove_hidden_faces", "Remove faces nobody can see", "LU Toolbox's Remove Hidden Faces: paths are traced from points on each opaque triangle, bouncing off the model; a triangle none of whose paths reaches the sky is removed.", true));
|
||||
c.Add(Bool(UGC, "hsr_ground_plane", "Nothing seen from below", "Also removes what can only be seen from under the model (a black ground under LDD's floor).", false));
|
||||
c.Add(Int(UGC, "hsr_samples", "Paths per point", "Paths traced from each point on a triangle (LU Toolbox's Samples). More finds more faces seen only through small gaps; slower.", "8", 1, 256));
|
||||
c.Add(Int(UGC, "hsr_bounces", "Path bounces", "Bounces a path may take off the model before it gives up (Cycles' Max Bounces in LU Toolbox's bake).", "8", 0, 64));
|
||||
c.Add(Float(UGC, "hsr_sample_spacing", "Point spacing", "Distance between the points paths start from, in LDD units (a stud is 0.8; 0.1143 puts 7 x 7 points on a stud-sized square). Smaller finds smaller visible parts of big faces; slower.", "0.1143", 0.01, 10));
|
||||
c.Add(Int(UGC, "hsr_min_points", "Points per triangle at least", "Small triangles get this many points however close together (LU Toolbox bakes 28 texels for every triangle). Lower is faster but removes more faces that are only just seen.", "28", 1, 4096));
|
||||
c.Add(Labels(Choice(UGC, "hsr_method", "How hidden faces are found", "toolbox: LU Toolbox's paths (above). fast: the model rendered from 42 directions around it, removing what shows in none; much faster, but it also removes faces seen only by bounced light (insides seen through openings, recesses). Staff can pick another for one make when making models again.", "toolbox", { "toolbox", "fast" }), { "LU Toolbox (paths)", "Fast (renders from around)" }));
|
||||
c.Add(Unit(Int(UGC, "hsr_fast_resolution", "Fast method's render size", "The size of each of the fast method's 42 renders; bigger keeps smaller visible faces.", "1024", 64, 4096), "pixels"));
|
||||
c.Add(Labels(Choice(UGC, "ray_backend", "Ray tracer", "What traces the rays of the hidden faces' paths and of the occlusion: builtin (the UGC server's own), embree (Intel Embree on the CPU) or hiprt (the GPU, when the server was built with it and has one; else embree). They give the same results but for rounding. Staff can pick another for one make when making models again.", "builtin", { "builtin", "embree", "hiprt" }), { "Built in", "Embree (CPU)", "HIPRT (GPU)" }));
|
||||
c.Add(Bool(UGC, "remove_hidden_faces", "Remove faces nobody can see", "The opaque bricks are rendered from 42 directions around the model; the triangles that show in none are removed. Faces seen only through openings or by bounced light go too.", true));
|
||||
c.Add(Bool(UGC, "hsr_ground_plane", "Nothing seen from below", "Also removes what can only be seen from under the model.", false));
|
||||
c.Add(Unit(Int(UGC, "hsr_resolution", "Detail of the visibility renders", "The size of each of the 42 renders; bigger keeps smaller visible faces.", "1024", 64, 4096), "pixels"));
|
||||
c.Add(Labels(Choice(UGC, "ray_backend", "Ray tracer", "What traces the occlusion rays: builtin (the UGC server's own), embree (Intel Embree on the CPU) or hiprt (the GPU, when the server was built with it and has one; else embree). They give the same results but for rounding. Staff can pick another for one make when making models again.", "builtin", { "builtin", "embree", "hiprt" }), { "Built in", "Embree (CPU)", "HIPRT (GPU)" }));
|
||||
c.Add(Int(UGC, "hiprt_device", "GPU for HIPRT", "Which GPU the hiprt ray tracer uses: 0 is the first HIP (AMD) or CUDA (NVIDIA) device.", "0", 0, 16, true));
|
||||
c.Add(Labels(Choice(UGC, "denoise", "Denoise icons", "oidn (when the server was built with Intel Open Image Denoise; else off): a model's icon is drawn from its colors before the occlusion bake, with its occlusion traced per pixel with a few rays and the noise removed by the denoiser, instead of the baked occlusion. The model itself keeps its baked occlusion (a denoiser only works on images).", "off", { "off", "oidn" }), { "Off", "Open Image Denoise" }));
|
||||
c.Add(Int(UGC, "denoise_samples", "Denoised occlusion rays per pixel", "Occlusion rays traced from each pixel of a denoised icon (before it is scaled down, so 16 times as many per icon pixel); fewer is faster and noisier.", "4", 1, 256));
|
||||
|
||||
@@ -477,8 +477,8 @@ namespace UgcRoutes {
|
||||
{ "triangles", average(summary.triangles) },
|
||||
{ "removed", summary.trianglesBefore > 0 ? 1.0 - static_cast<double>(summary.triangles) / static_cast<double>(summary.trianglesBefore) : 0.0 } });
|
||||
}
|
||||
JsonSuccess(reply, { { "choices", { { "rays", names(UgcProcessOptions::RAYS) }, { "hsr", names(UgcProcessOptions::HSR) }, { "denoise", names(UgcProcessOptions::DENOISE) } } },
|
||||
{ "defaults", { { "rays", UgcSetting("ray_backend").value_or("builtin") }, { "hsr", UgcSetting("hsr_method").value_or("toolbox") },
|
||||
JsonSuccess(reply, { { "choices", { { "rays", names(UgcProcessOptions::RAYS) }, { "denoise", names(UgcProcessOptions::DENOISE) } } },
|
||||
{ "defaults", { { "rays", UgcSetting("ray_backend").value_or("builtin") },
|
||||
{ "denoise", UgcSetting("denoise").value_or("off") } } },
|
||||
{ "combinations", combos }, { "canManage", Can(context, "ugc_manage") } });
|
||||
});
|
||||
@@ -772,7 +772,7 @@ namespace UgcRoutes {
|
||||
|
||||
Route(eHTTPMethod::POST, "/api/ugc/reprocess", Perm("ugc_manage"),
|
||||
"Have the UGC server make items again. Body: {kind: model|modular, id} for one, {kind: model, property} for every model placed on a property, {kind, failedOnly: true} for the failed ones, {kind} for all; "
|
||||
"models: options (processing options for this make, e.g. \"embree fast oidn\": ray backend, hidden-face method, denoising; left out: the UGC settings')",
|
||||
"models: options (processing options for this make, e.g. \"embree oidn\": ray backend, denoising; left out: the UGC settings')",
|
||||
[](HTTPReply& reply, const HTTPContext& context) {
|
||||
const auto body = ParseBody(context);
|
||||
if (!body) return JsonError(reply, eHTTPStatusCode::BAD_REQUEST, "Invalid JSON");
|
||||
|
||||
@@ -130,9 +130,9 @@
|
||||
if (!i.processedAt) return '';
|
||||
return fmt.unix(i.processedAt) + (costText(i) ? ' \u00b7 ' + costText(i) : '') + (i.madeOptions ? ' \u00b7 with ' + i.madeOptions : '');
|
||||
}
|
||||
// The processing options picked for Make again (ray tracer, hidden faces, denoise), as /api/ugc/reprocess takes them
|
||||
// The processing options picked for Make again (ray tracer, denoise), as /api/ugc/reprocess takes them
|
||||
function remakeOptions() {
|
||||
return ['optRays', 'optHsr', 'optDenoise'].map(function (x) { return $(x).value; }).filter(Boolean).join(' ');
|
||||
return ['optRays', 'optDenoise'].map(function (x) { return $(x).value; }).filter(Boolean).join(' ');
|
||||
}
|
||||
// A model's file as the player named it: its name with the upload's extension (".lxfml"), else the upload's name
|
||||
function fileName(i) {
|
||||
@@ -727,11 +727,11 @@
|
||||
|
||||
// ---- processing options: Make again's choices and the comparison of what made the models ----
|
||||
|
||||
var OPTION_LABELS = { builtin: 'Built in', embree: 'Embree (CPU)', hiprt: 'HIPRT (GPU)', toolbox: 'LU Toolbox (paths)', fast: 'Fast (renders)', off: 'Off', oidn: 'Open Image Denoise' };
|
||||
var OPTION_LABELS = { builtin: 'Built in', embree: 'Embree (CPU)', hiprt: 'HIPRT (GPU)', off: 'Off', oidn: 'Open Image Denoise' };
|
||||
function loadOptions() {
|
||||
return api.get('/api/ugc/options').then(function (d) {
|
||||
if (!d.success) throw new Error(d.error || 'Failed');
|
||||
[['optRays', 'rays', 'Ray tracer'], ['optHsr', 'hsr', 'Hidden faces'], ['optDenoise', 'denoise', 'Denoise']].forEach(function (x) {
|
||||
[['optRays', 'rays', 'Ray tracer'], ['optDenoise', 'denoise', 'Denoise']].forEach(function (x) {
|
||||
var select = $(x[0]), chosen = select.value;
|
||||
select.innerHTML = '<option value="">' + esc(x[2]) + ': settings (' + esc(OPTION_LABELS[d.defaults[x[1]]] || d.defaults[x[1]]) + ')</option>' +
|
||||
d.choices[x[1]].map(function (name) { return '<option value="' + esc(name) + '">' + esc(x[2]) + ': ' + esc(OPTION_LABELS[name] || name) + '</option>'; }).join('');
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
<details class="card mb-3" id="optionsCard">
|
||||
<summary class="card-header py-2 small fw-semibold">Processing options compared</summary>
|
||||
<div class="card-body py-2 small">
|
||||
<p class="text-body-secondary mb-2">The ways of making models to compare: the ray tracer (built in, Embree on the CPU, HIPRT on the GPU), how
|
||||
hidden faces are found (LU Toolbox's paths, or fast renders from around the model) and denoising of icons. The settings pick the
|
||||
defaults; <b>Make again</b> can use others for a make (the options next to it, or <code>/reprocessproperty embree fast</code> in game).
|
||||
<p class="text-body-secondary mb-2">The ways of making models to compare: the ray tracer of the occlusion (built in, Embree on the CPU,
|
||||
HIPRT on the GPU) and denoising of icons. The settings pick the defaults; <b>Make again</b> can use others for a make (the options next
|
||||
to it, or <code>/reprocessproperty embree oidn</code> in game).
|
||||
Every make is counted under what made it: the averages per make below, each model's in the List view's Options column.</p>
|
||||
<div class="table-responsive"><table class="table table-sm align-middle mb-0" id="optionsTable">
|
||||
<thead><tr><th>Options</th><th>Makes</th><th>Models</th><th>Took</th><th>CPU</th><th>Hidden faces</th><th>Occlusion</th><th>Icon</th><th>Bricks</th><th>Triangles removed</th></tr></thead>
|
||||
@@ -83,7 +83,6 @@
|
||||
<div class="ms-auto d-none d-flex flex-wrap gap-1 align-items-center" id="manageButtons">
|
||||
<span class="d-flex gap-1" id="remakeOptions" title="How Make again makes models (the settings' way unless picked here)">
|
||||
<select class="form-select form-select-sm w-auto" id="optRays" aria-label="Ray tracer for Make again"><option value="">Ray tracer: settings</option></select>
|
||||
<select class="form-select form-select-sm w-auto" id="optHsr" aria-label="Hidden faces for Make again"><option value="">Hidden faces: settings</option></select>
|
||||
<select class="form-select form-select-sm w-auto" id="optDenoise" aria-label="Denoise for Make again"><option value="">Denoise: settings</option></select>
|
||||
</span>
|
||||
<button type="button" class="btn btn-sm btn-outline-warning" id="retryFailed">Try the failed ones again</button>
|
||||
|
||||
Reference in New Issue
Block a user