Capturing a non Active Cameras Contents as an RTT

So how would one go about dumping what a what a none active camera sees into a texture or an rtt?

Its easy to do with the active camera, but I don’t think I have seen an example with a non active one.

I am basically looking into making a cubeCam unless we already have a method for that.

I know that you can set a rtt as a cube and generate a cubeTexture so maybe ill start there:
https://www.babylonjs-playground.com/#QOO0F#12

How can I access the different directions individually, from the what the engine.createRenderTargetCubeTexture function is creating?

Basically trying to make a light probe…

UPDATE
Ehhh… it looks like the method needs to be updated to be able to target a different camera then the active camera. Ill run some test and try to make this happen.
https://www.babylonjs-playground.com/#UU7RQ#311

Why not relying on How to use Reflection Probes - Babylon.js Documentation ?

This is exactly what they do. You could use this as your starting point. Please note that if would not work correctly if is intented to be used in PBR rough materials.

Nope, I was thinking of doing a custom shader that gets passed the light probes as a buffer that has the positions of each probe and then their directional color contributions then have that on a secondary mesh that will test which region the mesh is in and then get the weights of the different probes contributions then bam have that update the target meshs colors to simulate GI.

Maybe I just sound crazy, but i feel like that would work… I just have to have a system of light probes and then at least have 3-4 that define a region then kinda blend their contribution together in some sort of hacky way… I have not gotten that far into thinking about it though. I think I read a long time ago about how Unity does something like this.

and dang, did not even think about the reflection probe… I was super tired last night and looked at it for a second then skipped right over it when I did not see the position param.

np, this should at least be a good source of how to do the capture from the not visible camera.

1 Like