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

Can I disable key options in GaussianSplats3D Viewer? #409

Open
ryouhei0622 opened this issue Jan 23, 2025 · 6 comments
Open

Can I disable key options in GaussianSplats3D Viewer? #409

ryouhei0622 opened this issue Jan 23, 2025 · 6 comments

Comments

@ryouhei0622
Copy link

Thank you for your contribution!
I am trying to place an input box on the same page as the gsviewer. However, when I type in the input box, key options like u and s are being triggered, which prevents proper input. Below is how I am initializing the viewer. Is there any parameter or method to disable these key options?
Any guidance would be greatly appreciated!

const viewer = new GaussianSplats3D.Viewer({
    rootElement: containerRef.current,
    threeScene: threeScene,
    cameraUp,
    initialCameraPosition,
    initialCameraLookAt,
    webWorkerConfig: {
        crossOriginIsolated: self.crossOriginIsolated,
        useSharedMemory: self.crossOriginIsolated,
    },
    sharedMemoryForWorkers: self.crossOriginIsolated,
    gpuAcceleratedSort: true,
});
@pradeepnandigam
Copy link

Hi @ryouhei0622,

You might try using another option: 'useBuiltInControls': false.

I'm not entirely sure, but it might be worth giving it a try.

@ryouhei0622
Copy link
Author

thank you for your help!!

@ryouhei0622
Copy link
Author

Sorry for asking multiple questions.

I set useBuiltInControls to false and configured it as shown below. However, I encountered an error at the line viewer.controls.target = new THREE.Vector3(.

I want to explicitly specify the initial look-at position, so I am trying to access controls.target.

 const viewer = new GaussianSplats3D.Viewer({
        rootElement: containerRef.current,
        threeScene: threeScene,
        cameraUp,
        useBuiltInControls: false,
        initialCameraPosition,
        initialCameraLookAt,
        webWorkerConfig: {
          crossOriginIsolated: self.crossOriginIsolated,
          useSharedMemory: self.crossOriginIsolated,
        },
        sharedMemoryForWorkers: self.crossOriginIsolated,
        gpuAcceleratedSort: true,
      });
      viewer.controls.target = new THREE.Vector3(
        initialCameraLookAt[0],
        initialCameraLookAt[1],
        initialCameraLookAt[2],
      );

@pradeepnandigam
Copy link

pradeepnandigam commented Jan 23, 2025

I believe there isn't a function named controls in the viewer. Instead, you can pass the position and target values as arrays in place of the initialCameraPosition and initialCameraLookAt options. This might help.

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

const viewer = new GaussianSplats3D.Viewer({
    'cameraUp': [0, -1, -0.6],
    'initialCameraPosition': [-1, -4, 6],
    'initialCameraLookAt': [0, 4, 0]
});
viewer.addSplatScene('<path to .ply, .ksplat, or .splat file>', {
    'splatAlphaRemovalThreshold': 5,
    'showLoadingUI': true,
    'position': [0, 1, 0],
    'rotation': [0, 0, 0, 1],
    'scale': [1.5, 1.5, 1.5]
})
.then(() => {
    viewer.start();
});

@ryouhei0622
Copy link
Author

I believe there isn't a function named controls in the viewer. Instead, you can pass the position and target values as arrays in place of the initialCameraPosition and initialCameraLookAt options. This might help.

Yes, you are correct. There is no actual function named controls.
What I am doing here is directly accessing the OrbitControls inside the GSViewer to modify its target.
By doing this, I can change the rotation center of the viewer.

@ryouhei0622
Copy link
Author

ryouhei0622 commented Feb 10, 2025

@pradeepnandigam @mkkellogg
Using the above method, I was able to make the necessary adjustments. However, due to changes in the key bindings, it has affected the input fields on the same page, making flexible input operations difficult.
I believe key binding issues will continue to arise when embedding the viewer into a page in the future. Therefore, I would like to request an option to disable specific key bindings (such as W,A,S,D, U or P) via parameters. This phrasing is clear and conveys your request effectively in a professional tone.

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

2 participants