mkkellogg / GaussianSplats3D

Three.js-based implementation of 3D Gaussian splatting
MIT License
1.37k stars 168 forks source link

Can we dynamically swap PLY files #270

Closed lucylucy27 closed 3 months ago

lucylucy27 commented 3 months ago

Hi,

viewer.addSplatScenes([ { 'path': plyPath1 }, { 'path': plyPath2 }]);

I use this command to add ply1 and ply2. After that, both ply1 and ply2 will be loaded into CPU and GPU memory to render. I want to achieve the functionality where I can continue rendering ply1 while releasing the memory occupied by ply2 and loading ply3. How can I accomplish this?

Thanks~

mkkellogg commented 3 months ago

Once both ply1 and ply2 have been loaded, you can call Viewer.removeSplatScene(<sceneIndex>) to remove a splat scene. Once that call completes, you can then load ply3. Something like:

viewer.addSplatScenes([{
  'path': plyPath1
},{
  'path': plyPath2
}])
.then(() => {
  viewer.removeSplatScene(sceneIndex)
  .then(() => {
     viewer.addSplatScene(ply3Path, ply3Options);
  });
})
lucylucy27 commented 3 months ago

Hi, mkkellogg,

It works for me, thanks~