EnvironmentBRDF Texture Corruption

Hi Everyone,

I’ve got an issue where the EnvironmentBRDFTexture is corrupted. I was unable to reproduce it in the playground yet, so I will try to explain.

I have two scenes, one for the main application, and another to view a single object (ex: a chair/table/couch). When I open up the single object viewer I am using BABYLON.SceneLoader.LoadAssetContainer to load data from my glb file into my single object viewer scene. When the user clicks cancel I dispose this scene. If the user opens/closes the viewer a couple times then this EnvironmentBRDFTexture becomes corrupt.

    var envBRDFTexture = new BABYLON.Texture('/correlatedMSBRDF_RGBD.png', scene, true, true, BABYLON.Texture.BILINEAR_SAMPLINGMODE);
    envBRDFTexture.isRGBD = true;
    envBRDFTexture.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
    envBRDFTexture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;        
    scene.environmentBRDFTexture = envBRDFTexture;

Pre-setting the texture fixed the issue: see: scene.environmentBRDFTexture vs scene.environmentTexture