Change the standard loading screen

Hello , please i want to replace the babylon Logo in the standard loading Screen , and add a new logo with progress bar of loading !

I al ready see this documentation , but it is realy not helpfull egnough ! Create a custom loading screen - Babylon.js Documentation

Thanks

1 Like

Hi M. Did you do a forum search for ā€˜loading screenā€™? Give it a tryā€¦ youā€™ll find another thread.

Iā€™ll save you some reading. I thinkā€¦ to get FULL POWER over the loading screenā€¦ you must do it like this. https://www.babylonjs-playground.com/#5Y2GIC#2.

The loading screen turns ON againā€¦ for 10 secondsā€¦ beginning 5 seconds after the load is finished (for testing/watching).

You need to include lines 2-52 in your projectā€¦ near the top of the code, like is shown in the playground. You set the URL in line 36.

Good luck! Please try to mention BabylonJS in other parts of your project. Thx. Also, stay tuned for more, and possibly wiser comments/ideas.

PS: Ainā€™t that the sweetest armature/avatar ya ever seen in your life!? So nice! (not mine)

3 Likes

Thanks for responce , i already do a forum search for ā€˜loading screenā€™ but i dont find something interessing;
The solution you send me is great but it is using Css , there is no solution with JS ? i think i can use GUI but i dont the good way to use it !

Thanks again !

1 Like

@mixofo
Yes, you can just create it with a BABYLON.GUI instead of HTML elements & css :slight_smile:

2 Likes

Got demo, aW? (thx)

I happen to be using the GUI for my loading screen for a gamejam! Hereā€™s a quick copy and paste:
https://playground.babylonjs.com/#809MXL

3 Likes

something like https://www.babylonjs-playground.com/#5Y2GIC#6

engine.loadingScreen = new loadingScreen(scene);
2 Likes

That timing was uncanny! :joy:
Yours is much fancier though, very nice!

yeah that was odd! :smile:
Yours is nice and simple, i like it

1 Like

engine.loadingScreen = new loadingScreen(scene);

Ah, I didnā€™t know you could set a whole separate scene as the loading screen! Thatā€™s perfect.

Thanks a lots , but i get this error Line 66:5 - scene_This is not defined

Ah sorry, thatā€™s my custom variable. Change scene_This to just scene :smile:
Also add in fullscreenGUI.removeControl(loadingSquare); if you havenā€™t noticed already, as I forgot to remove the square. But really itā€™s better just to define them in a separate scene like aWeirdo is doing, because then it fades out and it looks really nice!

Iā€™ll rewrite mine to show it better if youā€™d like!

Alright, Iā€™ve got 2 examples here for you!

https://playground.babylonjs.com/#PM04AU

This first one here is an example of replacing the engine default loading screen like aWeirdo did, basically just with my own naming conventions and also a fadeout animation. @aWeirdo did an excellent job juggling the scope with his ā€œ_thisā€ variable and all of his properties, so most of that I borrowed from his example!

https://playground.babylonjs.com/#HMAHQ9#1

The second one here is in case you donā€™t really care much for following the same structure as the original loading screen. Itā€™s similar to my first example where everything is very simple, except now everything is in a gui container like aWeirdoā€™s so itā€™s a bit easier to manage, and also it has the fadeout animation implemented as well. It uses custom functions to show and hide the UI so using it is very similar to using the engine default.

Feel free to take a look, and let us know if you have any more questions!

Thanks a lots it is what i am searching , i dont understand why tthere isnt a good documentation for Loading Screen ā€¦ i have just a final question please , i already have a GUI in my scene , how i can make the Loading GUI layer on top of my GUI ?

THANKS !!

1 Like

The Z index should already be drawing it on top, but since it isnā€™t, it could be caused by a couple things. First, try raising the Z index to 2000, and if that doesnā€™t work, itā€™s possible itā€™s because you have 2 fullscreen GUIs, in which case you can get rid of your current in-game full-screenGUI variable and add your in-game GUI controls to the FullscreenGUI used by the loading screen.

Barring all that, the lazy way to do it would be to set your in-game GUIā€™s visibility property to false in the ā€œshowLoadingScreenā€ function and setting it to true in the ā€œunregisterAnimsā€ function.

Hope that helps!

1 Like

May I ask if this example is really loading screen, or just an animation playing

I ask if this example is really loading screen, or just an animation playing

Hi @ranwei-001
Iā€™m not sure i understand,
Both samples are loading screens made with the BABYLON.GUI & both contains some kind of animation

Hi guys. I am also having a tough time with this, I guess I will end up with switching the visibility like SometimesIMakeThings sugested, because I cant make the zIndex work. I tried modeling my setup like aWeirdos example, because that seems to fit best with the documentation, but my buttons still get rendered on top of my loadingScreen. Also I donā€™t seem to be able to set the LayerMask properly for my post-processing, so I quickly copy/pasted together a playground if anyone sports my mistakes ?

https://www.babylonjs-playground.com/#CZZ7T8

Nevermind about the postprocessing, just needed to set the active cameras before returning ( scene.activeCameras = [camera, camera2]; ) :man_facepalming:

Now include egg on my face to my previous facepalm, I was reinitialising my advancedTexture :woozy_face:

1 Like

Dear Wingnut
Your example is better, thank you. and I have a might simple question here:
Babylonjs has the following code: (sorry for not remembering exact syntax)
screenloader.importMesh(
ā€¦
success_callback(),
progress_callback( currentNumber, TotalNumber),
error_callback(
ā€¦
)
so, is it possible to show the exact progress percentage?
with computing out the currentNumber/TotalNumber offered by progress_callback)
I mean in your line#27 this._loadingTextDiv.innerHTML = this._loadingText;
can you please tell how to use this._loadingText to show exact progress percentage ?
thanks any way.