Resize not working with multiple scenes and BlurExponentialShadowMap

Hello everyone,

hope you all have a nice day and like the title is saying:
Currently I have a project where I use mulltiple scenes and canvases with one babylon engine. And run into the problem after I implemented the shadow that the resizing is not working anymore.

After that I testet a little bit and the result was that it is only not working if a additional scene is created and useBlurExponentialShadowMap is enabled or anything related to this like useCloseBlurExponentialShadowMap.

I would be thankfull if someone can confirm to me that this is a bug and that this will be fixed. Because it is the only option currently to blur a shadow I know. Or I misconfigured something.

A Demo: https://www.babylonjs-playground.com/#IIZ9UU#51

Best regards

I can not seem to repro at all on the demo :frowning: is there anything special to do to repro ???

Move the slide in the middle and you will notice, that the camera will not be resized because of the reasons I mentioned above.

Gotcha I ll see what it can be.

This will be fixed in the next nightly, about 15 minutes :slight_smile:

2 Likes

It is up and running (ctrl f5 in your browser to be sure you are not getting the cached version)

Thank your really much for your afford sebavan.
I will test it in an minute.

HI sebavan,

unfortunately in the nightly is another bug that additional scenes will not be rendered anymore. Yes the main scene is resizable now, but additional scenes are not rendered :confused: .
I would make you a demo case but I don’t know how I can setup multiple scenes with canvases to be rendered in the playground because i cannot modify the renderloop in the playground and only one scene is returned.

You can use 2 scenes in the playground like this:

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

In this one I have added a shadow caster in the first scene:

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

1 Like

Thank you Evgeni_Popov,

but I am talking about the case where multiple canvases are used for each scene.

We definitely need a repro here as it is quite hard to grasp :slight_smile:

I will look that I can setup a playground scenario in the next time to complete cover the usecase.
I will have to heavy modify the DOM of the site over javascript to archive this.

I will update you here when I have finished it.

1 Like

Hi,
I seem to have the same issue, I posted about it on html5gamedevs.
Here is the thread : https://www.html5gamedevs.com/topic/45198-second-camera-viewport-fail-to-resize-on-engineresize/
And here is a JSFiddle https://jsfiddle.net/8wvfa3nr/ that reproduce the issue (the box is supposed to be a cube, but if the canva is not square, you can see that it is badly rendered).

Hi sebavan,

now I have build a playground scenario of my project Babylon.js Playground(bjs v4.1, somehow the version is not saved with the link). And with the latest babylon.js build it is working.
I dont know what is wrong with my project but i have to figure it out myself.

I noticed that you have already a similar issue on one of babylon.js demo cases maybe this isseue should be investigated deeper, because it is essential: https://www.babylonjs-playground.com/#L0IMUD#1 (move the seperator in the middle).

@Oswald could be possible that this issue is somehow related, but does not fit exactly to the usecase i have.

Hope you can get rid of this problem which seems to be branching in alot of features of Babylon.

Your problem is not related to the other problems of this thread: it’s because you setup a new render loop in your PG and so the resize code is not executed anymore when the canvas dimensions change.

You should add:

            if (canvas.width !== canvas.clientWidth) {
                engine.resize();
            }

into the render loop:

https://www.babylonjs-playground.com/#L0IMUD#62

1 Like

Hi Evgeni_Popov,

I am doing it here https://playground.babylonjs.com/#LXH9WU# like there https://www.babylonjs-playground.com/#L0IMUD#1.

Whats the difference? I’m trying to understand why
if (canvas.width !== canvas.clientWidth) { engine.resize(); }
is suddenly making a change in https://www.babylonjs-playground.com/#L0IMUD#62
where it is not needed in https://playground.babylonjs.com/#LXH9WU# ?

That’s because when you are working with multiple views, the system automatically calls resize for each canvas at each frame.

Oh okay makes sense, hits me like a rock :smiley:. That is also the difference in implementation.

Thanks to @sebavan your first nightly correction did it for me, the rest was a little css mistake on my side.
And also thanks to @Evgeni_Popov for clearification.
You guys are awesome :partying_face:
This thread can be closed and archived in my opinion. I don’t know if you are doing this here :sweat_smile:.