RenderTargetTexture using multiple scenes at once

I am trying to use Babylon.js to have two different scenes at once, using RenderTargetTexture using the camera of one scene, to use it as material of a plane on another scene. Does anybody have a working example, or could possibly create one?

Hello and welcome!

A working example:

Switch to the second scene and the sphere will use the render target from the first scene. The code involved in creating the rtt and setting it as a texture:

    const rtt = new BABYLON.RenderTargetTexture('rtt', 2048)

    sphere1.material.emissiveTexture = rtt // sphere1 is on the second scene

First scene:



Thanks! This example is great! I got it to work in my own project with a few changes. I was wondering if it would be possible to have an example like this working if the scenes were contained in separate HTML canvases as well. Is something like that possible and are there any examples out there?

I know that there is a lot in the docs but I recommend you to go trough all the sections to get familiar what are the possibilites of the framework. Later you can get back to a specific section and learn how exactly the implementation looks like in detail.

Another good idea is to use the search functionality of the forum. You will get answers on nearly all your issues you coud face while you are slowly mastering the framework.


So here you go for now:

I’ll be sure to look at the documentation. Thanks for the advice and the links to relevant topics.

1 Like