Skip to content

fluffels/kwark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kwark

This project is a basic .bsp file loader / viewer.

Motivation

I've written a few renderers for outside scenes, but wanted to try writing one for internal scenes. Using the models and textures stored in Quake's pak0 is an easy way to get models, textures and other resources to test the renderer with.

With this project I'm mostly trying to familiarize myself with Vulkan fundamentals --- to see how everything fits together in a very simple renderer.

I'm also learning a lot about how the various Quake engines work, especially the original software renderer and the vkQuake renderer. That's been fascinating, particularly the limitations OpenGL imposed that weren't present in the software renderer and on the other hand all the work that had to be done to make the software renderer interactive.

Why not start with the Quake source?

It would have been easier in some ways to simply copy the GLQuake source and work on a Vulkan port. This is the approach taken by vkQuake.

I didn't want to do this mainly because trying to figure out as much as I can from incomplete write ups is more fun. I'm also not really interested in writing a complete client, since that's been done before.

A side effect of this is that I'm not constrained by the approach of the old code. Maybe this means I can do some of the things in a more modern way and explore more of Vulkan's functionality.

Progress Screenshot

TODO

  • ✅ Level models
  • ✅ Textures
  • ✅ Light maps
  • 🔲 Handle fullbrights
  • ✅ Animate light maps
  • ✅ Solve "missing" light maps
  • 🔲 Dynamic lights
  • ✅ Remove debug brushes from display
  • ✅ Sky textures
  • ✅ Animated sky textures
  • ✅ Parralax sky textures
  • ✅ Fix projection of sky textures
  • ✅ Animated slime / lava / water textures
  • 🔲 Under water effect
  • ✅ Alias model loading
  • ✅ Fire model
  • ✅ Other scenery models
  • ✅ Monster models
  • ✅ Monster animation

Remarks

Bindless textures in Vulkan were useful. Since Quake uses so few textures per level (~60) it's possible to load them all into a sampler array and pass a texture index along with the vertex data.

Similarly, the entire light map for a level fits in a uniform texel buffer. So all the lighting calculations can be done in the fragment shader.