novolis-governance / imports-todo/internal-novolis-audit/simulation-viewpose-to-rendering-bridge.md
Simulation `ViewPose` → Rendering `CameraSnapshot` bridge
Policies that keep the org coherent
dotnetgovernancenovolis
What
Standardize how apps connect platform observers (Simulation) to ray tracing (Rendering) without forbidden package references.
Types today:
| Package | Type | Role |
|---|---|---|
| `Novolis.Simulation.View` | `ViewPose` | Position, target, up, FOV° — compose-time observer |
| `Novolis.Rendering.Runtime` | `CameraSnapshot` | Orthonormal basis + vertical FOV radians + aspect |
| `Novolis.Math.Geometry` | `ViewBasis` | Basis construction + primary ray direction |
Gap: Every trace app repeats:
CameraSnapshot.LookAt(pose.Position, pose.Target, pose.Up, pose.FieldOfViewDegrees, aspect);Dogfood (RaytraceHello, SilkTrace*) calls CameraSnapshot directly; simulation-first games (DoomLite3D, ArtillerySimulator) build ViewPose then bridge manually.
Why
- library-boundaries.md: Rendering must not reference Simulation; Simulation must not reference Rendering.
- A shared “bridge” package is usually overkill for a one-liner; the problem is discoverability and drift (different FOV conventions, up-axis fixes).
- Documenting the canonical bridge prevents apps from reimplementing
LookAtmath incorrectly.
How
Recommended: app-layer extension (no new package)
Add to dogfooding shared helpers or copy into each app:
static CameraSnapshot ToCameraSnapshot(this ViewPose pose, float aspectRatio) =>
CameraSnapshot.LookAt(
pose.Position,
pose.Target,
pose.Up,
pose.FieldOfViewDegrees,
aspectRatio);Place in novolis-dogfooding shared project if one exists, or document in novolis-dogfooding/docs/design.md.
Platform improvements (allowed)
- `CameraSnapshot.LookAt` — delegate to
ViewBasis(see rendering-viewbasis-ray-generation.md) so Simulation and Rendering share basis math via Math only. - `Simulation.View` XML docs — “For path tracing, apps map to
CameraSnapshot.LookAtat compose time; Rendering does not reference Simulation.” - Optional `ViewPose` helper on Simulation side — only if it does not reference Rendering:
- e.g.
ViewPose.ToLookAtArgs()returning(position, target, up, fovDegrees)tuple for apps — rarely worth it.
Do not
- Add
CameraSnapshot.FromViewPose(ViewPose)on Rendering (would require Rendering → Simulation). - Add
Novolis.Simulation.Viewreference toNovolis.Rendering.*.
Pick / mouse rays
- Document that screen-space picking should use
ViewBasis.PrimaryRayDirectionwith the same basis asCameraSnapshot(see RagdollPlayBuildPickRay— candidate to align in dogfood doc).
Acceptance
novolis-dogfooding/docsor governance imports-todo cross-link shows the one-liner bridge.- No new forbidden dependency edges in solution graphs.
- At least one dogfood app uses the shared extension after rendering-viewbasis-ray-generation.md lands.