Is this possible to have a 3d loading before the main scene?

hi, is this possible to have a 3d rendered scene that works as the loader and after the main scene is loaded we will destroy it? do we need 2 separate scenes for that? or we can work with one? any ideas on how to do it… typical loading uses 2d elements but I want to use something like particles before the scene is loaded… is this possible?

Hello! I think you need 2 scenes. Renderer can be one. While rendering “loading scene”, all objects puts to “main scene” and not interapts by particles.

Hey, @Chaser_Code thanks for the answer… how can we toggle between two scenes without using 2 renderers ( and 2 canvas)?

hello, @TronIsHere
for webgl, a SCENE object for each node .window can exist in a single instance, so 2 or more scenes can be created if you do it sequentially, for example:

const scene;
function loaderInit(){
     scene = new THREE.Scene();
     //then your loader-Scene preferences
}
function init(){
     scene.dispose();
     scene = new THREE.Scene();
     //then your Main-Scene preferences
}

do we need 2 separate scenes for that?

Of course not! Create a separate object/group for the loader elements, which is removed when the main scene is loaded. And make sure that the animate/requestAnimationFrame function is defined in the right place

1 Like
var scene_loading=new THREE.Scene();
var scene_main=new THREE.Scene();
var scene=scene_loading;

when main scene is loaded, chage scene path to main: scene=scene_main

function loop(){
requestAnimationFrame(loop);
renderer.render(scene,camera);
}
1 Like