Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions examples/src/examples/gaussian-splatting/lod-streaming.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,25 @@ assetListLoader.load(() => {
};

applyPreset();

// Start with lowest LOD only for fast initial load
const lodLevels = gs.resource?.octree?.lodLevels;
if (lodLevels) {
const worstLod = lodLevels - 1;
app.scene.gsplat.lodRangeMin = worstLod;
app.scene.gsplat.lodRangeMax = worstLod;
}

// When lowest LOD is fully loaded, switch to the normal quality range
const gsplatSystem = /** @type {any} */ (app.systems.gsplat);
const onFrameReady = (/** @type {any} */ camera, /** @type {any} */ layer, /** @type {boolean} */ ready, /** @type {number} */ loadingCount) => {
if (ready && loadingCount === 0) {
gsplatSystem.off('frame:ready', onFrameReady);
applyPreset();
}
};
gsplatSystem.on('frame:ready', onFrameReady);

data.on('lodPreset:set', applyPreset);

const applySplatBudget = () => {
Expand Down
7 changes: 7 additions & 0 deletions src/scene/gsplat-unified/gsplat-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,13 @@ class GSplatManager {
// fire frame:ready event
this.fireFrameReadyEvent();

// If event listeners dirtied params (e.g. changed LOD range), ensure LOD is re-evaluated
if (this.scene.gsplat.dirty) {
for (const [, inst] of this.octreeInstances) {
inst.needsLodUpdate = true;
}
}

// return the number of active splats for stats
return sortedState ? sortedState.totalActiveSplats : 0;
}
Expand Down