# Issue with rendering occlusion of node materials

**URL:** <https://forum.babylonjs.com/t/issue-with-rendering-occlusion-of-node-materials/26143>\
**Category:** Questions\
**Created:** [December 17, 2021, 12:33pm UTC](https://forum.babylonjs.com/t/issue-with-rendering-occlusion-of-node-materials/26143 "2021-12-17T12:33:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Polymorrah](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polymorrah/32/19726_2.png) [@Polymorrah](https://forum.babylonjs.com/u/Polymorrah)\
**Post date:** [December 17, 2021, 12:33pm UTC](https://forum.babylonjs.com/t/issue-with-rendering-occlusion-of-node-materials/26143/1 "2021-12-17T12:33:01Z")

</div>

Hi, I’m sorry if this has been asked before, but I wasn’t able to find a solution.

difficult one to describe, but I have a playground: [https://playground.babylonjs.com/#PZAKBL#3](https://playground.babylonjs.com/#PZAKBL#3)

when I zoom in and out using the mousewheel, the materials of the clouds (ground mesh), and sky sphere render irregularly. When the camera position is inside the bounds of the sphere, when the camera position drops below clouds.position.y / 2, the sky sphere renders incorrectly in front of the clouds. Also relevant but less concerning is that when I zoom out, the clouds mesh renders incorrectly in front of the sphere.

this does not happen with standard materials: [https://playground.babylonjs.com/#PZAKBL#4](https://playground.babylonjs.com/#PZAKBL#4)

I will continue to investigate as usual, and would appreciate any insight.

thanks

---

<div class="post-metadata">

**Author:** ![Polymorrah](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polymorrah/32/19726_2.png) [@Polymorrah](https://forum.babylonjs.com/u/Polymorrah)\
**Post date:** [December 17, 2021, 1:51pm UTC](https://forum.babylonjs.com/t/issue-with-rendering-occlusion-of-node-materials/26143/2 "2021-12-17T13:51:27Z")

</div>

update: I was able to fix this from the perspective of inside the sphere, by setting: skyMesh.alphaIndex = 1, which means the sky will always render in the background, which is what I want. But I’m still curious as to how I could fix this so it behaves more like StandardMaterial in this case. Thanks

---

<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:** [December 17, 2021, 2:05pm UTC](https://forum.babylonjs.com/t/issue-with-rendering-occlusion-of-node-materials/26143/3 "2021-12-17T14:05:17Z")

</div>

This might help understanding better the limitation of transparent meshes: [Transparent Rendering | Babylon.js Documentation](https://doc.babylonjs.com/divingDeeper/materials/advanced/transparent_rendering)

---

<div class="post-metadata">

**Author:** ![Polymorrah](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polymorrah/32/19726_2.png) [@Polymorrah](https://forum.babylonjs.com/u/Polymorrah)\
**Post date:** [December 17, 2021, 2:36pm UTC](https://forum.babylonjs.com/t/issue-with-rendering-occlusion-of-node-materials/26143/4 "2021-12-17T14:36:33Z")

</div>

thank you. Apologies for all the questions. Sometimes the answers can be a little opaque. Forgive the pun 🙂 … I did reference that document, and I believe that’s where I found my fix. I guess I’m wondering why the standard material takes care of the depth buffer very elegantly, while with node material, this isn’t the case, and as always looking for an easy fix … In any case I will continue with my investigations. Thank you for your help in general and for this fantastic library.

---

<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:** [December 17, 2021, 2:37pm UTC](https://forum.babylonjs.com/t/issue-with-rendering-occlusion-of-node-materials/26143/5 "2021-12-17T14:37:49Z")

</div>

no problem, let see if @Evgeni_Popov has a better answer cause my brain is all foggy from covid at the moment 🙂

---

<div class="post-metadata">

**Author:** ![Polymorrah](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polymorrah/32/19726_2.png) [@Polymorrah](https://forum.babylonjs.com/u/Polymorrah)\
**Post date:** [December 17, 2021, 2:43pm UTC](https://forum.babylonjs.com/t/issue-with-rendering-occlusion-of-node-materials/26143/6 "2021-12-17T14:43:26Z")

</div>

😮 uff, sorry to hear, take care. Get well soon.

---

<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:** [December 17, 2021, 3:23pm UTC](https://forum.babylonjs.com/t/issue-with-rendering-occlusion-of-node-materials/26143/7 "2021-12-17T15:23:07Z")

</div>

That’s because you plugged something into the **a** input of the `FragmentOutput` block: the system considers your material to be transparent, even if alpha=1.

You should plug a `color3` into the `FragmentOutput.rgb` input instead and that should fix your problem.

---

<div class="post-metadata">

**Author:** ![Polymorrah](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polymorrah/32/19726_2.png) [@Polymorrah](https://forum.babylonjs.com/u/Polymorrah)\
**Post date:** [December 17, 2021, 3:30pm UTC](https://forum.babylonjs.com/t/issue-with-rendering-occlusion-of-node-materials/26143/8 "2021-12-17T15:30:01Z")

</div>

Ahhh ok, thank you!
