EnvironmentHelper.updateOptions calls create extra ground texture

Hello everyone,

When using a ground plane, subsequent calls to EnvironmentHelper.updateOptions appear to be creating additional textures for the ground each time the function is called, instead of referencing the existing texture. I’m able to observe this in both the 4.1.0 version of the npm package and using 4.2.0-beta.19 in the playground.

This playground enables both the ground and skybox and re-applies each setting as well as changing an unrelated setting. Running it shows that multiple ground textures are created, one for the initial creation and 3 more for each call to updateOptions, while there is only ever a single texture for the skybox.

Looking at the source and comparing the ground to the skybox, it appears that _groundTexture is not assigned to and is causing the check to early out of the texture dispose logic.

adding @sebavan

Will be fixed with Fix dup GroundTexture by sebavan · Pull Request #9310 · BabylonJS/Babylon.js · GitHub Thanks for reporting and nice catch !!!

1 Like

Awesome, thanks!