Render to a RenderTargetTexture from another camera than main camera

Hey, im struggling a little bit with render targets, i come from threejs, i d like to know how to achieve that:

render the scene from another point of view to a render target,
cause when i do use more than one camera i cant find a way to tell render target to only render with some specific camera

do you have an example/playground with that running?

As far as I understood your question you may try to use Multiviews - MultiViews Part 2 | Babylon.js Documentation
Here is the example with 3 cameras - https://www.babylonjs-playground.com/#SVZL1I#65
Also note that you can attach/detach control of every camera as you like to.

no really, if i ask this question its cause i got more complex stuff to do with the texture outputs from the render target, iā€™m building some kind of painter, the painter is on a 2D orthographic camera facing exactly the painting plane, then once rendered, i must use the rendertarget as a texture for a plane rendered normally from the main camera which is a perspective camera

so my question is really: is there some example where a second camera could be used only for a rendertarget, and the whole scene rendered by a first camera.

You can set the activeCamera property of the render target texture to use a different camera than the main scene camera:

https://playground.babylonjs.com/#IMNCPH

1 Like

ok weird then idk why my stuff doesnt work i though i did it the same, thank you i ll try to start back from your example

1 Like