# renderList with all meshes

**URL:** <https://forum.babylonjs.com/t/renderlist-with-all-meshes/43995>\
**Category:** Questions\
**Tags:** render-target\
**Created:** [September 10, 2023, 1:14pm UTC](https://forum.babylonjs.com/t/renderlist-with-all-meshes/43995 "2023-09-10T13:14:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rainerheintzmann/32/32692_2.png) [@RainerHeintzmann](https://forum.babylonjs.com/u/RainerHeintzmann)\
**Post date:** [September 10, 2023, 1:14pm UTC](https://forum.babylonjs.com/t/renderlist-with-all-meshes/43995/1 "2023-09-10T13:14:49Z")

</div>

Is it possible to set the renderList of a mesh texture (e.g. reflectionTexture) to automatically include all meshes?  
I guess a potential problem could be the mesh to which the texture is attached, but since this is rendered from the inside, it is probably automatically excluded correct.  
So if there is a global renderList, which automatically keeps track of all meshes, one could possibly just assing this list as the renderList?  
I am asking since it is a bit cumbersome to keep track of all meshes to insert them into renderlists of others, particularly, if these meshes are generated one by one in a scriptable way.

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rainerheintzmann/32/32692_2.png) [@RainerHeintzmann](https://forum.babylonjs.com/u/RainerHeintzmann)\
**Post date:** [September 10, 2023, 1:35pm UTC](https://forum.babylonjs.com/t/renderlist-with-all-meshes/43995/2 "2023-09-10T13:35:08Z")

</div>

… tried to at least use the same `renderList` for all such reflecting objects, but this does not seem to work. Neither by an empty Vector `[]` not by making a dummy refection object from which to borrow the render-list. As it seems `renderLists` cannot be assigned and they cannot be shared between meshes?  
See this example:

> **[Babylon.js Playground](https://playground.babylonjs.com/#KA93U%231352)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<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:** [September 11, 2023, 10:46am UTC](https://forum.babylonjs.com/t/renderlist-with-all-meshes/43995/3 "2023-09-11T10:46:51Z")

</div>

You can simply set `renderList` to `null` to automatically use all the active meshes.

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rainerheintzmann/32/32692_2.png) [@RainerHeintzmann](https://forum.babylonjs.com/u/RainerHeintzmann)\
**Post date:** [September 11, 2023, 1:52pm UTC](https://forum.babylonjs.com/t/renderlist-with-all-meshes/43995/4 "2023-09-11T13:52:23Z")

</div>

This is what I tried before, but it does not seem to work:

> **[Babylon.js Playground](https://playground.babylonjs.com/#KA93U%231360)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

except the very first one (the ground) works, but all other reflections are gone.

---

<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:** [September 11, 2023, 2:23pm UTC](https://forum.babylonjs.com/t/renderlist-with-all-meshes/43995/5 "2023-09-11T14:23:30Z")

</div>

There’s no setter for the `renderList` property on `ReflectionProbe`, only a getter.

If you want to set the value, you must do it through the texture: `probe.cubeTexture.renderList = null;`.

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rainerheintzmann/32/32692_2.png) [@RainerHeintzmann](https://forum.babylonjs.com/u/RainerHeintzmann)\
**Post date:** [September 11, 2023, 3:18pm UTC](https://forum.babylonjs.com/t/renderlist-with-all-meshes/43995/6 "2023-09-11T15:18:15Z")

</div>

Wow. This is the type of problem, which can cost you many hours to fix in JavaScript…  
Thanks. Indeed it works:

> **[Babylon.js Playground](https://playground.babylonjs.com/#KA93U%231364)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

For some reason the ground material has no CubeTexture, but the others do. Maybe one should implement a setter to avoid this problem?

---

<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:** [September 11, 2023, 3:58pm UTC](https://forum.babylonjs.com/t/renderlist-with-all-meshes/43995/7 "2023-09-11T15:58:07Z")

</div>

Indeed, here’s a PR that adds the setter:

> <https://github.com/BabylonJS/Babylon.js/pull/14287>
>
> See https://forum.babylonjs.com/t/renderlist-with-all-meshes/43995/5

Note that you have an error in your PG:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/3/930e53fbe0e34a29f93bf3e67be48fa0e222bdd3.png)

That’s because you can’t use a texture in your shader that you are currently rendering into.

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rainerheintzmann/32/32692_2.png) [@RainerHeintzmann](https://forum.babylonjs.com/u/RainerHeintzmann)\
**Post date:** [September 12, 2023, 8:19am UTC](https://forum.babylonjs.com/t/renderlist-with-all-meshes/43995/8 "2023-09-12T08:19:30Z")

</div>

Thanks for pointing this out. But this means, that the null assignment is useless after all?  
Yet it still somehow works, even with that error.  
Should not the PR also automatically eliminate the mesh with the rendering texture from the render list?

---

<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:** [September 12, 2023, 9:56am UTC](https://forum.babylonjs.com/t/renderlist-with-all-meshes/43995/9 "2023-09-12T09:56:20Z")

</div>

> [@RainerHeintzmann](#):
>
> Thanks for pointing this out. But this means, that the null assignment is useless after all?

In your case, yes, the mesh with a material which is using the render target texture must not be pushed in the renderList of that render target texture.

> [@RainerHeintzmann](#):
>
> Yet it still somehow works, even with that error.

You can’t rely on that behavior, as it’s an error to do it this way. And in WebGPU, you don’t have any rendering.

> [@RainerHeintzmann](#):
>
> Should not the PR also automatically eliminate the mesh with the rendering texture from the render list?

The PR simply let’s you assign a value to `renderList`. When the render target is rendered, we don’t check if a material would use the same texture than the render target texture: it would take too much time to check all materials each time we render. It’s the user responsibility to manage the list.
