~bakpakin/jvk

Janet rendering playground with Vulkan
More changes to grass tests.
Add build-rules for incremental, parallel builds.
Add framerate to debug data.

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~bakpakin/jvk
read/write
git@git.sr.ht:~bakpakin/jvk

You can also use your local clone with git send-email.

#JVK - Vulkan Renderer

A simple Vulkan Renderer. This is a self learning project, don't use it for anything. It reimplements many things like Vulkan memory allocation and window creation that can be more robustly handled by existing libraries. Also the Janet (scripting language) binding is neat but entirely unnecessary - the demos could be written in C against the public facing header jvk.h. Also we don't use C++ so as to be as close as possible to the Vulkan API (it is more convenient to create struct literals in C99 than C++, although since starting this, the vulkan headers now have a standardized C++ wrapper that is equally convenient from C++). And I like (tolerate) C, sue me.

ScreenShot

#Features

  • GLTF model loading.
  • Metallic Roughness shading
  • Spot lighting
  • Spherical harmonics global illumination (single light probe for now, very very basic).
  • Simple shadow-mapping with PCF.
  • Dynamic texture, mesh, light and instance loading and unloading.
  • Skybox for simple reflection mapping
  • Debug view modes
  • No runtime dependencies besides Vulkan, C runtime, and OS libraries (and xcb on linux).
  • Text rendering and very basic HUD.
  • Terrible Perlin noise "terrain" generation (really just for tests).

#Implementation Characteristics

  • Bindless shader design - uses (mostly) one large descriptor set.
  • Simple but efficient bitmap-based Vulkan memory allocator in alloc.c
  • Abstracted Graphics and Compute pipelines and pipeline creation utilities
  • Shaders compiled offline to SPIR-V - ro runtime shader compiler. Shader variants are implemented with specialization constants.
  • Shadow mapping done in realtime (despite limited movement in demos).
  • Support for vertex skinning
  • Partial GLTF support - normal mapping, ambient occlusion, metallic roughness, albedo.
  • Simple mesh batching

#TODO

  • Flesh out a global illumination solution
  • Animation of skinned meshes
  • Improve shadow mapping
  • Better GLTF material support.
  • Post Processing
  • Raytracing and Mesh pipelines (RT ambient occlusion? RT reflections? Option for fully raytraced scene?)
  • LOD support
  • Do something interesting with compute shaders (particles, hair, etc.)
  • Volumetric lighting
  • Better font rendering (using Bezier curves rather than bitmaps).
  • GUI improvements - simple interactive components (buttons and stuff) for demos rather than HUD.

#Editing Shaders

  • Download and install shaderc
  • Remove spirv directory
  • Use janet bundle/build.janet to rebuild shaders.

#Pre-requisites

  • Linux with X11 or Windows
  • Vulkan 1.2 or greater
  • MSVC on Windows or GCC/Clang on Linux
  • Google's Shaderc if you want to recompile/edit shaders
  • Janet interpreter.

#Build

  • Install janet
  • Get a C compiler toolchain. On windows, visual studio 2019 or later should work (probably earlier too), and GCC/clang should work on Linux. On Windows, make sure to build within "x64 Native Tools Command Prompt" to ensure that the MSVC toolchain is on the path.
  • Within terminal, use
$ janet bundle/build.janet

To build the Janet module (this a DLL that the Janet runtime can load).

  • To run some of the demos, use
# janet scripts/grass.janet
Do not follow this link