I’m encountering a persistent issue with my card animation project, and I’m hoping to get some insights or solutions.
When my cards transition between textures (implemented with a ShaderMaterial), they briefly appear darker or have a noticeable darkening flicker. After the transition, the card returns to its original brightness. This darkening effect is not desired.
Your jsfiddle didn’t work for me.. it was choking on not finding players.json
But if i was to hazard a guess:
I think your transitionMaterial isn’t implementing the srgb colorspace conversion, whereas the regular shader you have, .. is.
Maybe adding the following after you write gl_FragColor in your transitionShader:
Yeh like manthrax said it’s probably color space inconsistencies during the shader transition effect, When you switch from MeshBasicMaterial to your custom ShaderMaterial, the shader performs texture sampling and mixing in linear color space, but the textures are stored in sRGB color space. This mismatch causes the darkening effect. That’s my guess and if it’s correct then manthax gl_FragColor output line would work.
Thanks for the comment. But I tried modifying it as you said, but when the card transitions, it suddenly becomes transparent. I modified it on the codepen linked above. Could you please check it?
So the original code in your codepen throws player.json file not found error and also for the textures so I remake it using a single texture and fake player json list, the remake is not fancy but can you check if this is correct?, what I basically change is applying linearToOutputTexel only for the color