ReadonlycameraThe camera the far side is drawn from
The pass adds it as a child of entry, then each frame overwrites its pose and copies the view
camera's mode, fov, zoom, near, far and orthographicSize, so setting those, or its
position and rotation, has no effect.
It draws no sky. To give the feed one, add a BackgroundPass on this camera from a
'beforeOpaque' pass listed before the portal. That pass runs even on frames the portal skips.
The camera's texture is cleared before its first pass each frame, so no clear pass is needed.
Whether this pass runs
Flipping it rebuilds the view's render graph on the next render, which suits a settings toggle but not a change every frame; animate an effect's own properties instead. It can also recompile the view's materials; View3D#passes says when.
ReadonlyentryThe quad the viewer looks through
ReadonlyexitThe quad on the far side; move it and the far view follows
Optional ReadonlyrequiredExtra outputs the view's scene draw writes beside its colour while this pass is enabled
Each costs the scene draw a texture and the shader work to fill it, and any output makes the view draw its scene into a texture first, as a post effect does. Reach an output's texture with RenderGraph#getSceneOutput, to read it or draw into it.
ReadonlystageAlways 'beforeOpaque', so the feed is finished before the scene draws the entry
ReadonlytextureThe texture the far side is drawn into; see PortalPassOptions#texture
Advanced
Adds the portal camera's opaque and transparent draws into texture
Render graph being built.
Renderer and shared handles for this build.
A texture portal: a second view of the scene, drawn from behind the exit and shown on the entry
Each frame the pass stands its camera behind the exit as the viewer stands before the entry and draws the scene from there into
texture. The entry's PortalMaterial shows that at the viewer's own screen position, so it reads as an opening rather than a picture. Both quads face their local+Z: the entry toward the viewer, the exit toward the room it shows. Give both the samescale: a scale only one of them has carries into the camera and resizes or stretches the far side. The wall the exit is cut into, and anything else between the camera and the exit, is left out. The pass draws nothing on frames the entry is hidden, off screen or seen from behind.It needs a perspective view camera and a view that isn't rotated: with an orthographic camera the far side doesn't show, and in a rotated view it doesn't line up with the opening.
A portal that can see itself, or two that face each other, recurse one frame late per level, as any Camera3D#renderTexture that films itself does. A portal draws only while its entry is in the view camera's sight, so one seen only through another portal doesn't update.
The far side draws only meshes in the
opaqueandtransparentpasses, with no sky: enclose the far room, or add one as PortalPass#camera shows.Example