Setting skybox/cubemap through script issues


#1

Hello,

I have recently set the skybox by applying a cubemap through this.app.setSkybox(skyboxAsset.cubemap), but realized that this was over-writing the ambientLight and gammaCorrection app.scene values.

Does anyone know a way to get the skybox to NOT take priority and over-write these values?

I have also tried to not apply the cubemap to the world skybox but instead to individual materials that need it

        for (let index in this.Entity.model.meshInstances) {
            this.Entity.model.meshInstances[index].material.cubeMap = cubemap;
            this.Entity.model.meshInstances[index].material.update();
        }

But this gives the following WebGL errors

WebGL: INVALID_VALUE: uniform1iv: no array
84[.WebGL-000001EE8E601370]RENDER WARNING: there is no texture bound to the unit 0
4localhost/:1 [.WebGL-000001EE8E601370]GL ERROR :GL_INVALID_OPERATION : GetShaderiv: <- error from previous GL command

On a side note, these errors go away if I’m applying the cubemap to textures AND have the skybox being set through this.app.setSkybox

The main issue is setting the skybox over-writes the world light/gamma settings. Thank you!