RenderTarget on demand rendering

I am trying to get this to work without changing the engine render loop. Is there a way to render a scene - once - to a rendertarget outside the normal rendering?

I want to use this rendertarget output as the input to another rendertarget.

Ideally a scene.render() that I can call from anywhere to render that scene - in the case of this playground it would be rttscene.render()

You can manually render the RTT as part of the scene’s render loop. Something like this - Draw plane to render target and show it on material | Babylon.js Playground (babylonjs.com). Is that the effect you are looking for? (You can also render the other scene, if you are looking for a more complex scenario - Draw plane to render target and show it on material | Babylon.js Playground (babylonjs.com))

1 Like

The thing is I need to use the result of the rendertarget as an input to another rendertarget. Is it not possible to render outside the render loop?

If I daisy chain these up and run the chain inside the render loop will that work? eg; render the first target, and then use that as an input to a shader and then render the next render target, and so on?

you can decide when to render, but you need to be sure the resources needed to render are already available (or “ready”). In your case RTT one needs to wait for the resources to render correctly, and then RTT2 needs to wait for RTT1 to render in order to render correctly.

Thanks - that worked!

1 Like