# 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, camera atmosphere settings, 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.
- On Bevy 0.19, the project owns one stable world-space `Atmosphere` entity and cameras receive
  `AtmosphereSettings`; render-stack sync strips stale camera-side `Atmosphere` components.
