GaussianSplats3D icon indicating copy to clipboard operation
GaussianSplats3D copied to clipboard

[help] it don't work when i use it in "drop-in" mode.

Open wayc04 opened this issue 1 year ago • 5 comments
trafficstars

the page is black and display nothing

js code

import * as GaussianSplats3D from '@mkkellogg/gaussian-splats-3d';
import * as THREE from 'three';


const camera = new THREE.PerspectiveCamera(
  75,
  window.innerWidth / window.innerHeight,
  0.1,
  1000
);

camera.position.set(0, 0, 10);

const threeScene = new THREE.Scene();
const viewer = new GaussianSplats3D.DropInViewer({
       'gpuAcceleratedSort': false,
    'sharedMemoryForWorkers': false
});
viewer.addSplatScenes([
    {
        'path': "point_cloud.ply",
        'rotation': [0, -0.857, -0.514495, 6.123233995736766e-17],
        'scale': [1.5, 1.5, 1.5],
        'position': [0, -2, -1.2]
    }
]);
threeScene.add(viewer);

const renderer = new THREE.WebGLRenderer({
  antialias: false
});
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);


renderer.render(threeScene, camera);

css

*{
    padding: 0;
    margin: 0;
}

canvas{
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
}

body {
    height: 100vh;
  }

wayc04 avatar Apr 16 '24 09:04 wayc04

I don't see that you're setting up a render loop anywhere, what if you did something like this:

viewer.addSplatScenes([
    {
        'path': "point_cloud.ply",
        'rotation': [0, -0.857, -0.514495, 6.123233995736766e-17],
        'scale': [1.5, 1.5, 1.5],
        'position': [0, -2, -1.2]
    }
])
.then(() => {
     threeScene.add(viewer);
     requestAnimationFrame(update);
});

function update() {
    requestAnimationFrame(update);
    renderer.render(threeScene, camera);
}

Where you add the viewer to threeScene once the splat scenes have loaded (in the then clause). Also, you set your camera to [0, 0, 10], are you sure anything is visible from that location?

mkkellogg avatar Apr 17 '24 14:04 mkkellogg

Have you made any progress with this issue or get it resolved?

mkkellogg avatar May 06 '24 03:05 mkkellogg

I have the same issue. Here is the err message: gaussian-splats-3d.module.js:8386 Uncaught (in promise) Error: Viewer::addSplatScene -> Could not load file assets/data/garden/biker.ply at gaussian-splats-3d.module.js:8386:24

Loading ply also fails in Viewer.

lucylucy27 avatar May 06 '24 10:05 lucylucy27

I tried the latest version (0.3.9), it's ok for Viewer mode and Drop in mode.

Thanks~

lucylucy27 avatar May 07 '24 02:05 lucylucy27

Just to clarify, this issue is resolved for you now?

mkkellogg avatar May 09 '24 15:05 mkkellogg

I'm going to close this for now, but feel free to re-open if you are still having trouble.

mkkellogg avatar Jun 04 '24 04:06 mkkellogg

I have solved it, thank you for your help!

wayc04 avatar Jun 12 '24 14:06 wayc04