Modern Vulkan-based 3D engine featuring procedural shape generation, scene management, and ImGui integration
Find a file
2015-11-22 13:36:42 +01:00
images Readme with (tentative) list of examples. screenshots 2015-11-17 23:11:35 +01:00
models Added COLLADA and glTF formats for vulkanscene 2015-08-16 11:58:50 +02:00
screenshots Screenshot and info on vulkan demo scene 2015-11-22 13:36:42 +01:00
.gitignore Added models for hamardillo, missing .obj wavefront files, added .obj wavefront files exception to .gitignore 2015-08-15 17:33:51 +02:00
README.md Screenshot and info on vulkan demo scene 2015-11-22 13:36:42 +01:00

Vulkan examples and demos

Vulkan demo scene

Future place for examples and demos for Khronos' new 3D and compute API Vulkan(tm)

Vulkan from my point-of-view

I recently did a write-up with my personal view on Vulkan for a hobby developer. It goes into detail on some of the most important things to consider when deciding on how to switch over from Vulkan and also clears up some things that several press articles got wrong.

Vulkan example base class

All examples are derived from a base class that encapsulates common used Vulkan functionality and all the setup stuff that's not necessary to repeat for each example. It also contains functions to load shaders and an easy wrapper to enable debugging via the validation layers.

If you want to create an example based on this base class, simply derive :

#include "vulkanexamplebase.h"
...
class MyVulkanExample : public VulkanExampleBase
{
  ...
  VulkanExample()
  {
    width = 1024;
    height = 1024;
    zoom = -15;
    rotation = glm::vec3(-45.0, 22.5, 0.0);
    title = "My new Vulkan Example";
  }
}
Validation layers

The example base class offers a constructor overload for enabling a default set of Vulkan validation layers (for debugging purposes). If you want to use this functionality, simple use the construtor override :

VulkanExample() : VulkanExampleBase(true)
{
  ...
}

todo : Document helper classes like vulkandebug

Examples

todo : In progress

Triangle

Most basic example. Renders a colored triangle using an indexed vertex buffer, only one pipeline with very simple shaders. Uses a single uniform buffer for the matrices.

Texture

Loads a single texture and displays it on a simple quad.

Pipelines

Pipelines replace the huge (and cumbersome) state machine of OpenGL. This example creates different pipelines with different states and shader setups.

Gears

Vulkan interpretation of glxgears. Procedurally generates separate meshes for each gear, with every mesh having it's own uniform buffer object for animation. Also demonstrates how to use different descriptor sets.

Mesh rendering

Uses assimp to load and a mesh from a common 3D format. The mesh data is then converted to a fixed vertex layout matching a basic set of shaders.

Mesh instancing

Renders hundreds of meshes using instances with uniforms for e.g. coloring each mesh separately.

Spherical environment mapping

Uses a matcap texture (spherical reflection map) to fake complex lighting. It's based on this article.

(Tessellation shader) PN-Triangles

Generating curved PN-Triangles on the GPU using tessellation shaders to add details to low-polygon meshes, based on this paper.

(Tessellation shader) Displacement mapping

Uses tessellation shaders to generate and displace geometry based on a displacement map (heightmap).

(Geometry shader) Normal debugging

Renders the vertex normals of a complex mesh with the use of a geometry shader. The mesh is rendered solid first and the a geometry shader that generates lines from the face normals is used in the second pass.

Vulkan demo scene

More of a playground than an actual example. Renders multiple meshes with different shaders (and pipelines) including a background.

Dependencies

Note: Not all demos require all of these

External resources

TODO : In progress