-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
glTF conformance: khronos-TextureLinearInterpolationTest #22483
Comments
I've been a little skeptical of this test (KhronosGroup/glTF-Sample-Models#297 (comment)) and wrote the warning above (KhronosGroup/glTF-Sample-Models#313), but if it really is making our renders subtly darker than baselines that would be much more motivating... 🤔 The workaround is to use |
Not sure texture colorspaces conversion is the (only) issue the renders are darker. I can see many samples that don't use textures and are still dark: https://modelviewer.dev/fidelity/#khronos-BrainStem And on this one the shine is still too bright: |
three.js is not glTF-compliant. AFAIK, I am the only one working on trying to make it so. It is too early for conformance testing... Maybe in a month, assuming an organized and concerted effort. |
I'm trying to solve |
There's a difference in whether color interpolation happens before or after sRGB decoding...
... it's clear in this example (the example is designed for that) but I'm not sure how much visual effect it has generally. |
I've tried adding support for
Mipmap generation is supported with WebGL 2 but only with RGBA textures (meaning So unless the engine always defines color textures as RGBA during a sRGB workflow, the sRGB texture format will be hard to use. |
I've created a branch with my code: https://github.com/Mugen87/three.js/tree/dev17 With The examples look different. The |
@Mugen87 Those examples are very helpful. It looks like the subtle differences are related to the emissive map... somehow... One thing I did not try was to turn off ACESFilmic. |
After investigating the issue more closely, it seems that using
This also happens when using linear color space (although this setup is not valid in the first place since the grass texture is a sRGB texture).
When using
|
It seems to me that this code block
is doing precisely what the Linear Interpolation Test hopes to prevent. three.js interpolates first and decodes second -- and does so for all nonlinear maps. Perhaps the code injection can be removed for WebGL 2. |
That makes sense to me 👍 |
Hmm, but what are we supposed to do with all the other encodings? three.js/src/renderers/webgl/WebGLProgram.js Lines 22 to 48 in 89ca03d
|
In the first step, I would suggest to only bypass the inline decode for sRGB encoded RGBA textures in WebGL 2 (and use Encodings like RGBE or RGBM can't be handled by WebGL so without an inline decode in GLSL the texture data have to be converted to linear space before they are uploaded to the GPU. Eventually there will be different code paths for sRGB and all other encodings. Assuming we want to use the WebGL sRGB features. |
I guess I have something ready for a closer review: One requirement for using |
|
Since |
I've finally updated our fidelity tests and three.js is looking quite respectable (with the exception of sheen), but I did notice a clear failure: https://modelviewer.dev/fidelity/#khronos-TextureLinearInterpolationTest
This warning looks like it may be directed at us. I also notice many of our renders are subtly darker than the others if you look through these fidelity tests. Considering the exposures and tone mappings have been carefully matched, I wonder if this might be the cause?
The text was updated successfully, but these errors were encountered: