[help] it don't work when i use it in "drop-in" mode.
wayc04 opened this issue · comments
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;
}
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?
Have you made any progress with this issue or get it resolved?
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.
I tried the latest version (0.3.9), it's ok for Viewer mode and Drop in mode.
Thanks~
Just to clarify, this issue is resolved for you now?
I'm going to close this for now, but feel free to re-open if you are still having trouble.
I have solved it, thank you for your help!