Babylon notifications

hello, is there any way to get a notification from Babylon when all calculations are done? A mesh is created and a dynamic texture, which again serves as the source for a displacement map. All of this takes a certain amount of time before it is displayed in the context. Now I want to display a loader that only disappears when everything has been calculated and is ready to be displayed.

Thank you

If this is at the beginning, put the render loop registration inside a scene.executeWhenReady().

1 Like

It is not in the beginning. The meshes are created dynamically based on user input.

Can you create a repro in the PG to help understand what you try to achieve?

It is difficult to create an example in the PG because the data for creating the meshes is supplied by another server. My only concern is to show the user a waiting graphic while Babylon is still involved in the calculation of the meshes, for example the displaycement map. I need an event that signals when Babylon has finished calculations and the mesh is displayed.

you can hook to mesh.onDrawObservable then maybe?

You probably load the mesh async. So you could use .then(), or make yourself a function to execute a callbackFunction.


async meshLoader(callbackFunction) {
var mesh = await whateverYouLoadYourMeshWith();

1 Like

Only the parameters for creating the mesh are loaded from the server. The mesh itself is created and modified with Babylon. A displacement map and a texture are assigned to the mesh. The mesh also generates a shadow. When the scene is rendered, only the shadow is visible and about 2 seconds later the actual mesh appears.
I would like to show the user a waiting graphic for the time from generating the mesh to the complete set-up.
This does not work with the async () method.

onDrawObservable () has not worked so far.

Can Babylon trigger an event when it has finished all calculations and is in “IDLE” mode?


We need a repro to help further

After a long test, I found that the delay was due to the browser’s active debug console.
Thanks for the help, even if I couldn’t use it entirely.

1 Like