Heleor

This may be a stupid question.

I was trying to implement a semitransparent object in the world and I noticed that the spine mesh that I had was drawing to the depth buffer even when the pixel should have been discarded (as seen by the 'alphaTest: 0.5' on the SkeletonMeshMaterial.

When I dug into it, it looks like the fragment shader that is used does not actually support alpha test.

Should https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-ts/threejs/src/SkeletonMesh.ts#L52 be extended to correctly discard components that fail the alpha test? I changed the fragment locally by adding this code to the shader and it seemed to work properly.

(Example and example with fix: https://imgur.com/a/LulkhmZ)
if ( gl_FragColor.a < 0.5 ) discard;
(Note that threejs adds a compilation gate by doing #ifdef ALPHATEST, presumably to avoid the performance hit when it's not needed, but the SkeletonMeshMaterial is always passing alphaTest: true.)
Heleor
  • Mesajlar: 8

Mario

Kullanıcı avatarı
Mario

Mario
  • Mesajlar: 3027


Dön Runtimes