Closed hyqshr closed 2 months ago
Is it an actual error or console logging statement? Because you likely have Next.js running in strict mode, it will load your react component, then immediately unload and then load again to test how durable it is. When it unloads your react component, the viewer will get disposed, but because it is already trying to load a scene, that load has to be aborted and that's why you're seeing the AbortablePromiseError
. However, I'm guessing you're seeing it because of this code:
viewer.addSplatScenes(addParams, false)
.catch((err) => {
console.log("Error loading splat scenes:", err);
});
If you take out that console.log
statement, it might go away.
@mkkellogg Thank you for your reply!
Nothing is loaded in my page, and I got few errors:
Did you change GaussianSplats3D.Viewer
back to GaussianSplats3D.DropInViewer
?
The above two error come from GaussianSplats3D.DropInViewer
Should I use GaussianSplats3D.Viewer
or GaussianSplats3D.DropInViewer
?
You should be using GaussianSplats3D.DropInViewer
, so it looks like you're fine there. When I run the code you pasted above in a Next.js project and I remove the line console.log("Error loading splat scenes:", err);
, I don't see any errors and the splat scene loads fine.
That's weird,
I tried "@mkkellogg/gaussian-splats-3d": "^0.4.4"
with next.js version 14.2.8
, '14.2.4' and 13.4.19
it all does not load the scene.
It seems that they all abort download the .ply
file
It's probably worth checking -- Are you using your component under an R3F <Canvas>
component somewhere?
Also, you need to be adding all the other three.js components needed for rendering (camera, controls, etc.) yourself
I'm new to both Three.js and Gaussian splats. Can you share your Next.js project? I can give you my email @mkkellogg
@mkkellogg No I am not using <Canvas>
at all.
Will
<SplatsView sources={[splatURL]} />
Alone not able to render a view?
Yeah the <Canvas>
R3F element works similar to the way an HTML <canvas>
works in standard three.js -- as the root rendering window. It serves as the container for standard three.js objects like the camera (which your example doesn't seem to have). Here's a simple example that I got to work:
'use client'
import { Canvas } from '@react-three/fiber'
import React from 'react';
import { SplatsView } from "@/components/canvas/SplatsView";
import { OrbitControls } from "@react-three/drei";
export default function Scene() {
return (
<React.StrictMode>
<Canvas camera={{ near: 0.01, far: 1000 }}>
<SplatsView
sources={['https://huggingface.co/datasets/runes/coolsplats/resolve/main/output.splat']}
options={[{ position: [0, 0, 0], scale: [2, 2, 2] }]}>
</SplatsView>
<OrbitControls />
</Canvas>
</React.StrictMode>
)
}
It worked, thank you so much! I will dig in more about Three.js
Great!
I am trying to load gaussian splat from a resource url in Next.js. But got error:
Next.js: 14.2.3 gaussian-splats-3d: 0.4.4
Code (SplatsView copied from https://github.com/mkkellogg/GaussianSplats3D/issues/247):
Thank you!
Stack trace: