Comments (6)
Do you see any errors in the console? My guess is that you're getting an error telling you that you can't add a splat scene while another load is already in progress. The issue is this loop:
splats.map((url)=>
this.splatViewer.addSplatScene(url, {
'splatAlphaRemovalThreshold': 5,
'position': [0, 0, 0],
'rotation': [0, 0, 1, 0],
//'scale': [scale, scale, scale],
"showLoadingUI": false,
"onProgress": onProgress,
})
)
That would fire off multiple simultaneous calls to addSplatScene()
, which is not supported. If you want to load multiple scenes simultaneously you can use the addSplatScenes()
function, otherwise you need to wait until one call to addSplatScene()
has finished before issuing the next call.
from gaussiansplats3d.
I fixed that. No errors and still nothing. Just a black screen with the objects I put inside it
from gaussiansplats3d.
Other than that, I don't see anything wrong, it should work. For what it's worth I was able to take your above code and get it working by putting it inside a class (with minor tweaks):
const renderWidth = 800;
const renderHeight = 600;
class Engine {
constructor() {
const that = this;
function animate() {
requestAnimationFrame(animate);
that.renderer.render(that.scene, that.camera);
}
this.scene = new THREE.Scene();
this.camera = new THREE.PerspectiveCamera(75, renderWidth / renderHeight, 0.1, 1000);
this.camera.position.set(20, 20, 20);
this.camera.lookAt(0,0,0)
this.renderer = new THREE.WebGLRenderer();
this.renderer.setSize(window.innerWidth,window.innerHeight);
this.controls = new GaussianSplats3D.OrbitControls(this.camera, this.renderer.domElement);
this.controls.listenToKeyEvents(window);
this.controls.rotateSpeed = 0.5;
this.controls.maxPolarAngle = Math.PI * .75;
this.controls.minPolarAngle = 0.1;
this.controls.enableDamping = true;
this.controls.dampingFactor = 0.05;
this.controls.target.copy(new THREE.Vector3(0,0,0));
this.controls.update()
this.splatViewer = new GaussianSplats3D.DropInViewer({
'gpuAcceleratedSort': true,
// 'cameraUp': [0, 1, 0],
// 'initialCameraPosition': [0.1, 0.1, 0.1],
// 'initialCameraLookAt': [0, 0, 0],
//"ignoreDevicePixelRatio": true, //speed
//"dynamicScene": true, //speed
//'useBuiltInControls': false,
//'webXRMode': GaussianSplats3D.WebXRMode.None,
"sharedMemoryForWorkers": false, //TODO get this to work without bugs when set to true
});
this.scene.add(this.splatViewer);
const rootElement = document.createElement('div');
rootElement.style.width = renderWidth + 'px';
rootElement.style.height = renderHeight + 'px';
rootElement.style.position = 'relative';
rootElement.style.left = '50%';
rootElement.style.top = '50%';
rootElement.style.transform = 'translate(-50%, -50%)';
document.body.appendChild(rootElement);
this.renderer.domElement.style.position = 'fixed';
this.renderer.domElement.style.top = '0';
this.renderer.domElement.style.left = '0';
this.renderer.domElement.style.width = '100%';
this.renderer.domElement.style.height = '100%';
rootElement.appendChild(this.renderer.domElement);
let ambientLight = new THREE.AmbientLight( 0xffffff, 1 );
this.scene.add(ambientLight);
let hemisphereLight = new THREE.HemisphereLight(0xffffff, 3);
this.scene.add(hemisphereLight);
animate();
this.splatViewer.addSplatScenes([
{
'path': 'assets/data/garden/garden_high.ksplat',
'splatAlphaRemovalThreshold': 20,
},
{
'path': 'assets/data/bonsai/bonsai_trimmed.ksplat',
'rotation': [-0.14724434, -0.0761755, 0.1410657, 0.976020],
'scale': [1.5, 1.5, 1.5],
'position': [-3, -2, -3.2],
'splatAlphaRemovalThreshold': 20,
}
], true);
}
}
new Engine();
from gaussiansplats3d.
Even with your changes no luck. Not sure whats up with that. Ill keep looking into it I suppose. The only reason I want to do the drop in viewer is cause the splat is not a major part of what im doing. However, When im using the regular viewer, i must add a splat before I can see my scene. Is there a way to show the scene before adding the splat?
from gaussiansplats3d.
Unfortunately the way it works right now is that the viewer won't start rendering anything until a splat scene has been loaded (that might change in a future update). Are you only using one single instance of THREE.WebGLRenderer
for both the splat viewer and your other three.js objects?
from gaussiansplats3d.
Yep just the one renderer
from gaussiansplats3d.
Related Issues (20)
- streamView false doesnt affect the loading method HOT 11
- Splats are not fully shown when streaming is off HOT 5
- null SplatTree preventing Raycaster from working. HOT 6
- Accessing Splats Bounds on Load HOT 5
- How to add a skybox effect HOT 2
- Compatibility between Viewer & PostProcessing Effects HOT 16
- Feature: Accommodating the rendering processes of other improved 3DG methods HOT 2
- Load splat/ply/ksplat from browser cache. HOT 3
- How can the zooming range be controlled? HOT 1
- Any ideas on how to integrate cameras.json into the gausiansplats3d? HOT 2
- Best way to remove old splat scene from the view? HOT 16
- Issue with rendering splat with Drop-in viewer in 8th Wall three.js AR HOT 6
- How to add mouse events to a camera that allow rotation around itself? HOT 2
- Issue Loading PLY HOT 3
- .KSPLAT is not visible in scene HOT 8
- Can't display splat on the itowns stage HOT 9
- Online demo page not up to date HOT 9
- Question? Where should I look in the source code to see all the splats? HOT 1
- (not issue)just want to say: I like this viewer; it's the most user-friendly and render-correctly viewer. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gaussiansplats3d.