Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wayc04 opened this issue Apr 16, 2024 · 5 comments
Open

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

wayc04 opened this issue Apr 16, 2024 · 5 comments

Comments

@wayc04
Copy link

wayc04 commented Apr 16, 2024

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;
  }
@mkkellogg
Copy link
Owner

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
Copy link
Owner

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

@lucylucy27
Copy link

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
Copy link

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

Thanks~

@mkkellogg
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants