Heya, I’m working on a Portal effect, and I’ve watched a video explaining that I need the camera of the second portal to be relative to the world camera of the first camera. It’s a little bit confusing, but I get what it means (here’s an image)
note: the green camera is the world camera and the yellow camera is the viewportframe camera.
I would like to know the maths that I need to use to get this simple effect.
I’ve tried a couple of combinations of this:
if you want to transform a vector in one coordinate space (A) to another one in another coordinate space (B) you need to find the basis vectors of coordinate space B then multiply it by the matrix transformation using those basis vectors and the origin of the coordinate space. Since your cameras cframe is technically its own coordinate space (lookat matrix) you just do transformedAToB = B*A
I was trying to do this portal thing too but I was wondering how to make the viewport frame only show what was in the portal, the viewport frame camera is behind the other portal at the same distance that your camera is to the portal so the camera is zoomed out and doesn’t look like you are looking out of the other portal but instead you are looking behind the other portal, so how would you crop it to only show the space in front of the other portal, if you can understand this if not I’ll show an image tomorrow