Glow aspect ratio

Hi everyone,

I’m new in babylon.js and I don’t know if the question is already solved.

I want to add a glow effect for the Sun in a viewer of the Solar System that I am developing, the problem is: when I change the size of the browser window the aspect ratio of the effect changes as well. Is there any way to avoid this?

I would appreciate any help in this regard.

Welcome to the community !!!

It would be amazing if you could provide a repro in the playground but it looks like not just a glow only but a general ratio issue ?

You could try

window.addEventListener('resize', function(){
    engine.resize();
});

Hi sebavan, thanks for reply.

I already have those lines added to my code.

No, it is not a general aspect ratio problem, it may appear that way because of the flattening of Saturn, but if you look at the dark sphere in the foreground, you will see that it has a correct aspect ratio.

Here I leave another image with another browser window size with the same scene.

Could you repro in the playground ? it does not seem to be happening here: https://playground.babylonjs.com/#1KUJ0A#1107

1 Like

I think I have already found the problem; for some reason I had added mainTextureFixedSize to the glow definition.

https://playground.babylonjs.com/#B1B8B8#2

Comment that line and the glow keep the aspect ratio when resizing the window. But i didn’t realize it until i saw your code, thanks!

1 Like