Transition between cameras?

Hello all,

Im trying to transition between 2 cameras using a plane, not too sure how to achieve that. The idea is to drag the screen left right, and depending on where I am, I will see a amount of camera 1 and/or 2.

I’m thinking about rendering to 2 textures (one for each camera) and rebuilding a final texture. But maybe there is something to do with stencils?

Any ideas?

thanks!

1 Like

Hi @memleak,

Have you tried playing with the camera rect, gradually decreasing it for camera1 and increasing it for camera2?

https://developer.playcanvas.com/en/tutorials/multiple-viewport-rendering/

1 Like

Using rendering to texture would be the simplest. I’d probably render one side directly to framebuffer (the larger side - so swap this as the line moves), the other to texture and then put it on top.

The other option could be to replace a chunk of the standard material fragment shader to discard pixels on the “other side” - this way you’d render both sides to framebuffer, but set culling x coordinate as a fragment parameter to discard pixels.

2 Likes

I was thinking about that but I think viewports don’t clip, it’s effectively a resized window.

Good point, to be honest I haven’t tried it myself.

I think render to texture as @mvaligursky may be the best option, you can also potentially use a shader to make an effect upon the transition.

I was thinking of rendering to two textures and using the UI masking tool to clip one side?

I did see a project where you can drag one thing and the other so it is possible.

Thank you all for your input!

2 Likes

Hi @memleak! Have you found a way to do this?

not yet!