GaussianSplats3D icon indicating copy to clipboard operation
GaussianSplats3D copied to clipboard

sortWork.js crashed when 'dynamicScene': true, with add-->remove-->add opterations. 'dynamicScene': false。 all be OK

Open nmgyaoyuan opened this issue 1 year ago • 0 comments

when i want read splat file and want rotate the splat scene, i found the bug(maybe).

code: gsViewer = new GaussianSplats3D.Viewer({ 'selfDrivenMode': false, 'useBuiltInControls': false, 'dynamicScene': true, 'renderer':renderer, 'camera':camera, 'threeScene':scene, 'sphericalHarmonicsDegree': 2, 'rootElement': splatContainer.value }); //--------------------------------------------------------------

/* ----copyed from demo code---*/ function runViewer(splatBufferData:ArrayBuffer, format:GaussianSplats3D.SceneFormat, alphaRemovalThreshold:number, sphericalHarmonicsDegree:number) { const splatBufferOptions = { 'splatAlphaRemovalThreshold': alphaRemovalThreshold }; const splatBufferPromise = fileBufferToSplatBuffer({data: splatBufferData}, format, alphaRemovalThreshold, 0, undefined, undefined, undefined, undefined, sphericalHarmonicsDegree );

splatBufferPromise.then((splatBuffer:GaussianSplats3D.splatBuffer) => {
    gsViewer.addSplatBuffers([splatBuffer], [splatBufferOptions])
    .then(() => {
        hasSplatInViewer=true;
        console.info('splat is added in viewer');
        emit('added',null);
    });
});

} //---------------------------------------------------------------------

use runViewer() to add splatFile , is OK. Then use removeSplatScene(0) remove a scene,is OK. and use runViewer() to add splat File again , crashed.

error info:

Uncaught RangeError: offset is out of bounds at Int32Array.set () at self.onmessage (8f7e31cd-0625-419e-9f13-6931e81b4dc9:95:11) self.onmessage @ 8f7e31cd-0625-419e-9f13-6931e81b4dc9:95 8f7e31cd-0625-419e-9f13-6931e81b4dc9:48 Uncaught RangeError: offset is out of bounds at Float32Array.set () at sort (8f7e31cd-0625-419e-9f13-6931e81b4dc9:48:59) at self.onmessage (8f7e31cd-0625-419e-9f13-6931e81b4dc9:123:7)

crashed code (2 places) : (1) ----> new Float32Array(wasmMemory, modelViewProjOffset, 16).set(modelViewProj); (2) ---->
if (e.data.centers) { centers = e.data.centers; sceneIndexes = e.data.sceneIndexes; if (integerBasedSort) { new Int32Array( wasmMemory, centersOffset + e.data.range.from * Constants2.BytesPerInt * 4, e.data.range.count * 4 ).set(new Int32Array(centers)); } else {

nmgyaoyuan avatar Oct 02 '24 10:10 nmgyaoyuan