Loading glTF in Editor vs via Code -> texture is much darker

Hey There,

I’m loading a glTF-File with embedded textures in my application.
The texture is much much darker than the original one.
If I simply drag the exact same glTF in the Three-Editor the texture looks as intended.

I’m using a standard renderer with antialiasing and nothing fancy at all.
There is no dynamic lightning in the Scene but adding lightning would have no effect on the brightness of the texture anyway.

What can cause the texture to be rendered so much darker?

This is the glTF-Model in the Three Editor:
glTF Three-Editor

And this is what it looks like when I load the same glTF in my scene.
glTF loaded via code

Any ideas?
All the Best

Have you this line of code in your app?

renderer.outputEncoding = THREE.sRGBEncoding;

Ah … the encoding is the reason … thanks a lot.
Should Three not render sRGB by default?

For backwards compatibility reasons, this can’t be changed anymore.

1 Like