When I apply different textures to different parts of a GLTF model (each with its own alpha map), I see an annoying visual glitch - looks a bit like what I remember from years ago when you didn’t synchronize updates with the vertical refresh.
I set the GLTF object visibility to false before I update the texture then set to true afterwards.
It is a skinned mesh - I search inside the GLTF for a named skinned mesh, apply a skin texture along with an alpha map texture. The alpha is to help conceal poke-through on the lower body - it doesn’t cover the regions (like the neck in that clip) that do not need it. I do the same operation for the upper body, lower body and the head.
The material for each skinned mesh is transparent so that the alpha map works; disabling the transparency doesn’t appear to help at all.
Same result if I move the camera further away.
I had some success only reapplying the texture if it changed but the 3 body textures combined with the 3 alpha maps (different for each piece of clothing) means that’s not a workable solution.
I hoped that only setting the GLTFs visible after the whole scene was composed would do the trick. Calling render(…) before I do that didn’t help either.
Edit: Tried just not setting the alpha map at all (previously, just didn’t set transparent flag - and now it’s flawless.
I think it’ll be probably necessary to access a JSFiddle exhibiting the issue. Sorting and depth-testing transparent meshes is a tricky area, there isn’t a “one size fits all” solution to that, if that’s the cause.
“Initializes the given texture. Useful for preloading a texture rather than waiting until first render (which can cause noticeable lags due to decode and GPU upload overhead).”