# OpacityTexture - set "intensity"

**URL:** <https://forum.babylonjs.com/t/opacitytexture-set-intensity/5328>\
**Category:** Questions\
**Created:** [August 27, 2019, 10:31pm UTC](https://forum.babylonjs.com/t/opacitytexture-set-intensity/5328 "2019-08-27T22:31:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrGroove](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@MrGroove](https://forum.babylonjs.com/u/MrGroove)\
**Post date:** [August 27, 2019, 10:31pm UTC](https://forum.babylonjs.com/t/opacitytexture-set-intensity/5328/1 "2019-08-27T22:31:16Z")

</div>

In Babylon, I use an opacity texture for displaying transparent (pbr-)materials.  
Is it possible to set the intensity of this texture in order to adjust the opacity of the result?

For example, if I reduce the intenity of this opacity texture, the pbr material is getting less transparent?

Best regards

---

<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:** [August 28, 2019, 1:01am UTC](https://forum.babylonjs.com/t/opacitytexture-set-intensity/5328/2 "2019-08-28T01:01:21Z")

</div>

You can use the texture.level for that. This simply multiplies against the alpha in the texture.

---

<div class="post-metadata">

**Author:** ![MrGroove](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@MrGroove](https://forum.babylonjs.com/u/MrGroove)\
**Post date:** [August 28, 2019, 8:13am UTC](https://forum.babylonjs.com/t/opacitytexture-set-intensity/5328/3 "2019-08-28T08:13:23Z")

</div>

yes, but I would expect if I reduce the opacityTexture.level, the material will become less transparent?

---

<div class="post-metadata">

**Author:** ![MrGroove](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@MrGroove](https://forum.babylonjs.com/u/MrGroove)\
**Post date:** [August 28, 2019, 9:30am UTC](https://forum.babylonjs.com/t/opacitytexture-set-intensity/5328/4 "2019-08-28T09:30:47Z")

</div>

it should be like a “blending”

---

<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:** [August 28, 2019, 10:37am UTC](https://forum.babylonjs.com/t/opacitytexture-set-intensity/5328/5 "2019-08-28T10:37:54Z")

</div>

I see your point but I am afraid this would break back compat on this feature. Basically your code could set level = 1 - intensity

Summoning @Deltakosh to see if we should break back compat on this one ???

---

<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:** [August 28, 2019, 2:59pm UTC](https://forum.babylonjs.com/t/opacitytexture-set-intensity/5328/6 "2019-08-28T14:59:28Z")

</div>

I’m not sure this is used a lot but I would recommend to add a new parameter actually

---

<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:** [August 28, 2019, 4:40pm UTC](https://forum.babylonjs.com/t/opacitytexture-set-intensity/5328/7 "2019-08-28T16:40:26Z")

</div>

@MrGroove maybe you could add a new parameter on both standard and PBRMaterial to ensure the shader does a mix vs a multiply. This could be done under a flag as David mentionned (like opacityTextureLevelBlending) ?

Fancy doing a PR ?

or maybe you could use the famous customMaterial from @nasimiasl to customize the shader a bit ???

---

<div class="post-metadata">

**Author:** ![nasimiasl](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nasimiasl/32/34_2.png) [@nasimiasl](https://forum.babylonjs.com/u/nasimiasl)\
**Post date:** [August 29, 2019, 7:08am UTC](https://forum.babylonjs.com/t/opacitytexture-set-intensity/5328/8 "2019-08-29T07:08:13Z")

</div>

sorry i see this now  
[https://www.babylonjs-playground.com/#7AIII8#55](https://www.babylonjs-playground.com/#7AIII8#55)  
what kind of result suspected any pic or screenshot?

i think best way to use transparency use refract with cube map for pbr materials
