else if ( properties.ALPHATHRESHOLD && !properties.PBR_MATERIAL )
There is one drawback, since there may be a case where both blending and alphaclipping are required. This is something glTF does not do but x3dom does for regular material. So it should also work for PBR.
So another solution might be to set appearance.alphaclipthreshold to 0, eg. false in the gltf loader.
https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#_material_alphacutoff has the spec. for the glTF material alpha cutoff.
There are two issues:
The shader discards, eg. renders fully transparent when
alpha <= alphacutoff
at https://github.com/x3dom/x3dom/blob/88dd0f22972cc621553179878802f9615889133c/src/shader/ShaderDynamic.js#L1315-L1319 but the spec. hasIf the alpha value is greater than or equal to this value then it is rendered as fully opaque, otherwise, it is rendered as fully transparent.
which means discarding ifalpha < alphacutoff
. This is an easy fix.The shader discards even for alpha.modes other than mask because of the next line at https://github.com/x3dom/x3dom/blob/88dd0f22972cc621553179878802f9615889133c/src/shader/ShaderDynamic.js#L1320-L1323 because alphaclipthreshold is 0.1 by default, eg.
true
This lines are necessary for non glTF/PBR materials. I think requiring non PBR explicitly might work:There is one drawback, since there may be a case where both blending and alphaclipping are required. This is something glTF does not do but x3dom does for regular material. So it should also work for PBR.
So another solution might be to set appearance.alphaclipthreshold to 0, eg.
false
in the gltf loader.