mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
Phase 3B: per-instance LOD via meshoptimizer simplifySloppy
Decimate each unique mesh once at sidecar-build time and swap to the reduced index slice per-instance per-frame when projected sphere radius drops below IFC_LOD1_PX (default 30). Same VBO, same SSBO, just a different firstIndex/count in the indirect command. Extends MeshInfo (48→56 B) with lod1_ebo_byte_offset + lod1_index_count and bumps the sidecar to v5. buildLods() runs inside onStreamingFinished, appends decimated indices to sd.indices, applyLodExtension pushes the EBO suffix to the live GPU state, and the sidecar is written with LOD1 baked in. simplifySloppy (voxel clustering) is used instead of the default edge-collapse meshopt_simplify because BIM brep output is per-triangle- unwelded and non-manifold after welding — simplify returned the input unchanged for every mesh tested. Sloppy ignores topology. Knobs (IFC_LOD_SLOPPY, IFC_LOD_ERROR, IFC_LOD_RATIO, IFC_LOD_MIN_SAVINGS, IFC_LOD_LOCK_BORDER, IFC_LOD_DEBUG) are available for A/B tuning. Result on the 128M-tri 10-model test scene (GTX 1650, 2px contribution cull): 20.2 → 43.2 fps, 40M → 14M visible triangles, no change in object count. LOD build adds 100–600 ms per model on first open, cached thereafter. README Phase 3B section is now a full writeup of pipeline, selection, decimator-choice rationale, env vars, and measured numbers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "MainWindow.h"
|
||||
#include "AppSettings.h"
|
||||
#include "SettingsWindow.h"
|
||||
#include "LodBuilder.h"
|
||||
#include "SidecarCache.h"
|
||||
|
||||
#include <QApplication>
|
||||
@@ -395,6 +396,19 @@ void MainWindow::onStreamingFinished() {
|
||||
sd.elements.push_back(pe);
|
||||
}
|
||||
|
||||
// Build LOD1 for eligible meshes (extends sd.indices and
|
||||
// populates MeshInfo::lod1_*), push the extension onto the
|
||||
// live GPU state so this session benefits too, then cache.
|
||||
QElapsedTimer t_lod; t_lod.start();
|
||||
buildLods(sd);
|
||||
LodStats ls = summariseLods(sd);
|
||||
qDebug(" LOD build: %lld ms — %u/%u meshes got LOD1 "
|
||||
"(%u tris → %u tris for those meshes)",
|
||||
t_lod.elapsed(),
|
||||
ls.meshes_with_lod1, ls.meshes_total,
|
||||
ls.tris_lod0_for_lod1, ls.tris_lod1);
|
||||
viewport_->applyLodExtension(loading_model_id_, sd);
|
||||
|
||||
std::string ifc_path = it->second.file_path.toStdString();
|
||||
uint64_t file_size = static_cast<uint64_t>(
|
||||
QFileInfo(it->second.file_path).size());
|
||||
|
||||
Reference in New Issue
Block a user