# Render current frame multiple times to separate images

**URL:** <https://forum.babylonjs.com/t/render-current-frame-multiple-times-to-separate-images/54663>\
**Category:** Questions\
**Created:** [November 9, 2024, 11:59pm UTC](https://forum.babylonjs.com/t/render-current-frame-multiple-times-to-separate-images/54663 "2024-11-09T23:59:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Heaust-ops](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/heaust-ops/32/45470_2.png) [@Heaust-ops](https://forum.babylonjs.com/u/Heaust-ops)\
**Post date:** [November 11, 2024, 4:59am UTC](https://forum.babylonjs.com/t/render-current-frame-multiple-times-to-separate-images/54663/2 "2024-11-11T04:59:50Z")

</div>

you can use [Render Target Texture](https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/renderTargetTextureMultiPass) to do most of it : )

for example here, I wanna render only the sphere and just red in color to a texture

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

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/c/7cc04602958e1ff36b6dcb6786f21a473a9204a1.png)  
and also get the depth of the scene  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/0/b0d7dfc259b7a5e7530885a40f08df8f9452aaff.png)

so you can, on each render, before your RTT renders, change the scene state to however you want and after the rtt render restore it : )  
and you can do this at a resolution you specify!

you can even have a separate camera for each different RTT by changing the `rtt.activeCamera`

you can get the depth in your chosen rtt like (say if you want it from a different res or cam)

> **[Babylon.js Playground](https://playground.babylonjs.com/#1PHYB0%23189)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

(source: [Using a custom depth texture source with post processes, rather than the DepthRenderer](https://forum.babylonjs.com/t/using-a-custom-depth-texture-source-with-post-processes-rather-than-the-depthrenderer/34007))

_(you can also use a `new DepthRenderer()` and the texture inside it like an rtt)_

as for timing it for animations, if you change the state before and after that’d work, but idrk about timing the render exactly tbh

---

_[View the full topic](https://forum.babylonjs.com/t/render-current-frame-multiple-times-to-separate-images/54663)._
