My work porting Sebastian Lague’s “Coding Adventure: Portals” continues (PlayCanvas 3D HTML5 Game Engine), and I’ve arrived at the “Recursive portals” portion of the project:
https://www.youtube.com/watch?v=cWpFZbjtSQg&t=812s
As I hope is clear from the image below, my scene is rendered once with portals being invisible when viewed through a portal.
Sebastian Lague’s code repeatedly repositions the camera, calling portalCam.render()
to make a “sub-render” at each new position within the main portal render function.
for (int i = startIndex; i < recursionLimit; i++) {
portalCam.transform.SetPositionAndRotation(renderPositions[i], renderRotations[i]);
SetNearClipPlane();
HandleClipping();
portalCam.Render();
if (i == startIndex) {
linkedPortal.screen.material.SetInt("displayMask", 1);
}
}
As far as I can tell, in PlayCanvas there is no call to invoke a camera render.
The only potential workaround I’ve come up with would be to use multiple cameras, which seems overkill.
Is there camera.render()
function or equivalent?
Is there some other workaround?
TIA