Skip to content

Research renderer for real-time SDF data, built with C++ and Vulkan. Focuses on occlusion optimizations and mesh shaders as part of a Master's degree project.

License

Notifications You must be signed in to change notification settings

Reefufui/sdf_raster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sdf_raster

Stanford Bunny Face
What camera sees.

Stanford Bunny Frustum Culled
What is actually rendered.

About The Project

sdf_raster is a research renderer developed in C++ using the Vulkan API, designed for efficient rendering of SDF data in real-time. It showcases occlusion optimizations and mesh shaders (WIP).

The goal of this master degree diploma project is to develop accelerated implicit surface rasterization algorithm on GPU.

Features

  • SDF triangulation: Dynamic geometry generation from SDF octrees using Marching Cubes.
  • Frutum culling: Culling whole SDF-octree subtrees which are not intersected with frustum.
  • Fly-around cam: Simple camera and controls for scene navigation. Caches previous camera view.
  • Culling demo: Ability to leave your current frustum and look at the renderered scene from another angle.
  • Occlusion culling (WIP): Occlusion culling optimization using H-Zbuffer.
  • Mesh shading (WIP): Directly feeding rasterizer with geometry, rather then using per-frame vertex buffers.

Technology Stack

  • Language: C++17 (or higher)
  • Graphics API: Vulkan 4.0+
  • Build System: CMake
  • Windowing System: GLFW
  • Third-party Libraries:
    • Vulkan SDK (for Vulkan API and tooling)
    • volk (Vulkan function loader)
    • spdlog (for logging)
    • LiteMath (linear algebra)
    • nlohmann/json (for configuration/data parsing)
    • dear ImGui (for debug GUI/interface)
    • stb_image (for texture/image loading)
  • Shader Language: Slang

Building the Project

Prerequisites

  • Vulkan Libraries (optional Vulkan SDK for Debug): Vulkan 4.0+
  • C++ Compiler: g++ or clang.
  • Shader Compiler: slangc. See script ./utils/install_slang.sh for quick install or use Vulkan SDK.
  • CMake: Version 3.16 or newer.
  • OS: Linux, macOS. Windows is not supported.

Build Instructions

  1. Clone the repository:

    git clone https://github.com/Reefufui/sdf_raster.git
    cd sdf_raster
  2. Configure and Build:

    • For Linux:

      cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
      cmake --build build -j$(nproc)

      *Optionally, replace -DCMAKE_BUILD_TYPE=Release with Debug or RelWithDebInfo. If so, make sure that Vulkan SDK: is installed and properly configured. The VULKAN_SDK environment variable must be set. See script utils/install_vulkan_sdk_apt.sh for quick linux setup.

    • For macOS:

      cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
      cmake --build build -j$(sysctl -n hw.ncpu)

      *Optionally, replace -DCMAKE_BUILD_TYPE=Release with Debug or RelWithDebInfo. If so, make sure that Vulkan SDK: is installed and properly configured. The VULKAN_SDK environment variable must be set.

Running the Project

Important: The application must be run from the build directory to ensure all resources are loaded correctly.

After building the project, navigate to the build directory and run the executable:

cd build
./bin/sdf_raster

Usage and Controls

  • Toggle Camera Mode:
    • click | esc: Exit flying camera mode. (Cursor becomes enabled).
    • right click: Enter flying camera mode. (Cursor becomes disabled).
  • Movement (in Camera Mode):
    • w, a, s, d: Move forwards, left, backwards, right.
    • space: Move up.
    • ctrl (control): Move down.
    • mouse: Look around.
    • scroll: Adjust FOV.
  • Camera Reset:
    • r: Reset camera position and orientation.
  • FPS dump:
    • i: Dump current FPS to log.
  • Toggle Frustum View:
    • c: Toggle culling visualization (to see which parts are rendered).
  • Exit Application:
    • Close the window.

Note

  • Camera settings are saved (/tmp/cached_camera.json) and restored between sessions.