How to make mesh transparent (literally)

When i export mesh from maya (into GLTF) i always see transparent, but reflective material - just like a glass (i want to have totaly transparent material, just for positions). Do you have any ideas how to keep mesh (inside babylon), but disable from rendering. Or I just need to make proper shader in maya and then export into gltf.

My material settings in Maya:

Adding @Guillaume_Pelletier

1 Like

You could set the mesh alpha to 0?

Not sure how you would do it in Maya but in blender you can do it by setting the blende mode to alpha and set the alpha color to 0

e.g.

This is what it looks like in the babylon viewer -

1 Like

Thank you for support. I tried with different materials (phong, blinn,…) with no sucess, the “glass” effect is still here.

@PatrickRyan might know the answer as well ?

1 Like

@pantrej, there is really no way of passing a transparent mesh out of Maya other than setting the alpha on the material to 0 and then setting the blend mode in the Babylon properties node of the material to alphaMode BLEND. This will make the mesh transparent, but will cost you an extra draw call on your scene because you are not using transparent meshes. You will still incur the draw call for the extra mesh since you need to split out the mesh you wish to be transparent from the rest of your mesh to hold the new material as well since you don’t want to place your entire mesh in the transparent queue or you will end up with sorting issues.

The far simpler way to do this would be to create a node material that discards the pixels of the mesh it’s assigned to. This node material would be assigned to any mesh you want to be transparent so it won’t render, but is still active in the scene and does not incur extra draw calls. We are just discarding each pixel that renders in the smallest number of steps. The node material shader looks like this and as you can see in the preview window, there is no sphere rendering:

And you can grab this shader to use in your scene. You just need to build the node material as normal and then assign this new material to the mesh you want to be transparent.

Hope this unblocks you but feel free to ping with questions.

1 Like

@pantrej I also just realized what you were meaning by the glass effect. In Babylon.js, we have a notion of “specular over alpha” so that we still render specular reflections on meshes that have alpha applied without applying the alpha to the specular reflections. This was an old compromise with glTF to imply glass before there were transmission and refraction extensions for glTF. If you simply want to get rid of the specular over alpha simply set material.useSpecularOverAlpha to false:

Mastering PBR Materials | Babylon.js Documentation (babylonjs.com)

1 Like

Thank you very much! :+1::+1::+1:

1 Like