Divide and Conquer:
Engine and Editor Part Ways
Every fledgling game engine hits a crossroads where its experimental playground has to grow up into a real architecture. Up to this point, this is by far the biggest architectural milestone in RoboEngine’s journey. It’s refactor time!
It’s such a massive leap that squeezing it into one post wouldn’t do it justice. Instead, we’re unpacking this giant into a three-part trilogy:
- Today (DevBlog #7): Splitting the codebase into a clean Engine library and Editor app, introducing per-project workspaces, and unveiling
ReSceneRendererwith switchable Forward and Deferred pipelines. - DevBlog #8: Metallic-roughness PBR materials, Image-Based Lighting (IBL), and shadow maps.
- DevBlog #9: glTF loading and GPU-skinned skeletal meshes.
Say goodbye to FirstApp and the humble simple_shader pair, RoboEngine has officially leveled up!
The Great Split:
Runtime vs. Editor
Up until now, rendering code, scene management, and ImGui panels all lived under one roof. To make RoboEngine capable of shipping an actual standalone game someday, we carved the repository into three crisp top-level territories:
| Folder | Build Target | What Lives Inside |
Engine/ | RoboEngine (static library) | Vulkan core, rendering, animation, EnTT scene, project settings, and shaders |
Editor/ | RoboEditor (executable) | The ImGui shell: viewport, panels, picking, undo history, file picker, and fly camera |
Project/ | (none) | Game content: 3D models, .scene.json files, and project.json |
Engine/CMakeLists.txt lays down the law
The engine library contains “everything a game needs at runtime and nothing editor-specific (no ImGui).” Inside “Engine/” code is neatly organized into “core/“, “animation/“, “rendering/“, “scene/“, and “project/“, with clean include paths like #include "core/re_device.hpp".
Meanwhile, the editor executable links against RoboEngine and imgui,and nothing else:
add_executable(RoboEditor ${EDITOR_SOURCES})
target_link_libraries(RoboEditor PRIVATE RoboEngine imgui)
Along the way, our overgrown 1,114-line re_editor.cpp got refactored into focused, bite-sized modules: re_editorApp, re_editorFiles, re_editorPanels, re_editorViewport, and re_editorProjectSettings.
Real Projects &
Bulletproof Shader Paths
Back in DevBlog #3, we noted a fragile quirk: all content paths resolved relative to wherever you launched the executable. The new project structure fixes that cleanly. Launching RoboEditor [projectDir] sets the working directory to your chosen project folder before loading a single asset (defaulting to the repo’s Project/ folder):
const fs::path projectDir = argc > 1 ? fs::path{argv[1]} : fs::path{RE_DEFAULT_PROJECT_DIR};
fs::current_path(projectDir, ec);
Engine shaders took the opposite route:
Shaders compile into <build>/shaders and are located via a compile-time RE_SHADER_DIR macro, meaning the renderer finds its SPIR-V binaries no matter which project directory you open. Building RoboEngine automatically triggers the Shaders target, and every shader tracks all of shaders/include/*.glsl, so tweaking a shared math or lighting header safely recompiles everything that depends on it.
Every project also gets a project.json config file, starting with our first major rendering toggle:
{ "rendering": { "pipeline": "forward" }, "version": 1 }
One Renderer, Two Pipelines (ReSceneRenderer)
All scene drawing now lives inside ReSceneRenderer. It owns the per-frame global UBO and every render system, meaning the application simply hands it a command buffer, a camera, and the active scene. The editor’s frame loop shrinks down to “render the 3D scene into the viewport target, then draw the ImGui shell.”
Better yet, ReSceneRenderer supports both Forward and Deferred rendering paths:

Shared setup:
- Geometry culling, shadow passes, and scene preparation run identically for both pipelines.
Forward rendering:
- Shades every mesh directly as it draws—simple, low-memory, and great for light scenes.
Deferred rendering:
- First packs every visible surface into a G-buffer, then evaluates lighting once per screen pixel in a fullscreen pass—eliminating wasted shading work when lots of meshes overlap.
When deferred mode is active, the G-buffer packs scene geometry across three color targets plus depth:
| Attachment | Vulkan Format | What It Stores |
| 0: Albedo | R8G8B8A8_SRGB | Surface base color |
| 1: Normals | R16G16B16A16_SFLOAT | Shading normal (xy) and geometric normal (zw), octahedral-encoded |
| 2: Material | R8G8B8A8_UNORM | Metallic (r) and roughness (g) parameters |
| 3: Depth | D32_SFLOAT (or D16_UNORM) | Hardware depth, sampled to reconstruct each pixel’s world position |
A comment in the header sums up the engineering bargain:
“Both pipelines light with the same shader code, so they give the same picture. Deferred lights each pixel once however many meshes overlap it, at the cost of the G-buffer’s memory.”
And you only pay that VRAM tax when you actually use it: the G-buffer textures allocate lazily on first use, resize automatically alongside the viewport, and free themselves immediately if you switch back to Forward under Edit → Project Settings.
Traps & Mobs Along the Way
Create render passes once; rebuild images freely.
- Following the pattern we pioneered with
ReViewportTargetin DevBlog #1, both the G-buffer and shadow maps build theirVkRenderPassonce at startup so every graphics pipeline stays valid forever. Only theVkImages andVkFramebuffers get recreated when the viewport resizes.
One shared image set across frames in flight.
- Rather than duplicating heavy G-buffer and shadow textures for every frame in flight, render pass subpass dependencies ensure each frame’s writes wait for the previous frame’s reads. That cuts VRAM usage in half (with two frames in flight) in exchange for a touch less frame overlap.
Flush non-coherent UBO memory!
- Our global UBO lives in host-visible memory that isn’t
HOST_COHERENT, meaning every CPU write must be followed by an explicitflush(). Skip that call and the GPU can end up rendering with last frame’s camera matrices.
Conservative shader rebuilds beat stale SPIR-V.
- Making every shader depend on every file in
shaders/include/means editingbsdf.glslrecompiles the entire shader suite. It’s slightly slower than parsing exact#includetrees, but it guarantees you’ll never chase phantom bugs caused by a stale shader binary.
Beware the 10,000-line mega-commit.
- Packing seven major features into a single commit makes code review and
git bisectrough—if a shadow bug surfaces later, bisect can only point at this giant monolith. - That’s a big reason we’re breaking this beast across three separate dev blogs!
- My bad! But as a team of one, I only hurt myself.
Next Up on the Quest
Now that ReSceneRenderer can drive both Forward and Deferred pipelines using shared GLSL lighting code, it’s time to look inside those shaders! In DevBlog #8, we’ll dive into metallic-roughness PBR materials, HDR Image-Based Lighting (IBL), and shadow maps for directional, spot, and point lights.
