Hi,
I can imagine the way but never did it.

It needs portals as two different models. One looking to +X axe and the other to -X axe, so both models share their orientation in reference to the wall. First portal is placed looking in front of the wall and the second looking to the wall.

It needs three cameras, one for player and one for each portal. All same render target size and arc. Portal cameras are placed by computing offsets from portals to player, rotating them by portals inverse orientations (in order to get the offsets in object space of each portal), rotating them again by opposite portals orientations and adding opposite portals positions. The process is same for orientations but with angles, you know. As Wjbender stated, portal cameras need a clipping plane to be set so polygons behind portals are not drawn. Look at cameras PORTALCLIP flag, no mysteries. Portal cameras have to be rendered before player camera.

The shader of portals has to calculate the screen space coords of vertex inside vertex shader and sample the render target of their linked camera on pixel shader. I can't find the algorithm right now but it is very simple.

edited___________
Code:
outTex = outPos.xy / outPos.z;


if I am not wrong...

Last edited by txesmi; 01/14/16 22:34.