Will BJS/WebGL Context Render on a Hidden Element?

If a canvas is set to display none, will it continue to render? I feel dumb for asking this…

I also don’t know the exactly right answer but here are 2 profiles of the same page: usual rendering and with display:none canvas. For some reason the scripting time in the second example is even bigger than the same time with visible canvas.


hahaha, the funny part is its kinda a simple question… but is kinda hard to answer unless you just know the inner workings.

You are supposed to say “Asking for a friend”.

Can you please try changing the size of the hidden canvas to 1x1?

In any case, I think the correct answer would be to stop the scene with a flag or similar in scene.render itself. Is there something already or do we just override the method?

scene.justRender = scene.render
scene.render = (updateCameras=true, ignoreAnimations=false) => {
    if (!scene.stopRendering) {
        scene.justRender(updateCameras, ignoreAnimations);
    }
}

Here an example, it stops rendering after 2000 ms.