Babylon graphic is no longer being rendered all of a sudden

My Babylon scene is no longer being rendered as of this morning. No changes have been made to the code base which rules out problems my end. This happens in all environments and on all browsers…

I am using the source code from https://cdn.babylonjs.com/babylon.js

Any advice on this would be appreciated!

Thankyou

It would be helpful to have more data.

BABYLON.DefaultLoadingScreen.prototype.displayLoadingUI = function () {
if (document.getElementById(“custom-loading-screen-div”)) {
// Do not add a loading screen if there is already one
document.getElementById(“custom-loading-screen-div”).style.display = “initial”;
return;
}
this._loadingDiv = document.createElement(“div”);
this._loadingDiv.id = “custom-loading-screen-div”;
this._loadingDiv.innerHTML = @include('parts.renders.loading-screen-korniche');
this._resizeLoadingUI();
window.addEventListener(“resize”, this._resizeLoadingUI);
document.body.appendChild(this._loadingDiv);
};

BABYLON.DefaultLoadingScreen.prototype.hideLoadingUI = function(){
    document.getElementById("custom-loading-screen-div").style.display = "none";
    console.log("scene is now loaded");
}

var canvas = document.getElementById("renderCanvas");

var startRenderLoop = function (engine, canvas) {
    engine.runRenderLoop(function () {
        if (sceneToRender && sceneToRender.activeCamera) {
            sceneToRender.render();
        }
    });
}

var engine = null;
var scene = null;
var sceneToRender = null;

var createDefaultEngine = function () {
    return new BABYLON.Engine(canvas, true, {
        preserveDrawingBuffer: true,
        stencil: true,
        disableWebGL2Support: false
    });
};

I’m new to this forum, and to Babylon js, so please forgive me if I don’t give appropriate info right away.

In the console in the browser dev tools it is telling me the “scene is now loaded” but it is showing nothing.

This happens in all environments

You did nothing wrong, CGlass1982. You are welcome. :slight_smile:

We have a playground where you can sketch your problem so that we can help you better.

I miss in your code where your scene is loaded “scene = createSzene();”

       let engine = new BABYLON.Engine(canvas, true, {
            preserveDrawingBuffer: true,
            stencil: true
        });
        let scene = createScene();

        engine.runRenderLoop(function () {
            if (scene) {
                scene.render();
            }
        });

Sorry, here is where createScene is fired

window.initFunction = async function () {

    var asyncEngineCreation = async function () {
        try {
            return createDefaultEngine();
        } catch (e) {
            console.log("the available createEngine function failed. Creating the default engine instead");
            return createDefaultEngine();
        }
    }

    window.engine = await asyncEngineCreation();
    if (!engine) throw 'engine should not be null.';
    startRenderLoop(engine, canvas);
    window.scene = createScene();
};
initFunction().then(() => {
    sceneToRender = scene
});

May be you should test older versions of babylon.js

Load an older Version of babylon in LoadingScript? - Questions - Babylon.js (babylonjs.com)

You can find the version in the browser’s inspector, too:

How do I specify a version when importing?

You don’t. I don’t think we have access to previous versions (but I could be wrong, may be this has changed). I guess the easiest at this moment would be to download it and feed it from your server.

So I have found a fix…

Babylon 6.2.0 must have breaking changes…

You can find previous versions here:

Version 6.1.0 works for me!

Thank you to all who contributed :slight_smile:

2 Likes

nice find. Not sure I would use it in production as of just now but it’s a nice link to have. Thanks for sharing and have a great day :sunglasses:

There shouldn’t be anything breaking in 6.2 so if you could share your createScene in a Playground Babylon.js Playground (babylonjs.com) it would be immensely helpful for the team to understand what’s going on :smiley: If you have any external meshes in your scene here’s a link explaining how you can use them on a PG: Using External Assets In the Playground | Babylon.js Documentation (babylonjs.com)

1 Like

I’ve copied the code into a playground although I removed some external models that I am unable to share.

It renders in playground!

So maybe the issue lies when importing external models?

The models I am importing are stl files.

I use SceneLoader.Append to import them.

The link to the playground:

Lantern | Babylon.js Playground (babylonjs.com)

Hope this helps!

@CGlass1982 could you share the code in PM with @carolhmj ? I am really afraid that we slipped a regression in :frowning:

2 Likes

Yup we’d really like to understand what’s going on, I tried loading some test stls and they didn’t have any problem, but there might be something different with your files?