Portal problems

Greetings babylonians!

Having trouble with this simple portal mock up:

[https://playground.babylonjs.com/#1OEPUZ#5]

It looks like I’m getting my coordinates wrong.
I’m using an arc rotate camera, and for the portal material I’m using a render target texture, with a shader material to adjust the clipping. The portal seems back-to-front, and no amount of flipping/rotating in the world/camera coordinates, render texture or shader code being able to fix it.
Is this an issue with using an Arc rotate camera? I have tried free cameras, as well as matrix multiplications and quaternions to no avail, as they’re above my maths skill.

Could anyone please help with this? Can provide more information if needed.

J.W

p.s Love Babylonjs! A giant THANK YOU to the team!

I can not wrap my head around I am looking into :slight_smile:

Could you create a simpler repro ? maybe with only 1 object ?

@Evgeni_Popov in case you catch the issue

Yes, that would be better with a simpler PG, as I don’t know what we are supposed to see in the current PG(?)

Thanks for the fast response. Amazing!

Hopefully this helps:

https://playground.babylonjs.com/#1OEPUZ#6

I’m trying to re-create a simple portal master/slave camera set-up. The slave camera is rendering its output onto a “portal” texture, which is adjusted by a vert and frag shader.
I cannot get the two cameras to align with the portals properly, and problems rending from backfaces. I think it is my maths, rather than a problem with babylon.

Can elaborate more if needed.

Thanks again!
You’re AMAZING!

I’m not sure you can do two portals with a single RTT. I would imagine you need to perform two rendering, one for each portal?

Maybe this video can help: Coding Adventure: Portals - YouTube

1 Like

Thanks for the response!

I got two portals working with two RTT’s.

I’m now struggling with rotations.
I’m using transforNodes and parenting but can’t seem to get things to align. See:

https://playground.babylonjs.com/#1OEPUZ#7

In this pg, I have two “rooms”, one red, and the green one which is showing the inverse rotation needed for the camera. It starts off correct but slowly go out of alignment. I’m using 6 transformNode.roate() (one for each axis x 2) which doesn’t seem right. I’ve tried transformNode.rotation() but cannot get the second “green” room to align properly.

Are you ale to spot what I’m getting wrong?

Thank you so much!

J.W