Blacksite/docs/adr/0015-viewport-camera-stack-ownership.md
Rbanh 2054fa2558
Some checks are pending
CI / Format, lint, test, build (push) Waiting to run
Advance M0 scene and rendering foundations
2026-06-06 03:50:03 -04:00

44 lines
2.4 KiB
Markdown

# ADR 0015: Viewport camera stack ownership
## Status
Accepted
## Context
ADR 0014 unified the editor viewport render target and camera binding, but post-processing and GI
components were still stripped in multiple places (`scene_view`, play session, and full strip/reapply
in `render_view`). That caused WYSIWYG gaps between edit and play, lost FX after resize, and
interacted badly with `setup_project_camera_effects` filtering on `Without<Atmosphere>`.
Separately, `GiMode::Auto` could select Solari while point/spot lights were present.
Solari deferred skips the forward PBR light pass (ADR 0013), so local lights appeared editable
while producing no lighting.
Scene directionals hydrated with hardcoded cascade bounds that did not match project shadow settings
used by `ProjectSun`.
## Decision
1. **`game_hot::rendering::viewport_camera`** is the only module that adds/removes the viewport
render stack (`ProjectRenderCamera`, exposure, GI, atmosphere, bloom, fog, etc.).
2. **Editor** `scene_view` and `play/session` set `RenderTarget`, `Camera::is_active`, and
`viewport = None` only. **`render_view::sync_project_render_view`** calls
`clear_viewport_camera_stack` on owner handoff and `sync_viewport_camera_stack` on the active
camera (full apply on owner change; incremental when the stack already exists).
3. **`effective_viewport_gi_path`** does not switch paths for local lights. When Solari is active,
point/spot `LightDesc` authoring remains in the scene but hydrates no runtime light component,
and the inspector marks the component unsupported until authors switch to Directional or Forward.
4. **Scene directionals** use `cascade_config_from_rendering` from project settings at hydration;
`sync_scene_directional_shadow_cascades` updates cascades when settings change.
5. **Hydrated lights** always insert `Visibility::Visible` with runtime light components.
## Consequences
- Edit/play possession (F5/F8) and settings Apply no longer flash unlit frames from scattered FX strips.
- Rendering diagnostics can report unsupported Solari-local light authoring without changing the
selected GI path.
- Thumbnail studio and multi-viewport remain out of scope; they do not use the viewport camera sync path.
- `setup_project_camera_effects` no longer skips cameras that already have atmosphere; editor defers
player FX via `GameRenderBootstrap` and relies on `sync_project_render_view` once HDR RTT exists.