What is the impact if the render target is turned off?

Hi all.

I have question about target render in babylonjs. how do render targets work? and what is the impact when the render target is turned off ?

1 Like

Hello!

The render target can be seen as a buffer of memory where a scene can be rendered to. This has many uses, including saving this buffer as a screenshot: Render Scenes To .png Files | Babylon.js Documentation (babylonjs.com), rendering the same scene with different effects and compositing them: Render Target Texture With Multiple Passes | Babylon.js Documentation (babylonjs.com), and doing moving reflections: Reflections and Refractions | Babylon.js Documentation (babylonjs.com)

In a simple scene like the default playground one, turning off render targets won’t make a difference because they aren’t being used, but in a scene that uses them, turning it off can lead to inaccurate rendering. One example would be this scene with moving reflections ReflectionProbeTest | Babylon.js Playground (babylonjs.com), where turning the render target off will stop the reflection from updating, like here, where the green ball is in one place but the reflection in another:

On the upside, the performance will be better, since you’re rendering the scene less times.

3 Likes

oh I see, but if I use a lot of rendering in my scene, is there a way to optimize the rendering?

There are many ways to optimize a scene, depending on its type :slight_smile: I recommend always measuring the performance with The Performance Profiler | Babylon.js Documentation (babylonjs.com) and going through Optimizing Your Scene | Babylon.js Documentation (babylonjs.com) to see which methods suit your scene best.

1 Like

oh ok, thanks a lot @carolhmj, i get it now. :slightly_smiling_face: