LEARNING GUIDE
Secondary-view rendering: declarations, ordering and limits
draft illustrativeOrigin: original-commentary · review: draft · snapshot: 3ba1c69afc74a97f-7fcd0798fd6ea455
Secondary-view rendering: declarations, ordering and limits
This guide explains the smallest evidence-backed shape for a second camera
view. It is original commentary over the pinned snapshot, not Facepunch
documentation.
What the snapshot establishes
The metadata declares `Sandbox.CameraComponent.RenderToTexture` with a target
texture and an optional `Sandbox.Rendering.ViewSetup`. It also declares camera
composition and scene-camera update operations. The indexed source contains
call sites and guards around camera rendering, command-list scheduling and
render-target lifetime. Those call sites explain implementation behaviour in
the supplied public tree; they do not establish that every step is callable by
game code in the installed build.
A safe working sequence
1. Check the active snapshot and resolve the exact overload, rather than using
the short name `RenderToTexture`.
2. Create or obtain the destination target before asking the camera to render.
Keep the target alive for the complete render pass and release it through
the owning resource contract.
3. Build a `ViewSetup` from the destination camera state. Treat projection,
clipping, viewport, fog and temporal history as explicit inputs; none of
them should be assumed to follow from a texture render.
4. Schedule the operation in the render phase supported by the selected
surface. A source call site is evidence of an engine path, not proof that a
game component may call it directly.
5. Restore the previous target and view state. Bound recursion and reject
re-entry before a second view can schedule itself indefinitely.
Common mistakes
destination texture does not move rigidbodies, contacts, or network
authority.
The portal workflow records this as a testable hypothesis for black tiles,
not as a verified cause.
snapshot carries obsolete attributes where present; resolve and display that
state before copying an example.
What remains unverified
No example in this handbook has been compiled or run against an installed
S&box build. Direct recursive framebuffer composition, fog transport and
temporal-resource reuse therefore remain bounded experiments. A useful probe
is one destination camera, one target, recursion disabled, and logging of pass
ordering, viewport, projection, history and cleanup.
Constraints and verification
- Evidence hash:
9f73ef5397bd865afd4bde913d7e4bcaa95a1f7d5e380b0847615b5bbcbc2a63 - Compile/runtime verification: illustrative
Linked API declarations
type:Sandbox.CameraComponentmethod:Sandbox.CameraComponent:RenderToTexture(Sandbox.Texture,Sandbox.Rendering.ViewSetup)method:Sandbox.CameraComponent:ComposeView()method:Sandbox.CameraComponent:UpdateSceneCamera(Sandbox.SceneCamera,System.Boolean)type:Sandbox.Rendering.ViewSetuptype:Sandbox.Rendering.RenderTargetHandle