# theobaudoinlighting/blackframe-renderer architecture

> Architecture diagram of the GitHub repository theobaudoinlighting/blackframe-renderer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/theobaudoinlighting/blackframe-renderer
- Repository: https://github.com/theobaudoinlighting/blackframe-renderer

## Overview

Blackframe is a headless spectral rendering engine. Its main workflow parses a render request, reads and compiles a native scene, preflights the explicitly selected backend, renders, and writes image and metrics outputs. The README documents the major scene, transport, image, and backend capabilities; sampled code confirms key CLI, runner, JSON-reader, and CUDA-query responsibilities. Some internal links rely on README descriptions because the relevant implementation files were not sampled.

Main entry points: [`Blackframe/Applications/Headless/Source/NativeSceneRunner.cpp`](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Applications/Headless/Source/NativeSceneRunner.cpp) (Scene runner), [`Blackframe/Engine/Source/SceneMisStages.cpp`](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/SceneMisStages.cpp) (Spectral transport), [`Blackframe/Applications/Headless/Source/CommandLine.cpp`](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Applications/Headless/Source/CommandLine.cpp) (CLI parser), [`Blackframe/Engine/Source/SceneCompiler.cpp`](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/SceneCompiler.cpp) (Scene compiler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Headless application"]
  node_cli["CLI parser<br/>[CommandLine.cpp]"]
  node_runner["Scene runner"]
end

subgraph group_scene["Scene preparation"]
  node_json["Native JSON codec"]
  node_assets["Asset resolver"]
  node_mesh["Mesh import"]
  node_compiler["Scene compiler<br/>[SceneCompiler.cpp]"]
  node_snapshot["Frame snapshot<br/>[FrameScene.cpp]"]
end

subgraph group_transport["Rendering core"]
  node_transport["Spectral transport<br/>[SceneMisStages.cpp]"]
  node_sampling["Sampling and lights<br/>[LightSampler.cpp]"]
  node_materials["Material closures<br/>[ClosureMixture.hpp]"]
  node_film["Film accumulation<br/>[Film.hpp]"]
  node_images["Image textures<br/>[HostImageCache.cpp]"]
end

subgraph group_backend["Execution backends"]
  node_scalar["Scalar reference"]
  node_cpu["Embree CPU"]
  node_gpu["CUDA wavefront"]
  node_query["CUDA scene query<br/>[SceneQuery.cpp]"]
end

subgraph group_io["IPC and output"]
  node_output["Image and metrics output"]
  node_ipc["Local IPC"]
  node_protocol["Protocol framing"]
end

node_user(("Render user"))

node_user -->|"submits request"| node_cli
node_cli -->|"dispatches render"| node_runner
node_runner -->|"loads scene"| node_json
node_runner -->|"compiles scene"| node_compiler
node_compiler -->|"lowers scene"| node_snapshot
node_compiler -->|"resolves assets"| node_assets
node_json -->|"decodes meshes"| node_mesh
node_runner -->|"selects backend"| node_scalar
node_runner -->|"selects backend"| node_cpu
node_runner -->|"selects backend"| node_gpu
node_cpu -->|"executes transport"| node_transport
node_gpu -->|"executes transport"| node_transport
node_scalar -->|"executes transport"| node_transport
node_transport -->|"uses light sampling"| node_sampling
node_transport -->|"evaluates closures"| node_materials
node_transport -->|"accumulates samples"| node_film
node_transport -->|"samples textures"| node_images
node_gpu -->|"queries scene"| node_query
node_runner -->|"writes results"| node_output
node_cli -->|"serves requests"| node_ipc
node_ipc -->|"frames messages"| node_protocol

click node_cli "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Applications/Headless/Source/CommandLine.cpp"
click node_runner "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Applications/Headless/Source/NativeSceneRunner.cpp"
click node_json "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/SceneDescriptionJsonReader.cpp"
click node_assets "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/SceneAssetResolver.cpp"
click node_mesh "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/TriangleMeshImport.cpp"
click node_compiler "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/SceneCompiler.cpp"
click node_snapshot "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/FrameScene.cpp"
click node_transport "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/SceneMisStages.cpp"
click node_sampling "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Renderer/Source/LightSampler.cpp"
click node_materials "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Renderer/Include/Blackframe/Renderer/ClosureMixture.hpp"
click node_film "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Renderer/Include/Blackframe/Renderer/Film.hpp"
click node_images "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Renderer/Source/HostImageCache.cpp"
click node_scalar "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/SceneMisPathLoop.cpp"
click node_cpu "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Backends/CPU/Embree/Source/WavefrontMisTransport.cpp"
click node_gpu "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Backends/GPU/CUDA/Source/WavefrontTransport.cpp"
click node_query "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Backends/GPU/CUDA/Source/SceneQuery.cpp"
click node_output "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Applications/Headless/Source/NativeSceneRunner.cpp"
click node_ipc "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/IPC/Source/LocalTransportPosix.cpp"
click node_protocol "https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/IPC/Source/LocalTransportFraming.hpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_runner,node_user toneBlue
class node_json,node_assets,node_mesh,node_compiler,node_snapshot toneAmber
class node_transport,node_sampling,node_materials,node_film,node_images toneMint
class node_scalar,node_cpu,node_gpu,node_query toneRose
class node_output,node_ipc,node_protocol toneIndigo
```

## Components

### Headless application

- [CLI parser](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Applications/Headless/Source/CommandLine.cpp): `Blackframe/Applications/Headless/Source/CommandLine.cpp`
- [Scene runner](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Applications/Headless/Source/NativeSceneRunner.cpp): `Blackframe/Applications/Headless/Source/NativeSceneRunner.cpp`

### Scene preparation

- [Native JSON codec](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/SceneDescriptionJsonReader.cpp): `Blackframe/Engine/Source/SceneDescriptionJsonReader.cpp`
- [Asset resolver](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/SceneAssetResolver.cpp): `Blackframe/Engine/Source/SceneAssetResolver.cpp`
- [Mesh import](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/TriangleMeshImport.cpp): `Blackframe/Engine/Source/TriangleMeshImport.cpp`
- [Scene compiler](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/SceneCompiler.cpp): `Blackframe/Engine/Source/SceneCompiler.cpp`
- [Frame snapshot](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/FrameScene.cpp): `Blackframe/Engine/Source/FrameScene.cpp`

### Rendering core

- [Spectral transport](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/SceneMisStages.cpp): `Blackframe/Engine/Source/SceneMisStages.cpp`
- [Sampling and lights](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Renderer/Source/LightSampler.cpp): `Blackframe/Renderer/Source/LightSampler.cpp`
- [Material closures](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Renderer/Include/Blackframe/Renderer/ClosureMixture.hpp): `Blackframe/Renderer/Include/Blackframe/Renderer/ClosureMixture.hpp`
- [Film accumulation](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Renderer/Include/Blackframe/Renderer/Film.hpp): `Blackframe/Renderer/Include/Blackframe/Renderer/Film.hpp`
- [Image textures](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Renderer/Source/HostImageCache.cpp): `Blackframe/Renderer/Source/HostImageCache.cpp`

### Execution backends

- [Scalar reference](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Engine/Source/SceneMisPathLoop.cpp): `Blackframe/Engine/Source/SceneMisPathLoop.cpp`
- [Embree CPU](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Backends/CPU/Embree/Source/WavefrontMisTransport.cpp): `Blackframe/Backends/CPU/Embree/Source/WavefrontMisTransport.cpp`
- [CUDA wavefront](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Backends/GPU/CUDA/Source/WavefrontTransport.cpp): `Blackframe/Backends/GPU/CUDA/Source/WavefrontTransport.cpp`
- [CUDA scene query](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Backends/GPU/CUDA/Source/SceneQuery.cpp): `Blackframe/Backends/GPU/CUDA/Source/SceneQuery.cpp`

### IPC and output

- [Image and metrics output](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/Applications/Headless/Source/NativeSceneRunner.cpp): `Blackframe/Applications/Headless/Source/NativeSceneRunner.cpp`
- [Local IPC](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/IPC/Source/LocalTransportPosix.cpp): `Blackframe/IPC/Source/LocalTransportPosix.cpp`
- [Protocol framing](https://github.com/theobaudoinlighting/blackframe-renderer/blob/main/Blackframe/IPC/Source/LocalTransportFraming.hpp): `Blackframe/IPC/Source/LocalTransportFraming.hpp`

### Other components

- **Render user**

## Connections

- Render user → CLI parser: submits request
- CLI parser → Scene runner: dispatches render
- Scene runner → Native JSON codec: loads scene (evidence: `Blackframe/Applications/Headless/Source/NativeSceneRunner.cpp`)
- Scene runner → Scene compiler: compiles scene (evidence: `Blackframe/Applications/Headless/Source/NativeSceneRunner.cpp`)
- Scene compiler → Frame snapshot: lowers scene (evidence: `README.md`)
- Scene compiler → Asset resolver: resolves assets (evidence: `README.md`)
- Native JSON codec → Mesh import: decodes meshes (evidence: `README.md`)
- Scene runner → Scalar reference: selects backend (evidence: `README.md`)
- Scene runner → Embree CPU: selects backend (evidence: `README.md`)
- Scene runner → CUDA wavefront: selects backend (evidence: `README.md`)
- Embree CPU → Spectral transport: executes transport (evidence: `README.md`)
- CUDA wavefront → Spectral transport: executes transport (evidence: `README.md`)
- Scalar reference → Spectral transport: executes transport (evidence: `README.md`)
- Spectral transport → Sampling and lights: uses light sampling (evidence: `README.md`)
- Spectral transport → Material closures: evaluates closures (evidence: `README.md`)
- Spectral transport → Film accumulation: accumulates samples (evidence: `README.md`)
- Spectral transport → Image textures: samples textures (evidence: `README.md`)
- CUDA wavefront → CUDA scene query: queries scene (evidence: `Blackframe/Backends/GPU/CUDA/Source/SceneQuery.cpp`)
- Scene runner → Image and metrics output: writes results (evidence: `README.md`)
- CLI parser → Local IPC: serves requests
- Local IPC → Protocol framing: frames messages (evidence: `Blackframe/IPC/Source/LocalTransportPosix.cpp`)
