# doodlum/skyrim-community-shaders architecture

> Architecture diagram of the GitHub repository doodlum/skyrim-community-shaders, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/doodlum/skyrim-community-shaders
- Repository: https://github.com/doodlum/skyrim-community-shaders

## Overview

1. This repository is a Skyrim Special Edition / Skyrim VR SKSE plugin, not a standalone app. The runtime boundary is the game process: the DLL is loaded by SKSE, then the mod patches engine behavior, injects rendering logic, and renders its own UI over the game.

2. The codebase is split into a C++ plugin layer and a large shader/content layer. The C++ side lives mainly in `src/`, while feature-specific shader assets and feature metadata live under `features/` and shared runtime shaders live under `package/Shaders/`.

3. The central runtime orchestration is in the core plugin files: `src/XSEPlugin.cpp`, `src/Globals.*`, `src/State.*`, `src/Hooks.*`, and `src/Feature.*`. These establish the plugin lifecycle, manage global state, register hooks into engine and rendering paths, and dispatch work to individual features.

4. Features are the main architectural unit. Each feature has a C++ implementation under `src/Features/<Feature>.cpp|h` and usually a shader/config package under `features/<Feature Name>/Shaders/...`. Examples include upscaling, water, weather editing, screen-space GI/shadows, terrain effects, and VR support. This is a modular feature system rather than a monolith.

5. Rendering is heavily shader-driven. Shared HLSL utilities in `package/Shaders/Common/` and feature-specific shaders in `package/Shaders/` or `features/*/Shaders/` implement most visual effects. The C++ layer’s job is to bind resources, choose permutations, manage constants/buffers, and submit the correct shader passes at the right point in the frame.

6. There is a clear separation between engine-facing code and pure rendering/math code. Engine integration lives in modules like `src/ShaderTools/`, `src/TruePBR/`, `src/Deferred.*`, `src/EngineFixes/`, and utility wrappers in `src/Utils/`. Shared GPU-side abstractions are in `package/Shaders/Common/`, while the engine-facing C++ side handles hooks, state, and game data extraction.

7. Several subsystems are about fixing or extending Skyrim’s rendering pipeline itself, not just adding post-processing. Examples include `Deferred`, `TruePBR`, `EngineFixes`, `LightLimitFix`, `TerrainShadows`, `VolumetricLighting`, and `ScreenSpaceShadows`. These features likely sit on the boundary between game rendering internals and custom shader passes.

8. UI and configuration are another major subsystem. `src/Menu/` implements the in-game Community Shaders menu, themeing, icons, fonts, and feature settings panes. The UI reads from feature metadata and runtime state, and in turn updates feature settings, overrides, and persisted configuration.

9. Weather and scene editing are specialized interactive subsystems. `src/WeatherEditor/`, `src/WeatherManager.*`, `src/WeatherVariableRegistry.h`, and `src/SceneSettingsManager.cpp` form a data-driven editor/manager layer that lets the plugin modify in-game weather, lighting, and related scene parameters through structured widgets and registries.

10. VR is treated as a first-class branch of the architecture, not a minor toggle. `src/Features/VR.*`, `src/Features/VR/*`, and `package/Shaders/VR/` handle stereo rendering, overlay placement, input/drag interactions, and VR-specific compositing. The README also calls out a separate VR address library dependency, reinforcing that VR is an explicit runtime mode.

11. Upscaling is one of the most externally integrated subsystems. `src/Features/Upscaling/` coordinates with AMD FidelityFX and NVIDIA Streamline/DLSS artifacts under `include/FidelityFX/` and `features/Upscaling/Shaders/Upscaling/FidelityFX|Streamline`. This feature crosses the boundary between the plugin, the swap chain, and third-party SDKs.

12. The repo contains a packaging/distribution layer separate from runtime code. `package/` holds the installable mod layout: SKSE plugin files, interface assets, themes, icons, and shipping shaders. The `features/` directories appear to map to optional distributable feature packages, while the top-level build system can produce an AIO package or individual feature zips.

13. Build and validation are CMake-centric. `CMakeLists.txt`, `vcpkg.json`, and the `cmake/` directory define compilation, dependency resolution, feature packaging, and SDK integration. GitHub Actions under `.github/workflows/` automate build, lint, shader-change checks, and package-related tasks, while tests under `tests/shaders/` focus on shader validation/discovery.

14. The main data flow is: game engine state and frame data come in through hooks → core state and utility layers normalize that data → feature modules decide what to do → shaders and buffers are prepared → GPU passes run → UI and editor modules expose controls back to the user. That flow is the key thing to capture in an architecture diagram.

15. In short, this is a modular graphics plugin platform for Skyrim: a core SKSE runtime, many independently packaged rendering/features modules, a shared shader library, an in-game configuration/editor UI, and optional integrations with VR and external upscaling SDKs.

Main entry points: [`src/Feature.h`](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Feature.h) (Feature core), [`src/XSEPlugin.cpp`](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/XSEPlugin.cpp) (Plugin entry), [`src/State.h`](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/State.h) (State), [`src/ShaderTools/ShaderCompiler.h`](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/ShaderTools/ShaderCompiler.h) (Shader tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime_core["Runtime Core"]
  node_xse_plugin["Plugin entry<br/>SKSE DLL entry<br/>[XSEPlugin.cpp]"]
  node_globals["Globals<br/>runtime state<br/>[Globals.h]"]
  node_state["State<br/>runtime model<br/>[State.h]"]
  node_hooks["Hooks<br/>[Hooks.h]"]
  node_feature_core["Feature core<br/>feature framework<br/>[Feature.h]"]
  node_shader_tools["Shader tools<br/>GPU bridge<br/>[ShaderCompiler.h]"]
end

subgraph group_feature_modules["Feature Modules"]
  node_deferred["Deferred<br/>render pipeline<br/>[Deferred.h]"]
  node_truepbr["True PBR<br/>material pipeline<br/>[TruePBR.h]"]
  node_engine_fixes["Engine fixes<br/>engine patches<br/>[EngineFix.h]"]
  node_upscaling["Upscaling<br/>swapchain feature<br/>[Upscaling.h]"]
  node_water_effects["Water effects<br/>render feature<br/>[WaterEffects.h]"]
  node_terrain_shadows["Terrain shadows<br/>render feature<br/>[TerrainShadows.h]"]
  node_volumetric_lighting["Volumetric light<br/>render feature"]
end

subgraph group_ui_editors["UI & Editors"]
  node_weather_editor["Weather editor<br/>data editor<br/>[EditorWindow.h]"]
  node_menu["Community menu<br/>in-game UI<br/>[Menu.h]"]
end

subgraph group_shader_packages["Shader Packages"]
  node_package_shaders["Shared shaders<br/>HLSL library<br/>[BRDF.hlsli]"]
  node_feature_packages["Feature shaders<br/>shader packages<br/>[Upscaling.ini]"]
end

subgraph group_build_ext["Build & Ext"]
  node_build_system["Build system<br/>CMake build<br/>[CMakeLists.txt]"]
  node_extern_sdks["External SDKs<br/>third-party deps"]
  node_shader_tests["Shader tests<br/>validation suite<br/>[CMakeLists.txt]"]
end

node_xse_plugin -->|"initializes"| node_globals
node_xse_plugin -->|"bootstraps"| node_state
node_xse_plugin -->|"registers"| node_hooks
node_xse_plugin -->|"loads"| node_feature_core
node_hooks -->|"feeds frame data"| node_shader_tools
node_state -->|"drives"| node_feature_core
node_feature_core -->|"dispatches"| node_deferred
node_feature_core -->|"dispatches"| node_truepbr
node_feature_core -->|"dispatches"| node_engine_fixes
node_feature_core -->|"dispatches"| node_upscaling
node_feature_core -->|"dispatches"| node_water_effects
node_feature_core -->|"dispatches"| node_terrain_shadows
node_feature_core -->|"dispatches"| node_volumetric_lighting
node_feature_core -->|"exposes"| node_weather_editor
node_feature_core -->|"configures"| node_menu
node_menu -->|"reads/writes"| node_state
node_weather_editor -->|"edits"| node_state
node_shader_tools -->|"compiles"| node_package_shaders
node_shader_tools -->|"builds"| node_feature_packages
node_upscaling -->|"integrates"| node_extern_sdks
node_build_system -->|"resolves"| node_extern_sdks
node_build_system -->|"validates"| node_shader_tests
node_feature_packages -->|"extends"| node_package_shaders

click node_xse_plugin "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/XSEPlugin.cpp"
click node_globals "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Globals.h"
click node_state "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/State.h"
click node_hooks "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Hooks.h"
click node_feature_core "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Feature.h"
click node_shader_tools "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/ShaderTools/ShaderCompiler.h"
click node_deferred "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Deferred.h"
click node_truepbr "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/TruePBR.h"
click node_engine_fixes "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/EngineFix.h"
click node_upscaling "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Features/Upscaling.h"
click node_water_effects "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Features/WaterEffects.h"
click node_terrain_shadows "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Features/TerrainShadows.h"
click node_volumetric_lighting "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Features/VolumetricLighting.h"
click node_weather_editor "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/WeatherEditor/EditorWindow.h"
click node_menu "https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Menu.h"
click node_package_shaders "https://github.com/doodlum/skyrim-community-shaders/blob/dev/package/Shaders/Common/BRDF.hlsli"
click node_feature_packages "https://github.com/doodlum/skyrim-community-shaders/blob/dev/features/Upscaling/Shaders/Features/Upscaling.ini"
click node_build_system "https://github.com/doodlum/skyrim-community-shaders/blob/dev/CMakeLists.txt"
click node_extern_sdks "https://github.com/doodlum/skyrim-community-shaders/tree/dev/extern/CommonLibSSE-NG"
click node_shader_tests "https://github.com/doodlum/skyrim-community-shaders/blob/dev/tests/shaders/CMakeLists.txt"

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_xse_plugin,node_globals,node_state,node_hooks,node_feature_core,node_shader_tools toneBlue
class node_deferred,node_truepbr,node_engine_fixes,node_upscaling,node_water_effects,node_terrain_shadows,node_volumetric_lighting toneAmber
class node_weather_editor,node_menu toneMint
class node_package_shaders,node_feature_packages toneRose
class node_build_system,node_extern_sdks,node_shader_tests toneIndigo
```

## Components

### Runtime Core

SKSE-loaded plugin logic inside the game process

- [Plugin entry](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/XSEPlugin.cpp): SKSE DLL entry · Plugin lifecycle and startup boundary · `src/XSEPlugin.cpp`
- [Globals](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Globals.h): runtime state · Process-wide plugin globals and shared references · `src/Globals.h`
- [State](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/State.h): runtime model · Central runtime state and feature coordination data · `src/State.h`
- [Hooks](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Hooks.h): engine hooks · Engine and render hook registration · `src/Hooks.h`
- [Feature core](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Feature.h): feature framework · Feature registration, dispatch, constraints, and metadata · `src/Feature.h`
- [Shader tools](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/ShaderTools/ShaderCompiler.h): GPU bridge · Shader compilation, shader hooks, and binding utilities · `src/ShaderTools/ShaderCompiler.h`

### Feature Modules

Modular rendering and gameplay-facing subsystems

- [Deferred](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Deferred.h): render pipeline · Deferred rendering extensions and composite path · `src/Deferred.h`
- [True PBR](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/TruePBR.h): material pipeline · PBR material integration on the engine side · `src/TruePBR.h`
- [Engine fixes](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/EngineFix.h): engine patches · Low-level fixes for rendering pipeline behavior · `src/EngineFix.h`
- [Upscaling](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Features/Upscaling.h): swapchain feature · External upscaling and frame-generation integration · `src/Features/Upscaling.h`
- [Water effects](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Features/WaterEffects.h): render feature · Water shading and displacement effects · `src/Features/WaterEffects.h`
- [Terrain shadows](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Features/TerrainShadows.h): render feature · Terrain shadow generation and heightmap-driven data · `src/Features/TerrainShadows.h`
- [Volumetric light](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Features/VolumetricLighting.h): render feature · Volumetric lighting and related compositing passes · `src/Features/VolumetricLighting.h`

### UI & Editors

In-game configuration and weather editing surfaces

- [Weather editor](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/WeatherEditor/EditorWindow.h): data editor · Weather and scene parameter editing subsystem · `src/WeatherEditor/EditorWindow.h`
- [Community menu](https://github.com/doodlum/skyrim-community-shaders/blob/dev/src/Menu.h): in-game UI · Feature settings, themes, and overlay UI · `src/Menu.h`

### Shader Packages

Shared HLSL and packaged feature assets

- [Shared shaders](https://github.com/doodlum/skyrim-community-shaders/blob/dev/package/Shaders/Common/BRDF.hlsli): HLSL library · Reusable GPU utilities and shared passes · `package/Shaders/Common/BRDF.hlsli`
- [Feature shaders](https://github.com/doodlum/skyrim-community-shaders/blob/dev/features/Upscaling/Shaders/Features/Upscaling.ini): shader packages · Per-feature shader payloads and config metadata · `features/Upscaling/Shaders/Features/Upscaling.ini`

### Build & Ext

Build system, third-party SDKs, and test scaffolding

- [Build system](https://github.com/doodlum/skyrim-community-shaders/blob/dev/CMakeLists.txt): CMake build · Compilation, packaging, and dependency orchestration · `CMakeLists.txt`
- [External SDKs](https://github.com/doodlum/skyrim-community-shaders/tree/dev/extern/CommonLibSSE-NG): third-party deps · CommonLibSSE-NG, FidelityFX, and Streamline integrations · `extern/CommonLibSSE-NG`
- [Shader tests](https://github.com/doodlum/skyrim-community-shaders/blob/dev/tests/shaders/CMakeLists.txt): validation suite · Shader discovery and validation test scaffolding · `tests/shaders/CMakeLists.txt`

## Connections

- Plugin entry → Globals: initializes · Startup populates process-wide plugin globals
- Plugin entry → State: bootstraps · Creates and updates central runtime state
- Plugin entry → Hooks: registers · Installs engine and render hooks
- Plugin entry → Feature core: loads · Brings feature framework online
- Hooks → Shader tools: feeds frame data · Hooks extract render/game state for GPU work
- State → Feature core: drives · Runtime state informs feature decisions
- Feature core → Deferred: dispatches · Feature framework activates major rendering subsystems
- Feature core → True PBR: dispatches · Feature framework activates material pipeline support
- Feature core → Engine fixes: dispatches · Feature framework activates low-level fixes
- Feature core → Upscaling: dispatches · Feature framework activates swapchain/upscaling feature
- Feature core → Water effects: dispatches · Feature framework activates water feature
- Feature core → Terrain shadows: dispatches · Feature framework activates terrain shadow feature
- Feature core → Volumetric light: dispatches · Feature framework activates volumetric lighting feature
- Feature core → Weather editor: exposes · Feature framework contributes editor-controlled systems
- Feature core → Community menu: configures · Feature metadata and settings surface in the menu
- Community menu → State: reads/writes · UI reflects and mutates runtime settings and state
- Weather editor → State: edits · Weather tools modify live scene and weather state
- Shader tools → Shared shaders: compiles · Shader tooling consumes shared HLSL library code
- Shader tools → Feature shaders: builds · Shader tooling compiles per-feature shader packages
- Upscaling → External SDKs: integrates · Upscaling uses FidelityFX and Streamline SDKs
- Build system → External SDKs: resolves · CMake manages third-party dependency integration
- Build system → Shader tests: validates · Build pipeline includes shader discovery and validation
- Feature shaders → Shared shaders: extends · Feature packages sit on top of shared shader utilities
