# texture.hasAlpha causes clipping with PBR

**URL:** <https://forum.babylonjs.com/t/texture-hasalpha-causes-clipping-with-pbr/3676>\
**Category:** Questions\
**Created:** [June 3, 2019, 9:31pm UTC](https://forum.babylonjs.com/t/texture-hasalpha-causes-clipping-with-pbr/3676 "2019-06-03T21:31:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [June 3, 2019, 9:31pm UTC](https://forum.babylonjs.com/t/texture-hasalpha-causes-clipping-with-pbr/3676/1 "2019-06-03T21:31:42Z")

</div>

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:

 ![mh_combined](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/5/58a085fa186b5ddd9d615fa40be2d8b40dc95097.jpeg)

Which vertex “wins” varies, based on camera angle. Here is the head when scalp is winning:  
 ![head_pbr](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/4/49aeac2878be83be558b4934862fe16aa3778dec.jpeg)

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](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/c/c99c2e7e54dcbed2e716db343883a52dbede1861.jpeg)

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?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [June 4, 2019, 12:59am UTC](https://forum.babylonjs.com/t/texture-hasalpha-causes-clipping-with-pbr/3676/2 "2019-06-04T00:59:45Z")

</div>

pinging @sebavan

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [June 4, 2019, 7:33am UTC](https://forum.babylonjs.com/t/texture-hasalpha-causes-clipping-with-pbr/3676/3 "2019-06-04T07:33:42Z")

</div>

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

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

```auto
/**
     * 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;

```

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [June 4, 2019, 4:20pm UTC](https://forum.babylonjs.com/t/texture-hasalpha-causes-clipping-with-pbr/3676/4 "2019-06-04T16:20:41Z")

</div>

`PBRMATERIAL_ALPHATEST` did it, thanks.
