Does texture interpolation on read happens in sRGB prior to r136?

Hey guys, I’m using threejs r132. And so far I gathered, I’ve to manually decode sRGB values after sampling from sRGB textures even if the encoding property is set to sRGBEncoding. I’m looking to implement Khronos’ Texture Linear Interp Test in a renderer based on this version of threejs.

This requires that the Lerp operation happens after sRGB decoding. But since in r132, you can only decode after you’ve actually taken a sample doesn’t this mean that I can’t properly pass the test on this version? And the fact that threejs is basically doing linear interpolation on texture reads in sRGB?

Either I understood the test’s requirement wrong or this isn’t doable in r132. Any hints/advice would be appreciated. Thanks

1 Like

If you upgrade to r136 the mentioned test will pass without any updates of three.js. The details are explained in this issue:

tl,dr: It’s important to avoid the sRGB decode in GLSL and let WebGL handle the color space conversion by using texture formats like gl.SRGB8_ALPHA8.

1 Like

Thanks bro, that issue answers a lot.

1 Like

Hey guys, do you have an example of texture interpolation using the correct encoding?

I am using render targets (FBOs) to create a cross fade effect and everything looks darker. This only happens with elements rendered by interpolating the FBOs.

In the image the darker one is rendered in the FBOs, the lighter one is rendered directly to the canvas.

My code looks almost identical to this: three.js examples

The only difference is that I am using image textures and GLB models. Everything uses sRGBEncoding, including the FBOs.