texture.hasAlpha causes clipping with PBR

I have noticed when a group of meshes with textures & faces fairly close, that setting hasAlpha = true causes clipping for a PBR material, while not for a STD material. Here is a side by side:

Which vertex “wins” varies, based on camera angle. Here is the head when scalp is winning:
head_pbr

I verified the problem by setting hasAlpha = false manually. Things are no longer spastic, but notice the eye browse & lower edge of the hair are not right.

eye_brows_pbr

The glTF exporter must be setting everything to false, because nothing shows through, but still also has problems where textures actually have alpha not pegged to 1.

Any recommendations?

pinging @sebavan

Yup you could like the gltf exporter set the transparency mode explicitely:

pbr.transparencyMode = PBRBaseMaterial.“one of those”:

/**
     * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.
     */
    public static readonly PBRMATERIAL_OPAQUE = 0;

    /**
     * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.
     */
    public static readonly PBRMATERIAL_ALPHATEST = 1;

    /**
     * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
     */
    public static readonly PBRMATERIAL_ALPHABLEND = 2;

    /**
     * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
     * They are also discarded below the alpha cutoff threshold to improve performances.
     */
    public static readonly PBRMATERIAL_ALPHATESTANDBLEND = 3;
1 Like

PBRMATERIAL_ALPHATEST did it, thanks.

1 Like