# Mirror texture with freezing active meshes

**URL:** <https://forum.babylonjs.com/t/mirror-texture-with-freezing-active-meshes/8278>\
**Category:** Bugs\
**Created:** [January 28, 2020, 1:56pm UTC](https://forum.babylonjs.com/t/mirror-texture-with-freezing-active-meshes/8278 "2020-01-28T13:56:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![alvov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alvov/32/2061_2.png) [@alvov](https://forum.babylonjs.com/u/alvov)\
**Post date:** [January 28, 2020, 1:56pm UTC](https://forum.babylonjs.com/t/mirror-texture-with-freezing-active-meshes/8278/1 "2020-01-28T13:56:29Z")

</div>

Hello!  
I’m experiencing the reflection on the mirror texture to stop updating after I freeze active meshes for the scene. If you look at this PG [Babylon.js Playground](https://www.babylonjs-playground.com/#XYIK0Q) :

- at first the red ball is animated along with its reflection
- after 3 sec `scene.freezeActiveMeshes()` is called
- after that the reflection stops updating

A similar issue was raised here:

> [@What is active mesh / freezeActiveMeshes](https://forum.babylonjs.com/t/what-is-active-mesh-freezeactivemeshes/3008/8):
>
> I finllay have a PG for that but i cant figure out how to load texture frowning[https://www.babylonjs-playground.com/#XYDFLV#1](https://www.babylonjs-playground.com/#XYDFLV#1) Or you can see the result here : [SM - 3D](https://my-chronicles.net/_sm-3d/appart_3d.php) The mirror is in the bathroom straight ahead (actually with freezeActivaMeshes enabled) If I desactivate freezActiveMeshes, the mirror has the good behavior

but it was not solved, as far as i understand.

Thanks!

---

<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:** [January 28, 2020, 4:27pm UTC](https://forum.babylonjs.com/t/mirror-texture-with-freezing-active-meshes/8278/2 "2020-01-28T16:27:04Z")

</div>

It’s kind of “by design”, @deltakosh or someone from the core will have to tell if it should stay as is or not, the question being: should the RTT textures used by mesh materials be updated when the active mesh list is frozen or not? For the time being, the answer is “no”. It’s debatable I think, as it’s not the meshes that are frozen (in which case freezing the RTT seems sensible) but the active mesh list (so the meshes themselves are still active)…

When the active mesh list is frozen, `scene._evaluateActiveMeshes()` is not run. However, it’s in the course of this function, namely in `_evaluateSubMesh()` that the RTTs used by materials are collected and put in the list of RTT to be rendered.

You can put those RTT to the list “by hand”, as in:

[https://www.babylonjs-playground.com/#XYIK0Q#1](https://www.babylonjs-playground.com/#XYIK0Q#1)

But it’s a kind of hack as I access the `scene._renderTarget` array, which is a private property.

A less hacky way is to put the RTT from the mirrors to the `camera.customRenderTargets` array:

[https://www.babylonjs-playground.com/#XYIK0Q#2](https://www.babylonjs-playground.com/#XYIK0Q#2)

---

<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:** [January 28, 2020, 4:33pm UTC](https://forum.babylonjs.com/t/mirror-texture-with-freezing-active-meshes/8278/3 "2020-01-28T16:33:10Z")

</div>

> [@Evgeni\_Popov](#):
>
> A less hacky way is to put the RTT from the mirrors to the `camera.customRenderTargets` array

This is the recommended way 🙂 Maybe we can add it to the doc when talking about freezing active meshes?

---

<div class="post-metadata">

**Author:** ![alvov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alvov/32/2061_2.png) [@alvov](https://forum.babylonjs.com/u/alvov)\
**Post date:** [January 29, 2020, 11:49am UTC](https://forum.babylonjs.com/t/mirror-texture-with-freezing-active-meshes/8278/4 "2020-01-29T11:49:43Z")

</div>

Adding this to docs would be great 🙂

Thank you, will mark the `customRenderTargets` usage as the solution.

---

<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:** [January 29, 2020, 4:12pm UTC](https://forum.babylonjs.com/t/mirror-texture-with-freezing-active-meshes/8278/5 "2020-01-29T16:12:29Z")

</div>

Fancy doing the PR for the doc change?

---

<div class="post-metadata">

**Author:** ![alvov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alvov/32/2061_2.png) [@alvov](https://forum.babylonjs.com/u/alvov)\
**Post date:** [February 4, 2020, 10:22pm UTC](https://forum.babylonjs.com/t/mirror-texture-with-freezing-active-meshes/8278/6 "2020-02-04T22:22:24Z")

</div>

> PR for the doc change?

Can you please check this one [https://github.com/BabylonJS/Documentation/pull/1874](https://github.com/BabylonJS/Documentation/pull/1874) (and sorry for a late response)
