# Mesh visibility vs Material alpha

**URL:** <https://forum.babylonjs.com/t/mesh-visibility-vs-material-alpha/10288>\
**Category:** Questions\
**Created:** [April 24, 2020, 2:51pm UTC](https://forum.babylonjs.com/t/mesh-visibility-vs-material-alpha/10288 "2020-04-24T14:51:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Corentin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/corentin/32/4861_2.png) [@Corentin](https://forum.babylonjs.com/u/Corentin)\
**Post date:** [April 24, 2020, 2:51pm UTC](https://forum.babylonjs.com/t/mesh-visibility-vs-material-alpha/10288/1 "2020-04-24T14:51:56Z")

</div>

Hello,

I really can’t understand what’s is the exact difference between the two ; Mesh visibility vs Material alpha.  
I’ve seen a playground visually showing me the difference during my research but I would like to understand the difference.

Also, what if instead of using babylon material, I have my own shader material and I’m setting the frag alpha, is the same alpha as material alpha on babylon material, or is the same as the mesh visiblity ? I though mesh visibility was an added uniform to calculate material alpha so at the end mat.alpha = mesh.visibility \* alpha but probably not.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 24, 2020, 3:23pm UTC](https://forum.babylonjs.com/t/mesh-visibility-vs-material-alpha/10288/2 "2020-04-24T15:23:21Z")

</div>

The alpha value of the material is used as the starting value of all alpha computation:

1. alpha = material.alpha
2. alpha = alpha \* baseColor.a
3. alpha = alpha \* opacityMap.a
4. alpha = alpha \* vertexColor.a
5. alpha is modified by opacity Fresnel
6. alpha is modified by “specular over alpha” / “reflection over alpha”

Note that some of those steps will be done only if some specifics flags are set / variables have some specific value.

Then, after all those computations are done, the mesh.visibility is applied:

- final alpha = alpha \* mesh.visibility
