tksuoran/erhe

erhe is a C++ library and editor for 3D graphics with a graphics API abstraction loosely modeled after Vulkan and Metal, with backends for OpenGL, Metal and Vulkan

908

stars

2,821

commits

C++

primary language

Sep 10, 2026

updated

3d-graphics
geometry-processing
metal
opengl
polyhedron
vulkan
Browse cluster: Graphics APIs and Rendering

README

erhe

A C++ 3D graphics library and sandbox editor, with a Vulkan/Metal-style rendering abstraction over OpenGL, Vulkan, and Metal.

build License: MIT C++20 Platforms

screenshot

erhe is an actively-developed personal research project for real-time rendering and geometry. Its editor is a sandbox for 3D scene creation, manipulation, and procedural mesh generation. erhe is the evolution of RenderStack.

erhe summer 2024

Quick start

git clone https://github.com/tksuoran/erhe
cd erhe

# Windows (from an x64 Native Tools Command Prompt)
scripts\configure_vs2026_vulkan.bat

# Linux
scripts/configure_ninja_linux_vulkan.sh && cmake --build build_ninja_linux_vulkan --target editor

# macOS
scripts/configure_xcode_metal.sh && cmake --build build_xcode_metal --target editor --config Debug

Vulkan is the default backend; the OpenGL build uses the *_opengl scripts instead (e.g. scripts\configure_vs2026_opengl.bat). See doc/building.md for all backends, CMake options, and IDE setup.

Platforms

PlatformGraphics backendsStatus
WindowsOpenGL, VulkanPrimary
LinuxOpenGL, VulkanSupported
macOSVulkan, MetalSupported
Meta Quest / AndroidVulkan + OpenXRSupported

The OpenGL backend requires OpenGL 4.5 (with Direct State Access) at minimum; 4.6 is recommended. It is not available on Apple platforms.

Editor

The editor is a sandbox application for 3D scene creation and manipulation.

Scene and Viewport

  • Multiple 3D viewports with independent camera and rendering settings
  • Hierarchical scene graph with node parenting
  • glTF import and export
  • Scene serialization to JSON with companion binary glTF
  • Multi-scene support
  • Post-processing pipeline (bloom, tonemapping)
  • Shadow mapping
  • PBR material system with metallic/roughness workflow
  • Material library with preview rendering

Tools

  • Fly camera -- 6DOF camera navigation with WASD, orbit, tumble, track, zoom
  • Selection -- click-to-select with shift/ctrl multi-select, GPU ID buffer or raytrace picking
  • Transform gizmo -- translate, rotate, scale with axis/plane constraints and snapping
  • Brush placement -- place shapes on surfaces with snap-to-face, rotation, and scale-to-match
  • Vertex painting -- paint vertex colors directly on meshes
  • Material painting -- assign materials to individual mesh faces
  • Physics interaction -- drag, push, and pull rigid bodies in the scene
  • Grid -- configurable grid display and snap-to-grid

Geometry Operations

  • Subdivision: Catmull-Clark, sqrt3
  • Conway operators: ambo, chamfer, dual, gyro, join, kis, meta, truncate, chamfer/bevel
  • CSG / boolean: union, intersection, difference (experimental, via Geogram)
  • Utilities: triangulate, normalize, reverse, weld, repair, generate tangents, bake transform
  • Full undo/redo for all operations

Mesh Creation

  • Parametric shapes: sphere, box, cone, torus, disc, cylinder
  • Brush system with reusable shape templates
  • 180+ built-in polyhedra (Platonic solids, Johnson solids, geodesic domes, etc.)
  • Procedural scene generation

Node Graphs

  • Texture graph -- Material Maker-style procedural texture authoring with ~75 node types (noises, patterns, gradients, transforms, color operations); nodes compose into a single fragment shader evaluated on the GPU, with live per-node previews, and bake to textures and PBR material channels
  • Geometry graph -- node-based procedural modeling: parametric generators, subdivision, Conway operators, lattice deform, boolean CSG, point scattering and instancing, nested node groups; evaluated asynchronously on worker threads so editing stays interactive
  • Shared node-editor canvas with a dockable node palette, undo/redo, and JSON serialization; graphs are content-library assets

Ray Tracing

  • CPU ray tracing library with swappable backends (madmann91 bvh, tinybvh, Embree 4) and BVH disk caching, used for mouse picking and spatial queries
  • GPU ray tracing renderer (Vulkan ray query compute): PBR material shading, real scene lights, ray-traced shadows, reflection and refraction for transmissive materials

Lightmap Baking

  • Progressive GPU lightmap baker (ray query compute): direct lighting, indirect bounce, procedural sky lighting, texel supersampling
  • Automatic lightmap UV unwrap with world-space quadtree tile partitioning and per-tile atlas packing
  • Artifact defenses: conservative-raster texel G-buffer, JNLM denoise, seam blending, dilation, shadow terminator fix
  • Tiles persist to disk and stream in by camera distance under a fixed memory budget, so world size is unbounded
  • Bakes progressively in the running editor; lighting and geometry edits invalidate and re-accumulate automatically

File Format Support

  • glTF 2.0 import and export (via fastgltf)
  • Partial support for Wavefront OBJ import

VR / OpenXR

  • Headset rendering with OpenXR
  • Hand and controller tracking with visualization
  • Floating HUD and hotbar UI in VR
  • Passthrough support

Input

  • Keyboard and mouse with configurable bindings
  • SpaceMouse 6DOF input
  • OpenXR controllers

Debug and Development

  • Debug line and text rendering in 3D viewports
  • Physics shape visualization
  • Render graph visualization window
  • Shader hot-reload via shader monitor
  • GL state dump to clipboard
  • Tracy profiler integration
  • Built-in MCP server: scene inspection and editing, screenshots, and tool automation for AI-agent and scripted workflows — see AI creations for agent-built showcase scenes and the editor features they exercise

Libraries

erhe is organized as a set of independent libraries under src/erhe/. Each has a notes.md with details on purpose, API, and design.

LibraryDescription
erhe::graphicsVulkan/Metal-style graphics abstraction: pipelines, buffers, textures, shaders, ring buffers, shader monitor
erhe::rendergraphDAG of render nodes with typed inputs/outputs, executed in dependency order
erhe::sceneglTF-like scene graph: nodes, meshes, cameras, lights, animations, skins
erhe::gltfglTF 2.0 import and export via fastgltf, including KHR physics extensions
erhe::raytraceCPU ray tracing abstraction with swappable bvh / tinybvh / Embree backends and BVH disk caching
erhe::texgenProcedural texture generation: data-driven node descriptors composed into GLSL fragment shaders (Material Maker port)
erhe::graphGeneric node graph: nodes, pins, links, topological-order evaluation; base for the geometry, texture, and shader graphs
erhe::xrOpenXR integration: session and swapchain management, action-based input, hand tracking, stereo rendering
erhe::scene_rendererForward renderer, shadow renderer, ID picking, camera/light/material/joint GPU buffers
erhe::rendererDebug line renderer (compute, geometry shader, or GL_LINES), text renderer, texture blit
erhe::geometryPolygon mesh manipulation via Geogram: subdivision, Conway operators, CSG, shape generators
erhe::primitiveConverts geometry meshes to GPU vertex/index buffers; PBR material definitions
erhe::physicsThin abstraction over Jolt physics: rigid bodies, collision shapes, constraints
erhe::imguiCustom ImGui backend with per-host ImGui contexts and window management
erhe::commandsInput command system with state machine, priority dispatch, and bindings for all input types
erhe::windowSDL / GLFW windowing abstraction with input event handling
erhe::itemBase Item (name, id, flags) and Hierarchy (parent/child tree) classes
erhe::glGenerated type-safe OpenGL wrappers with call logging and extension queries
erhe::mathBounding volumes, viewport projection, input axis filtering, vector/matrix helpers
erhe::dataformatGraphics-API-agnostic pixel and vertex format definitions
erhe::message_busTyped publish-subscribe bus used to decouple editor subsystems
erhe::profileUnified profiling macros dispatching to Tracy, Superluminal, or NVTX
erhe::uiFreeType glyph rasterization and HarfBuzz shaping into GPU font atlases
erhe::logspdlog wrappers
erhe::verifyVERIFY(condition) and FATAL(format, ...) macros
erhe::codegenPython code generator for C++ structs with versioned JSON serialization via simdjson

OpenGL Compatibility

erhe requires OpenGL 4.5 with DSA (Direct State Access); device creation fails on older versions. DSA, SSBOs, compute shaders and clip control are used unconditionally. The former OpenGL 4.1 (macOS) runtime compatibility layer has been removed.

License

erhe's own source is MIT-licensed -- see src/erhe/LICENSE. Bundled and fetched third-party dependencies retain their own licenses; see License.txt for the overview.

Acknowledgements

erhe stands on many excellent open-source projects, including Dear ImGui, Jolt Physics, Geogram, fastgltf, simdjson, SDL, OpenXR, FreeType, HarfBuzz, Tracy, GLM, fmt, and spdlog. Dependencies are fetched at configure time via CPM.cmake.

Static analysis provided by PVS-Studio - static analyzer for C, C++, C#, and Java code, free for open-source projects.

Contributors

tksuoran

2,801 commits

LadislavSopko

12 commits

deccer

8 commits

tksuoran/erhe

erhe is a C++ library and editor for 3D graphics with a graphics API abstraction loosely modeled after Vulkan and Metal, with backends for OpenGL, Metal and Vulkan

908

stars

2,821

commits

C++

primary language

Sep 10, 2026

updated

3d-graphics
geometry-processing
metal
opengl
polyhedron
vulkan
Browse cluster: Graphics APIs and Rendering

README

erhe

A C++ 3D graphics library and sandbox editor, with a Vulkan/Metal-style rendering abstraction over OpenGL, Vulkan, and Metal.

build License: MIT C++20 Platforms

screenshot

erhe is an actively-developed personal research project for real-time rendering and geometry. Its editor is a sandbox for 3D scene creation, manipulation, and procedural mesh generation. erhe is the evolution of RenderStack.

erhe summer 2024

Quick start

git clone https://github.com/tksuoran/erhe
cd erhe

# Windows (from an x64 Native Tools Command Prompt)
scripts\configure_vs2026_vulkan.bat

# Linux
scripts/configure_ninja_linux_vulkan.sh && cmake --build build_ninja_linux_vulkan --target editor

# macOS
scripts/configure_xcode_metal.sh && cmake --build build_xcode_metal --target editor --config Debug

Vulkan is the default backend; the OpenGL build uses the *_opengl scripts instead (e.g. scripts\configure_vs2026_opengl.bat). See doc/building.md for all backends, CMake options, and IDE setup.

Platforms

PlatformGraphics backendsStatus
WindowsOpenGL, VulkanPrimary
LinuxOpenGL, VulkanSupported
macOSVulkan, MetalSupported
Meta Quest / AndroidVulkan + OpenXRSupported

The OpenGL backend requires OpenGL 4.5 (with Direct State Access) at minimum; 4.6 is recommended. It is not available on Apple platforms.

Editor

The editor is a sandbox application for 3D scene creation and manipulation.

Scene and Viewport

  • Multiple 3D viewports with independent camera and rendering settings
  • Hierarchical scene graph with node parenting
  • glTF import and export
  • Scene serialization to JSON with companion binary glTF
  • Multi-scene support
  • Post-processing pipeline (bloom, tonemapping)
  • Shadow mapping
  • PBR material system with metallic/roughness workflow
  • Material library with preview rendering

Tools

  • Fly camera -- 6DOF camera navigation with WASD, orbit, tumble, track, zoom
  • Selection -- click-to-select with shift/ctrl multi-select, GPU ID buffer or raytrace picking
  • Transform gizmo -- translate, rotate, scale with axis/plane constraints and snapping
  • Brush placement -- place shapes on surfaces with snap-to-face, rotation, and scale-to-match
  • Vertex painting -- paint vertex colors directly on meshes
  • Material painting -- assign materials to individual mesh faces
  • Physics interaction -- drag, push, and pull rigid bodies in the scene
  • Grid -- configurable grid display and snap-to-grid

Geometry Operations

  • Subdivision: Catmull-Clark, sqrt3
  • Conway operators: ambo, chamfer, dual, gyro, join, kis, meta, truncate, chamfer/bevel
  • CSG / boolean: union, intersection, difference (experimental, via Geogram)
  • Utilities: triangulate, normalize, reverse, weld, repair, generate tangents, bake transform
  • Full undo/redo for all operations

Mesh Creation

  • Parametric shapes: sphere, box, cone, torus, disc, cylinder
  • Brush system with reusable shape templates
  • 180+ built-in polyhedra (Platonic solids, Johnson solids, geodesic domes, etc.)
  • Procedural scene generation

Node Graphs

  • Texture graph -- Material Maker-style procedural texture authoring with ~75 node types (noises, patterns, gradients, transforms, color operations); nodes compose into a single fragment shader evaluated on the GPU, with live per-node previews, and bake to textures and PBR material channels
  • Geometry graph -- node-based procedural modeling: parametric generators, subdivision, Conway operators, lattice deform, boolean CSG, point scattering and instancing, nested node groups; evaluated asynchronously on worker threads so editing stays interactive
  • Shared node-editor canvas with a dockable node palette, undo/redo, and JSON serialization; graphs are content-library assets

Ray Tracing

  • CPU ray tracing library with swappable backends (madmann91 bvh, tinybvh, Embree 4) and BVH disk caching, used for mouse picking and spatial queries
  • GPU ray tracing renderer (Vulkan ray query compute): PBR material shading, real scene lights, ray-traced shadows, reflection and refraction for transmissive materials

Lightmap Baking

  • Progressive GPU lightmap baker (ray query compute): direct lighting, indirect bounce, procedural sky lighting, texel supersampling
  • Automatic lightmap UV unwrap with world-space quadtree tile partitioning and per-tile atlas packing
  • Artifact defenses: conservative-raster texel G-buffer, JNLM denoise, seam blending, dilation, shadow terminator fix
  • Tiles persist to disk and stream in by camera distance under a fixed memory budget, so world size is unbounded
  • Bakes progressively in the running editor; lighting and geometry edits invalidate and re-accumulate automatically

File Format Support

  • glTF 2.0 import and export (via fastgltf)
  • Partial support for Wavefront OBJ import

VR / OpenXR

  • Headset rendering with OpenXR
  • Hand and controller tracking with visualization
  • Floating HUD and hotbar UI in VR
  • Passthrough support

Input

  • Keyboard and mouse with configurable bindings
  • SpaceMouse 6DOF input
  • OpenXR controllers

Debug and Development

  • Debug line and text rendering in 3D viewports
  • Physics shape visualization
  • Render graph visualization window
  • Shader hot-reload via shader monitor
  • GL state dump to clipboard
  • Tracy profiler integration
  • Built-in MCP server: scene inspection and editing, screenshots, and tool automation for AI-agent and scripted workflows — see AI creations for agent-built showcase scenes and the editor features they exercise

Libraries

erhe is organized as a set of independent libraries under src/erhe/. Each has a notes.md with details on purpose, API, and design.

LibraryDescription
erhe::graphicsVulkan/Metal-style graphics abstraction: pipelines, buffers, textures, shaders, ring buffers, shader monitor
erhe::rendergraphDAG of render nodes with typed inputs/outputs, executed in dependency order
erhe::sceneglTF-like scene graph: nodes, meshes, cameras, lights, animations, skins
erhe::gltfglTF 2.0 import and export via fastgltf, including KHR physics extensions
erhe::raytraceCPU ray tracing abstraction with swappable bvh / tinybvh / Embree backends and BVH disk caching
erhe::texgenProcedural texture generation: data-driven node descriptors composed into GLSL fragment shaders (Material Maker port)
erhe::graphGeneric node graph: nodes, pins, links, topological-order evaluation; base for the geometry, texture, and shader graphs
erhe::xrOpenXR integration: session and swapchain management, action-based input, hand tracking, stereo rendering
erhe::scene_rendererForward renderer, shadow renderer, ID picking, camera/light/material/joint GPU buffers
erhe::rendererDebug line renderer (compute, geometry shader, or GL_LINES), text renderer, texture blit
erhe::geometryPolygon mesh manipulation via Geogram: subdivision, Conway operators, CSG, shape generators
erhe::primitiveConverts geometry meshes to GPU vertex/index buffers; PBR material definitions
erhe::physicsThin abstraction over Jolt physics: rigid bodies, collision shapes, constraints
erhe::imguiCustom ImGui backend with per-host ImGui contexts and window management
erhe::commandsInput command system with state machine, priority dispatch, and bindings for all input types
erhe::windowSDL / GLFW windowing abstraction with input event handling
erhe::itemBase Item (name, id, flags) and Hierarchy (parent/child tree) classes
erhe::glGenerated type-safe OpenGL wrappers with call logging and extension queries
erhe::mathBounding volumes, viewport projection, input axis filtering, vector/matrix helpers
erhe::dataformatGraphics-API-agnostic pixel and vertex format definitions
erhe::message_busTyped publish-subscribe bus used to decouple editor subsystems
erhe::profileUnified profiling macros dispatching to Tracy, Superluminal, or NVTX
erhe::uiFreeType glyph rasterization and HarfBuzz shaping into GPU font atlases
erhe::logspdlog wrappers
erhe::verifyVERIFY(condition) and FATAL(format, ...) macros
erhe::codegenPython code generator for C++ structs with versioned JSON serialization via simdjson

OpenGL Compatibility

erhe requires OpenGL 4.5 with DSA (Direct State Access); device creation fails on older versions. DSA, SSBOs, compute shaders and clip control are used unconditionally. The former OpenGL 4.1 (macOS) runtime compatibility layer has been removed.

License

erhe's own source is MIT-licensed -- see src/erhe/LICENSE. Bundled and fetched third-party dependencies retain their own licenses; see License.txt for the overview.

Acknowledgements

erhe stands on many excellent open-source projects, including Dear ImGui, Jolt Physics, Geogram, fastgltf, simdjson, SDL, OpenXR, FreeType, HarfBuzz, Tracy, GLM, fmt, and spdlog. Dependencies are fetched at configure time via CPM.cmake.

Static analysis provided by PVS-Studio - static analyzer for C, C++, C#, and Java code, free for open-source projects.

Contributors

tksuoran

2,801 commits

LadislavSopko

12 commits

deccer

8 commits

Languages

C++

66.7%

C

25.6%

Python

4.3%

CSS

1.1%