I’m trying to upgrade to the latest version of ThreeJS from before the texture encoding options were added and everything runs ok but all the texture colors on GLTF objects and render textures are wrong. They render really saturated or white.
The GLTF loader sets textures to use THREE.sRGBEncoding. They are still wrong if I set them to LinearEncoding in the loader.
Render textures look washed out.
I managed to fix it once before with a combination of renderer outputEncoding values and texture encoding values but can’t remember what they were.
Just let GLTFLoader
do its work and set renderer.outputEncoding
to THREE.sRGBEncoding
. That’s the usual setup of three.js
examples using glTF
assets.
This isn’t working for me for some reason, even for GLTF where I use a standard texture and assign it to the GLTF map.
Textures on normal meshes look fine but when I assign them to a GLTF, they render wrong. Maybe I need to export the GLTF again?
Render textures look correct if I set the renderer.outputEncoding to LinearEncoding.
Apart from the color space issue, you also have to do this if you assign a custom texture to a glTF
asset.
texture.flipY = false;
Could this missing bit cause your problem?
No they render the correct orientation, I use that value.
The saturation levels seems to have been to do with the light intensities. I had an ambient light set to intensity 3, maybe some default falloffs were changed?
Changing it to 1.1 intensity made it look much better but the sRGBEncoding value still made render textures look washed out. I have a background image rendering both to the main scene and the render texture and the render texture is brighter than the screen render. If I use LinearEncoding they are the same color.
GLTF objects render really dark with both sRGBEncoding and LinearEncoding if I don’t change their texture encoding. If I change their texture encoding to LinearEncoding, that works ok.
What makes the scene look correct is lowering light intensity, using LinearEncoding for renderer.outputEncoding and using LinearEncoding for textures. I’ll try adjusting the gamma settings gammaInput/Output.