Descent 1 Raytraced: DXX-Raytracer

Descent raytraced image

Intro

DXX-Raytracer is a raytraced version of the game Descent 1. Using DirectX12 as it's render backend and trying to keep the original feel of Descent 1 by keeping it's main assets.

The project is based on the DXX-Retro repository, it maintained the old C-style codebase and used openGL for rendering.

My work on DXX-Raytracer was diving into the old codebase and transforming the game data to work with a modern graphics API and raytracing.

Below you will see some of my work that I did on the project.

Project overview

View repository

Role: Lead & Engine Programmer

My general work in this project was:

  • Reading, understanding and extending the Descent 1 source code
  • Converting old-style graphics development (e.g openGL immediate mode) to work with modern DirectX12
  • Extending and maintaining the build using Cmake
  • Mainly using the C programming language
  • Pull requests submission and reviews
  • Github: Team-wide version control

My work

Polygon data for Raytracer

Converting immediate mode OpenGL to DirectX12

Much of the converting issues were related to the use of OpenGL immediate mode, which meant that we could not use some of the code that was already there.

The OpenGL version would interpret a large CPU buffer representing a mesh and upload that per frame to the GPU.

The Directx12 version however needed it to be into a GPU readable buffer beforehand, meaning converting the entire mesh to be GPU readable with all textures set.

My work

Below is the function that reads the model buffer from the CPU and converts it to triangles for the GPU buffer. It's based of the original game's way of reading the polymodel buffer

Light & Light Tooling

Light tools using Imgui

Reworking the rasterized descent game into a raytraced experience is more then functions. We also need to tweak some of the actual game values to make the raytracer look good.

My work was related to making sure we can always tweak values from the game. Mainly the dynamic lights from weapons, muzzles and explosions, even adding new dynamic lights such as colored muzzle fire since we can do that now and it looks good.

Another reason for my work is that tweaking lights is fun for the user. So why not.

My work

Uploading the dynamic lights to the renderer and exposing the values to be changed in runtime was largely what I did.

Below you see a demonstration on how changing lights for all weapon types work.

Below you see the interception code for dynamic lights.

Cmake build tooling

Why cmake

We decided to work with CMake this project as I had experience with it and it's used in many open source projects. With it's easy to use scripting language it was an easy choice.

One of the decisions we had to make was to keep the openGL version working at all times. This way we can see if we are missing some visual features or if things look wrong. So using cmake presets was a good way to include and not include some files with a simple press of a button in Visual Studio 2022.

My work

I made about 99% of the CMakeLists and presets. Here are some highlights.

  • Presets to build the raytracer, build and skipping the menu's or the old non-raytraced version.
  • Gracefully (& ungracefully) handling both OpenGL and DirectX12 versions of the game.
  • Rewriting SCONS build scripts to CMake.
  • Game asset management for builds.
  • Extensive debug builds for both Debug and Release
  • Handling builds for easy shipping
  • shared library management for multiple executables.
Miscellaneous

My main work were implementing various features from Descent, with the Polygon rendering being the biggest one. However, here are some minor tasks that I wish to showcase.

Screen overlay color effect.

I often did not work in shaders as my work was converting data for the renderer to use, with me and the render backend people finding out what the best way of converting it is. However, I did work on one specific post-process effect for screen overlays for when you get hit or take an item.

SDL 1.0 input for Imgui

SDL 1.0 has no IMGUI examples and has a less extensive input System then 2.0+. So converting it was a pain with text and modifier keys.

Freelist Descriptor allocator for DirectX12 to support unloading meshes.

Having experience with basic memory algorithms I made a freelist allocator for a descriptor heap in DirectX12, we use this one for dynamic loading of meshes.

This website was partially made with the thanks of our wonderful new technology, ChatGPT