# Problem with opacity texture

**URL:** <https://forum.babylonjs.com/t/problem-with-opacity-texture/6000>\
**Category:** Questions\
**Tags:** material\
**Created:** [September 30, 2019, 12:24pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000 "2019-09-30T12:24:23Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![MartynovOleg](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/martynovoleg/32/4466_2.png) [@MartynovOleg](https://forum.babylonjs.com/u/MartynovOleg)\
**Post date:** [September 30, 2019, 12:24pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/1 "2019-09-30T12:24:23Z")

</div>

Hi, I’m sorry to contact you so often, but time is running out, and I don’t know what to do. I was given an opacity texture, I applied it, but my legs were painted white and that’s all ((Help please  
[https://jsfiddle.net/ahoxq4gz/3/](https://jsfiddle.net/ahoxq4gz/3/)

---

<div class="post-metadata">

**Author:** ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)\
**Post date:** [September 30, 2019, 2:19pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/2 "2019-09-30T14:19:09Z")

</div>

Hiya M!

I hope it’s OK with you… that I made a test in the BJS Playground app.

[https://playground.babylonjs.com/#KK23QT](https://playground.babylonjs.com/#KK23QT)

Something odd is happening at line 33 - `opacityTexture.getAlphaFromRGB = true`

I changed it to _false_ in line 34.

Now we can study it, and do more tests, and listen for more comments.

---

<div class="post-metadata">

**Author:** ![MartynovOleg](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/martynovoleg/32/4466_2.png) [@MartynovOleg](https://forum.babylonjs.com/u/MartynovOleg)\
**Post date:** [September 30, 2019, 2:29pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/3 "2019-09-30T14:29:10Z")

</div>

Everything is fine with me) Thanks for the answer. getAlphaFromRGB, I took from this topic [PBR Alpha Map - Questions & Answers - HTML5 Game Devs Forum](https://www.html5gamedevs.com/topic/32386-pbr-alpha-map/)  
And it works, but not as it should, the legs are not transparent ((

---

<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:** [September 30, 2019, 3:30pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/4 "2019-09-30T15:30:02Z")

</div>

Pinging @sebavan as he already dug into pixi 🙂

---

<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:** [September 30, 2019, 3:58pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/5 "2019-09-30T15:58:00Z")

</div>

The problem is not with pixi 🙂 [Babylon.js Playground](https://playground.babylonjs.com/#X45GMZ) @MartynovOleg, would be great to use pg when it is possible as it helps us a lot for debugging.

It also works as expected:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/4/45122310cbd37cec219589949f63a17830f8adb2.png)

Basically, you are setting a full white texture meaning fully transparent on the legs which are on the OPAQUE mode so you would see the canvas background itself. In PBR you need to first choose a blend mode (it has the prio over anything else to enable a lot of various cases) and then if you rely on an opacity texture, it would be interesting to not have it full constant or you could simply play with the alpha property.

---

<div class="post-metadata">

**Author:** ![MartynovOleg](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/martynovoleg/32/4466_2.png) [@MartynovOleg](https://forum.babylonjs.com/u/MartynovOleg)\
**Post date:** [September 30, 2019, 4:09pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/6 "2019-09-30T16:09:19Z")

</div>

Thanks a lot) I used spector js for debugging once, but completely forgot about it. In this case, I tried to render the pixy picture and then the model, and in theory if her legs are transparent, and judging by your picture it is, I should have seen the picture through her legs, but they are still white and that’s it) Well now I will try to debug.

---

<div class="post-metadata">

**Author:** ![MartynovOleg](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/martynovoleg/32/4466_2.png) [@MartynovOleg](https://forum.babylonjs.com/u/MartynovOleg)\
**Post date:** [September 30, 2019, 5:08pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/7 "2019-09-30T17:08:23Z")

</div>

I get this result, my legs are transparent but the pixie picture is ignored, I don’t know why ((Do I need to select the blend mode? I just do not quite understand what you were talking about ((

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/6/6c57b97f814a315a6345a357a0e9ddd8dfba2b09.png)

---

<div class="post-metadata">

**Author:** ![MartynovOleg](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/martynovoleg/32/4466_2.png) [@MartynovOleg](https://forum.babylonjs.com/u/MartynovOleg)\
**Post date:** [September 30, 2019, 5:29pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/8 "2019-09-30T17:29:54Z")

</div>

It was necessary to set the transparencyMode parameter to 2 (ALPHABLEND)  
Thank you all))

---

<div class="post-metadata">

**Author:** ![MartynovOleg](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/martynovoleg/32/4466_2.png) [@MartynovOleg](https://forum.babylonjs.com/u/MartynovOleg)\
**Post date:** [September 30, 2019, 5:37pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/9 "2019-09-30T17:37:55Z")

</div>

Sorry, I didn’t notice at first. Now my shoulders are transparent. I don’t quite understand what the problem is ((Damn, the problems do not end there, solve this one and that’s it ((  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/9/98bd2008b1629decee57f881bbb806c583ad548a.png)

---

<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:** [September 30, 2019, 5:38pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/10 "2019-09-30T17:38:44Z")

</div>

Are they just not part of the same mesh ??? so reusing the same material ???

---

<div class="post-metadata">

**Author:** ![MartynovOleg](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/martynovoleg/32/4466_2.png) [@MartynovOleg](https://forum.babylonjs.com/u/MartynovOleg)\
**Post date:** [September 30, 2019, 5:38pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/11 "2019-09-30T17:38:45Z")

</div>

Moreover, if you turn the model sideways, then the shoulders are normal ((

---

<div class="post-metadata">

**Author:** ![MartynovOleg](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/martynovoleg/32/4466_2.png) [@MartynovOleg](https://forum.babylonjs.com/u/MartynovOleg)\
**Post date:** [September 30, 2019, 5:40pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/12 "2019-09-30T17:40:41Z")

</div>

Yes, you’re right, it’s the same mesh. If not for this, the problem would be solved by the usual dispose. But they don’t want to redo the model for me ((. Amm, should I ask that they make a normal opacity texture? “so reusing the same material ???” - what do you mean ?

---

<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:** [September 30, 2019, 5:47pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/13 "2019-09-30T17:47:31Z")

</div>

As it is one mesh, it uses the same setup so you can not sort the mesh correctly you need here to split your mesh to achieve what you try .

---

<div class="post-metadata">

**Author:** ![MartynovOleg](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/martynovoleg/32/4466_2.png) [@MartynovOleg](https://forum.babylonjs.com/u/MartynovOleg)\
**Post date:** [September 30, 2019, 5:55pm UTC](https://forum.babylonjs.com/t/problem-with-opacity-texture/6000/14 "2019-09-30T17:55:15Z")

</div>

Oк, I understood )
