SeppahBaws / Hyper

A simple real-time hybrid ray tracer I built to explore the Vulkan Ray Tracing API.

Home Page:https://seppedekeyser.be/projects/hyper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hyper

This is my hybrid ray tracer project, which I started to look into how the Vulkan Ray Tracing API works.

Because this is mostly a research project, the code is far from perfect. It is probably decent enough that a beginner might learn a thing or two, but definitely don't look at this for best-practices.

General info

Frame structure

Nsight frame structure

The renderer works in three passes:

  1. Geometry pass
  2. Ray tracing pass
  3. Combine pass

1. Geometry pass

The geometry pass simply renders the mesh albedo and scene depth to an off-screen render target.

Color output format: R8G8B8A8_UNORM

Geometry pass color output

Depth output format: D24_UNORM_S8_UINT

Geometry pass depth output

2. Ray tracing pass

The ray tracing pass traces 1 shadow ray per pixel, to see if that pixel should be shaded as shadow or as lit.

Ray tracing output format: R8_UNORM

Ray tracing pass output

3. Combine pass

The combine pass takes the geometry and ray tracing outputs and combines them together to present the final image. In here, gamma correction and some simple exposure control is also applied.

After this step, the Dear ImGui ui is drawn on top of this final output.

Combine pass output format: B8G8R8A8_UNORM (needed to present this final output to the swap chain)

Combine pass output

Coordinate system

Hyper uses a right-handed z-up coordinate system, the same system that Blender's default settings use.

Loading your own models

The project out-of-the-box comes with the standard Sponza model. Luckily enough loading your own models is super easy:

  1. Open Hyper/src/Hyper/Scene/Scene.cpp file, and scroll down to the Scene::OnInitialize() implementation.
  2. Change the line which imports the model from a file:
ImportModel("path/to/my/model.gltf", /* position */, /* rotation */, /* scale */);

The position, rotation and scale parameters are of type glm::vec3, and default to {0, 0, 0}, {0, 0, 0} and {1, 1, 1} respectively.

Hyper uses Assimp to load models, so almost any model format should be supported.

Getting Started

Prerequisites

  • Vulkan 1.3 SDK
  • git LFS
  • python
  • a GPU that is able to run ray tracing workloads.

Setting it up

  1. Clone the repository recursively to get all the submodules: git clone --recurse-submodules https://github.com/SeppahBaws/Hyper.git
  2. Double-click the scripts/SetupMinimal.bat file to generate the project.

The scripts/Setup.bat script features some more options:

  • Use VLD - this will use Visual Leak Detector to detect memory leaks (limited to Windows and Visual Studio)
  • Use Nsight Aftermath - this will use the Nsight Aftermath SDK to handle GPU crashes (limited to systems with NVIDIA GPUs)

Screenshots

who doesn't like some fancy screenshots, right?

Expand to show screenshots
BistroExterior_01 BistroExterior_02
BistroInterior_01 NewSponza_01
SanMiguel_01 SanMiguel_02
TrainStation_01 TrainStation_02

About

A simple real-time hybrid ray tracer I built to explore the Vulkan Ray Tracing API.

https://seppedekeyser.be/projects/hyper

License:MIT License


Languages

Language:C++ 68.0%Language:C 30.7%Language:Lua 0.4%Language:HLSL 0.4%Language:GLSL 0.4%Language:Python 0.1%Language:Batchfile 0.0%