# nhuart/pbr_renderer architecture

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

- Interactive diagram: https://gitdiagram.com/nhuart/pbr_renderer
- Repository: https://github.com/nhuart/pbr_renderer

## Overview

pbr_renderer is a Vulkan forward renderer configured by JSON scenes. The principal workflow is scene selection at the application entry point, scene loading into camera/model/light/effect settings, then rendering to HDR output and tone mapping for display or screenshot capture. The graph preserves documented surface shading, IBL, shadows, AO, volumetrics, and particles. Several renderer implementations are unsampled, so their links are marked unverified rather than presented as observed calls.

Main entry points: [`src/renderer/renderer.cpp`](https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/renderer.cpp) (Renderer orchestration), [`main.cpp`](https://github.com/nhuart/pbr_renderer/blob/main/main.cpp) (Application entry), [`src/scene/scene_loader.cpp`](https://github.com/nhuart/pbr_renderer/blob/main/src/scene/scene_loader.cpp) (JSON scene loader), [`src/renderer/tonemap_pipeline.cpp`](https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/tonemap_pipeline.cpp) (Tone mapping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application and scenes"]
  node_entry["Application entry<br/>[main.cpp]"]
  node_scene_data["Scene settings<br/>[types.hpp]"]
  node_scene_loader["JSON scene loader<br/>[scene_loader.cpp]"]
end

subgraph group_vulkan["Vulkan foundation"]
  node_context["Vulkan context<br/>[context.cpp]"]
  node_swapchain["Swapchain and HDR targets<br/>[swapchain.cpp]"]
  node_allocator["GPU resource allocation"]
end

subgraph group_surface["Surface rendering"]
  node_renderer["Renderer orchestration<br/>[renderer.cpp]"]
  node_gltf["glTF model loading<br/>[gltf_model_io.cpp]"]
  node_materials["Materials and lighting"]
end

subgraph group_effects["Render effects"]
  node_shadows["Shadow maps"]
  node_ao["SAO and GTAO<br/>[ao_pipeline.hpp]"]
  node_volumetrics["Volumetric rendering"]
  node_particles["Particle simulation"]
end

subgraph group_output["Output"]
  node_tonemap["Tone mapping"]
  node_capture["Screenshot capture"]
end

node_user(("Scene user"))
node_filament["Filament reference runner<br/>[app_runner.cpp]"]

node_user -.->|"selects scene"| node_entry
node_entry -->|"starts renderer"| node_renderer
node_entry -.->|"loads scene"| node_scene_loader
node_scene_loader -.->|"produces settings"| node_scene_data
node_renderer -.->|"uses settings"| node_scene_data
node_renderer -.->|"uses Vulkan"| node_context
node_renderer -.->|"renders to targets"| node_swapchain
node_renderer -.->|"loads models"| node_gltf
node_renderer -.->|"draws surfaces"| node_materials
node_renderer -.->|"renders shadows"| node_shadows
node_renderer -.->|"computes occlusion"| node_ao
node_renderer -.->|"renders volumes"| node_volumetrics
node_renderer -.->|"updates particles"| node_particles
node_renderer -.->|"tone maps"| node_tonemap
node_tonemap -.->|"writes display output"| node_swapchain
node_renderer -.->|"captures frame"| node_capture
node_renderer -.->|"allocates resources"| node_allocator
node_filament -.->|"provides comparisons"| node_user

click node_entry "https://github.com/nhuart/pbr_renderer/blob/main/main.cpp"
click node_scene_data "https://github.com/nhuart/pbr_renderer/blob/main/src/scene/types.hpp"
click node_scene_loader "https://github.com/nhuart/pbr_renderer/blob/main/src/scene/scene_loader.cpp"
click node_renderer "https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/renderer.cpp"
click node_context "https://github.com/nhuart/pbr_renderer/blob/main/src/core/context.cpp"
click node_swapchain "https://github.com/nhuart/pbr_renderer/blob/main/src/core/swapchain.cpp"
click node_allocator "https://github.com/nhuart/pbr_renderer/blob/main/src/core/resource_allocator.cpp"
click node_gltf "https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/gltf_model_io.cpp"
click node_materials "https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/renderer_materials.cpp"
click node_shadows "https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/shadow_pipeline.cpp"
click node_ao "https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/ao_pipeline.hpp"
click node_volumetrics "https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/volumetric_pipeline.cpp"
click node_particles "https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/particle_pipeline.cpp"
click node_tonemap "https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/tonemap_pipeline.cpp"
click node_filament "https://github.com/nhuart/pbr_renderer/blob/main/filament/app_runner.cpp"
click node_capture "https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/renderer_capture.cpp"

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_entry,node_scene_data,node_scene_loader,node_user toneBlue
class node_context,node_swapchain,node_allocator toneAmber
class node_renderer,node_gltf,node_materials toneMint
class node_shadows,node_ao,node_volumetrics,node_particles toneRose
class node_tonemap,node_capture toneIndigo
class node_filament toneTeal
```

## Components

### Application and scenes

- [Application entry](https://github.com/nhuart/pbr_renderer/blob/main/main.cpp): `main.cpp`
- [Scene settings](https://github.com/nhuart/pbr_renderer/blob/main/src/scene/types.hpp): `src/scene/types.hpp`
- [JSON scene loader](https://github.com/nhuart/pbr_renderer/blob/main/src/scene/scene_loader.cpp): `src/scene/scene_loader.cpp`

### Vulkan foundation

- [Vulkan context](https://github.com/nhuart/pbr_renderer/blob/main/src/core/context.cpp): `src/core/context.cpp`
- [Swapchain and HDR targets](https://github.com/nhuart/pbr_renderer/blob/main/src/core/swapchain.cpp): `src/core/swapchain.cpp`
- [GPU resource allocation](https://github.com/nhuart/pbr_renderer/blob/main/src/core/resource_allocator.cpp): `src/core/resource_allocator.cpp`

### Surface rendering

- [Renderer orchestration](https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/renderer.cpp): `src/renderer/renderer.cpp`
- [glTF model loading](https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/gltf_model_io.cpp): `src/renderer/gltf_model_io.cpp`
- [Materials and lighting](https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/renderer_materials.cpp): `src/renderer/renderer_materials.cpp`

### Render effects

- [Shadow maps](https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/shadow_pipeline.cpp): `src/renderer/shadow_pipeline.cpp`
- [SAO and GTAO](https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/ao_pipeline.hpp): `src/renderer/ao_pipeline.hpp`
- [Volumetric rendering](https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/volumetric_pipeline.cpp): `src/renderer/volumetric_pipeline.cpp`
- [Particle simulation](https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/particle_pipeline.cpp): `src/renderer/particle_pipeline.cpp`

### Output

- [Tone mapping](https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/tonemap_pipeline.cpp): `src/renderer/tonemap_pipeline.cpp`
- [Screenshot capture](https://github.com/nhuart/pbr_renderer/blob/main/src/renderer/renderer_capture.cpp): `src/renderer/renderer_capture.cpp`

### Other components

- **Scene user**
- [Filament reference runner](https://github.com/nhuart/pbr_renderer/blob/main/filament/app_runner.cpp): `filament/app_runner.cpp`

## Connections

- Scene user → Application entry: selects scene
- Application entry → Renderer orchestration: starts renderer (evidence: `main.cpp`)
- Application entry → JSON scene loader: loads scene
- JSON scene loader → Scene settings: produces settings
- Renderer orchestration → Scene settings: uses settings
- Renderer orchestration → Vulkan context: uses Vulkan
- Renderer orchestration → Swapchain and HDR targets: renders to targets
- Renderer orchestration → glTF model loading: loads models
- Renderer orchestration → Materials and lighting: draws surfaces
- Renderer orchestration → Shadow maps: renders shadows
- Renderer orchestration → SAO and GTAO: computes occlusion
- Renderer orchestration → Volumetric rendering: renders volumes
- Renderer orchestration → Particle simulation: updates particles
- Renderer orchestration → Tone mapping: tone maps
- Tone mapping → Swapchain and HDR targets: writes display output
- Renderer orchestration → Screenshot capture: captures frame
- Renderer orchestration → GPU resource allocation: allocates resources
- Filament reference runner → Scene user: provides comparisons
