Synapse Engine

Open source · C++23 · Vulkan 1.4

A modern game engine architecture, built for graphics research.

Synapse Engine is an open-source, fully GPU-driven game engine designed for university research groups, PhD students and anyone who wants to understand how a state-of-the-art renderer is put together.

Scroll

Why Synapse exists

The gap between AAA engines and university research.

Unreal and Unity are built to ship games. Their codebases have grown for decades, so isolating one algorithm or measuring it fairly is hard work, even when the source is open.

Research frameworks like NVIDIA Falcor are great for prototyping a single rendering pass, but they don't model a full modern engine. So most university groups end up maintaining a small framework of their own.

Synapse Engine is built to fill that gap.

How existing engines fit research use

✓ Yes∼ Partly× No
EngineOpen sourceModern GPU-driven pipelineComplete engine architectureBuilt for researchTransparent for research
Unity Engine×∼✓××
Northlight×✓✓××
Unreal Engine∼✓✓×∼
Godot Engine✓∼✓×∼
Wicked Engine✓∼✓×∼
NVIDIA Falcor✓∼×✓✓
Synapse Engine✓✓✓✓✓

Research

University research groups

A modern, high-performance engine on Vulkan 1.4 and its newest extensions, ready to use. No need for every group to maintain its own framework.

The long-term goal is a shared benchmark platform. Many research algorithms implemented in one engine, measured under the same conditions and citable in papers.

Industry R&D

Companies and R&D teams

A clean, lean engine for prototyping new rendering ideas fast, without fighting a huge codebase first.

Try an algorithm, measure it, change it. Then take what works to your production engine.

Education

Students and graphics enthusiasts

Not just Vulkan, but how a complete modern engine is built. Clean code, clear layers and state-of-the-art graphics techniques.

I am planning a lot of learning material and visual devblogs to go with the code.

Synapse Engine innovation

Dual-HiZ Adaptive Clustered Forward+

DHAC is a next-generation Forward+ technique I developed in Synapse Engine. It is also the proof of what the engine is for. A new research idea, built and measured on top of the existing GPU-driven pipeline, without writing a new framework first.

Clusters are only created where geometry exists, and only across the depth range it really occupies. Tile bounds come from two Hi-Z pyramids, so transparent surfaces are included as well. Light assignment switches between a fast and a scalable path, depending on how many lights are visible.

Sponza lit by thousands of dynamic point and spot lights with DHAC
Sponza with thousands of dynamic point and spot lights, shaded with DHAC.
Heatmap of depth clusters per 16×16 tile
Clusters. Depth clusters created for each 16×16 tile.
Heatmap of lights intersecting each tile
Light heatmap. Number of lights intersecting each tile.

Benchmark

Benchmark scene with Sponza, 500,000 objects and 2048 lights
Sponza, 500,000 objects, 1024 point and 1024 spot lights. Full HD, 1920×1080.
TechniqueBest configurationTileFrame timeSpeedup
DHACDual-HiZ, 16 slices32×32
3.083 ms
1.00×
DHAC-No Hi-Z, 8×8 threads32×32
3.375 ms
1.09×
DOOM (2016)32 slices64×64
5.480 ms
1.78×
Wicked Engine8×8 threads8×8
6.923 ms
2.25×
Harada et al.16×16 threads16×16
7.671 ms
2.49×

Best run of each technique, all implemented in Synapse Engine and measured in the same scene. DHAC- is the variant without Hi-Z. The full table with every run parameter is on the devblog.

Rendering architecture

Fully GPU-driven rendering and culling

In a classic renderer the CPU decides what is visible and records the draw calls. With millions of objects this becomes the bottleneck. In Synapse Engine the scene lives in GPU memory, and only changed data is uploaded from the ECS.

The GPU does the rest. It runs the visibility tests, picks the level of detail and writes its own indirect draw commands. The whole scene is drawn with at most 16 indirect draw calls, no matter how complex it is.

Complex scene from the main camera
Main camera view of a dense test scene.
Geometry that survives visibility testing, seen from outside
What actually gets rendered. The same frame seen from outside, after all visibility tests.

Scaling with entity count

Model culling time and full GPU time of culling and rendering, from ten thousand to two million entities.

RTX 4060
EntitiesModel cullingFull GPU time
10,0000.013 ms0.253 ms
100,0000.050 ms0.549 ms
1,000,0000.360 ms0.671 ms
2,000,0000.680 ms0.992 ms
RTX 4070 SUPER
EntitiesModel cullingFull GPU time
10,0000.009 ms0.140 ms
100,0000.036 ms0.285 ms
1,000,0000.223 ms0.406 ms
2,000,0000.404 ms0.578 ms

Three-level hierarchical culling

Visibility is resolved from coarse to fine. Anything rejected at a higher level never creates work below it.

After model culling

Model culling

Each model is tested by its own thread. Simple models are finished right here, complex ones move on to the next pass.

After mesh culling

Mesh culling

A group of 32 threads works on one model together. They test every mesh, pick the LOD and write the indirect draw commands.

After meshlet culling, the final result

Meshlet culling

The task shader tests every meshlet. Only the meshlets that survive launch mesh shader work.

Four visibility tests

The same tests run on every level of the hierarchy. Cone culling only runs on meshlets.

Frustum culling

Frustum culling

A cheap sphere test runs first, the box test only when needed. Objects fully inside are flagged, so their meshes and meshlets skip the test.

Occlusion culling

Occlusion culling

Bounds are tested against a Hi-Z depth pyramid built from the previous frame. Anything hidden behind other geometry is dropped.

Contribution culling

Contribution culling

Objects that cover too few pixels on screen are dropped before any depth is read. The threshold can be tuned per scene.

Cone culling

Cone culling

Every meshlet stores a cone of its normals. If the cone faces away from the camera, the meshlet is skipped.

Measured on one million entities

Moving culling from the CPU to the GPU took the frame rate from 79 to 1344 FPS. Turning the stages on one by one shows where the gain comes from. GPU time drops from 124 ms to 0.65 ms.

CPU-driven vs GPU-driven
ConfigurationCPUGPUFPS
CPU-driven culling12.244 ms79
with full mesh shader path3.481 ms
with mesh shaders, no occlusion4.504 ms
with vertex shaders7.687 ms
GPU-driven culling0.153 ms0.677 ms1344
Cumulative effect
Active stagesGPU time
No culling124.407 ms
+ Cone culling94.123 ms
+ Hierarchical frustum culling2.878 ms
+ Hierarchical Hi-Z occlusion culling0.681 ms
+ Dynamic LOD selection0.653 ms

Beyond a million objects

GPU-built Morton chunk hierarchy

With millions of static objects, even launching the culling threads becomes measurable. So for static geometry the engine adds one more level above the models.

The GPU computes a Morton code for every static entity, sorts them with a radix sort and groups them into chunks of 32 nearby models. One rejected chunk removes 32 models at once. Building it on the GPU takes about 3 ms instead of 130 ms on the CPU.

Morton chunks seen from outside
Chunk bounds seen from outside.
Morton chunks seen from inside
Chunk bounds seen from inside.

Three levels vs four levels

GPU time of each culling stage, without and with the Morton chunk level.

10M entities, heavily occluded
Stage3 levels4 levels
Reset commands0.006 ms0.005 ms
Morton chunk culling0.069 ms
Morton model culling0.164 ms
Model culling5.885 ms0.005 ms
Mesh culling0.003 ms0.003 ms
Total5.908 ms0.264 ms
2.5M entities, high visible load
Stage3 levels4 levels
Reset commands0.008 ms0.007 ms
Morton chunk culling0.021 ms
Morton model culling0.972 ms
Model culling1.796 ms0.005 ms
Mesh culling0.018 ms0.018 ms
Total1.823 ms1.023 ms

The 10 million entity scene is extremely dense. Hi-Z occlusion removes almost everything, so most of the three-level cost is just launching threads for models that are thrown away anyway. That is why the difference is about 22× there.

So I also measured a less crowded scene with 2.5 million entities and much more visible geometry. It is closer to a typical case, and the four-level version is still clearly faster.

Geometry pipeline

Meshlets and mesh shaders

With a classic vertex shader the smallest unit you can throw away is a whole mesh. If only a corner of a large model is on screen, the GPU still reads and transforms every vertex of it.

Synapse Engine splits every mesh into meshlets, small clusters of 64 to 126 triangles. A task shader tests each meshlet and drops the hidden ones on chip. The mesh shader then only gets the meshlets that are really visible.

The scene

1The scene

Only a small part of the dragon is visible from the camera.

Vertex shader

2Vertex shader

Every vertex of the mesh is still read and transformed, visible or not.

Task shader

3Task shader

Each meshlet is tested first. Hidden meshlets are dropped before a single vertex is read.

Mesh shader

4Mesh shader

Only the triangles of the visible meshlets are processed and rasterized.

Level of detail

Every model gets four LOD levels when it is loaded, together with their meshlets and bounding volumes. The culling shaders pick the level on the GPU, based on how large the mesh is on screen.

Up close you see every triangle. Far away the lowest level keeps only 12.5% of them, and from that distance you can't tell the difference.

LOD0, full detail, meshlets
LOD0, full detail, meshlets
LOD0, full detail, triangles
LOD0, full detail, triangles
LOD3, 12.5% detail, meshlets
LOD3, 12.5% detail, meshlets
LOD3, 12.5% detail, triangles
LOD3, 12.5% detail, triangles

Coming next

Continuous LOD in the style of Nanite. Detail will change between small meshlet clusters instead of whole meshes, so transitions become practically invisible. This is one of the main features I am working on next.

Shadows

GPU-driven virtual shadow atlas

Shadows run on the same GPU-driven pipeline as the main view. The same four-level culling, the same material buckets and still one draw call per bucket, even with hundreds of shadow casting lights.

Switching a separate depth texture for every light would break that model. So each light type has one 4K atlas, and every light gets its own region in it. With many lights, the visible instances are sorted on the GPU with a radix sort, so every draw reads one tight block of memory.

Directional light

A directional light covers the whole view, so the camera frustum is split into four cascades. Each cascade works like its own light and gets its own region in the atlas.

Static and dynamic objects go into two separate atlases. The static one is only redrawn when something static changes or the light moves. The shader reads both, so nothing has to be copied between them.

Directional light shadow atlas
Shadow atlas, depth
Directional light shadows in the scene
Result in the scene

Spot light

A spot light gets one region in the atlas. Its size follows how big the light is on screen, from 512 × 512 close to the camera down to 64 × 64 far away.

Objects are tested against the real cone of the light, so only geometry inside the cone is drawn into its region.

Spot light shadow atlas
Shadow atlas, depth
Spot light shadows in the scene
Result in the scene

Point light

A point light looks in six directions. Instead of cube maps, the six faces are laid out in a 2 × 3 grid inside the atlas.

Objects are tested against the light sphere first, then against each of the six face frustums. A face only draws the objects it can really see.

Point light shadow atlas
Shadow atlas, depth
Point light shadows in the scene
Result in the scene

Data

Data-oriented ECS and parallelism

Synapse Engine runs on its own sparse-set based Entity-Component-System. Entities are plain IDs, components are plain data, and every component type lives in its own tightly packed pool.

Entity IDSparse indexDense indexComponentsChange flags012345671··0···23databits0databits7databits
O(1) access
The sparse array maps an entity ID straight to its component. No hashing, no search.
Cache friendly
Components of one type are packed together, so the CPU reads them in one straight line.
Fast add and remove
Adding appends to the end. Removing swaps in the last element, so there are never holes.
SIMD friendly
Tightly packed plain data is ideal for vectorized processing.
Parallel systems
About thirty systems run as a Taskflow dependency graph. Independent systems run at the same time on every core.
Ready for the GPU
Dense arrays are copied to GPU memory as they are, without any conversion.

Static, dynamic and stream

A plain sparse set, like the one in EnTT, was not enough for a GPU-driven pipeline. Walking millions of components costs time even when nothing changed. So every pool is split into three segments.

Static
Dynamic
Stream
203
651
10894
↑ static end
↑ dynamic end
↑ stream end

Static

Rarely changes, like level geometry. Updated only through a dedicated list. Morton chunks and static shadows build on it.

Dynamic

Changes now and then. Change flags mark what was touched, and untouched blocks are skipped.

Stream

Changes every frame. Simply processed every frame, no tracking needed.

Compared with EnTT

Adding components is faster in EnTT. Removing them and the full engine update are faster in Synapse, because unchanged data is skipped.

1 million entities
OperationSynapseEnTT
Add59.66 ms35.59 ms
Remove26.18 ms37.01 ms
Iterate (sequential)2.46 ms2.25 ms
Iterate (parallel)2.15 ms2.26 ms
Full engine update1.15 ms1.76 ms

Architecture

Readable first, and still fast

The goal was a codebase people can actually read. SOLID principles, clean code and clear layers, without giving up performance.

For research this matters a lot. If you can't find an algorithm in the code, you can't change it or measure it either.

Example: the model pipeline

A model goes through clear stages, each with its own representation. Every step is a small class behind an interface, so a new format or processing step never touches the rest.

  1. 01

    Raw model

    Loaded from a file through Assimp or TinyObj, or generated procedurally, like cubes, spheres and Bézier surfaces.

  2. 02

    Cooked model

    Normals, tangents and colliders are generated. LOD levels and meshlets are built with meshoptimizer.

  3. 03

    GPU model

    Converted into the GPU layout and uploaded, ready for the GPU-driven pipeline.

  4. 04

    CPU model

    A CPU-side copy for engine systems that need the geometry on the CPU, with welded vertices and batched indices.

Class diagram of the layered model pipeline
The full model pipeline. Sources, processors, converters and uploaders, each behind its own interface.

Editor

MVI architecture and the editor

The editor follows Model-View-Intent. The UI never changes engine state directly. When you press a button or edit a value, the view sends an intent, and the ViewModel in EditorCore decides what happens.

This keeps the editor logic independent from the UI framework. Today the views are written in ImGui. Moving to another framework would mean rewriting the views only, while all the editor logic stays the same.

View

Editor

Windows, viewports and controls. It draws the state it gets and turns user actions into intents.

intent →← state

ViewModel

EditorCore

State, intents and business logic for every editor window. It knows nothing about the UI framework.

calls →← sync

Data

Engine

The runtime itself. ECS, renderer, Vulkan resources, physics and asset managers.

MVI layered architecture of the editor
The detailed MVI structure of the editor.

Workspaces

Every asset type has its own workspace, so scenes, models, materials, textures, animations and sounds can be handled inside the engine without external tools.

Scene workspace of the Synapse Engine editor
Scene. Entities and components, renderer settings, profiling and the asset browser.
Materials workspace

Materials

Create and tune materials with a live preview.

Models workspace

Models

Inspect imported and procedural models.

Textures workspace

Textures

Browse and check textures.

Animation workspace

Animation

Preview skeletal animations.

Audio workspace

Audio

Listen to sounds and see their waveform.

Requirements

Built for modern hardware only

Synapse Engine is made for research. New rendering ideas need the newest graphics API and the newest GPU architectures, so the engine is built around them from the start.

Supporting old hardware would close the door on exactly the features that GPU-driven techniques rely on. So the engine will never support older GPUs. Only modern architectures.

Hardware
Graphics API
Vulkan 1.4 with an up-to-date driver
Minimum GPU
NVIDIA RTX 20 series or newer
Tested GPUs
RTX 4050 Laptop, RTX 4060, RTX 4070 SUPER
AMD and Intel
Validation in progress
Vulkan features
Buffer device address, bindless resources, descriptor buffer, shader objects, task and mesh shaders, dynamic rendering
CPU
Modern multi-core x86-64 with AVX2. More cores help the parallel systems.
Memory
No fixed minimum. It depends on the scene and the techniques in use.
Development
Language
C++23 and GLSL
Platforms
Tested on Windows and Linux
Build system
Xmake, with dependencies built by vcpkg
Compiler
MSVC recommended on Windows, Clang and GCC also work
Configurations
debug, release, dist, performance
Sample assets
Downloaded automatically from the GitHub release if missing
Size
Repository
About 3.5 GB with the sample models and assets
Full build
About 34 GB, of which about 21 GB are vcpkg dependencies
Runtime
About 180 MB for the executable and its binaries

Publications

Publications and talks

Some of these are in Hungarian, my native language. Feel free to run them through a translator, and look at the figures too. They tell a lot on their own.

The theses will be linked here once they are finished.

Transparency

How I use AI

Not a single line of code or idea went into this engine that I have not reviewed, that I don't understand, or that I couldn't explain.

I used AI while building Synapse Engine, mostly Google Gemini Pro through the student plan. I use it for almost everything around the thinking. Brainstorming ideas, finding papers and techniques, seeing how other engines solve a problem, planning the architecture and helping to write parts of the code.

The mental model of the whole engine and every decision in it live in my head. That is the only reason I can keep moving forward. Every part is connected to every other part, and no AI keeps track of that on its own.

I have been building engines for three to four years. My BSc thesis, Dendrite Engine, was a fairly large engine written before AI tools existed, and I spent countless hours learning computer graphics the hard way.

I think that is exactly why AI works for me. I know what to ask, I can read the answers critically, and after a while I can feel which algorithm will work and which won't. AI gives me more information and more ideas. The understanding and the decisions are still mine.

Tamás Péter

Tamás Péter

Computer Engineering MSc, Visual Informatics, BME. Supervisor: András Máté Fridvalszky.

About me