Invert cubeTexture/environmentTexture

Hello guys,

some weird things are going on in my scene. Offscreen canvas leads to the problem that the cubeTexture/environmentTexture of my scene get inverted. Onscreen everything is correct but offscreen displays the texture upside down. I use right handed system but this couldn’t be the issue because it works well onscreen.

I don’t use a skybox just the environmentTexture. I tried to invert it with:

scene.environmentTexture.setReflectionTextureMatrix(Matrix.RotationX(Math.PI))

This in fact inverts the environment but the reflections are not correct. They look way different to my onscreen scene.

What can be the problem here?

Best

can you share a repro?
pinging @sebavan FYI

Yup this is really weird a repo would definitely help :slight_smile:

Am I able to setup offscreen canvas with playground?

It seems that it is just a problem with .env. I tried it with the babylon demo environments. dds works correctly. Dds is way darker though.

Ok I can repro by forcing ImageData loading vs png loading: https://playground.babylonjs.com/#2FDQT5#626

I will fix it ASAP

1 Like