Giter VIP home page Giter VIP logo

croissantvulkanrenderer's Introduction

Croissant - Real-Time Vulkan Renderer

Real-time, Physically based renderer built with Vulkan and modern C++17.

About

The aim of this project was to create a properly functioning render graph that would allow me to learn and experiment with Vulkan, as well as provide an opportunity to learn graphics techniques.

Disclaimer

This project is under development, expect API changes, bugs and missing features.

Render Samples

1gg 3c t2 Screenshot from 2023-02-20 15-12-01 t5 t6

Features

Renderer

  • Physically based rendering(Cook–Torrance BRDF)
  • Image based lighting
  • Forward rendering
  • Multisample anti-aliasing (MSAA)
  • HDRI skymap loading
  • Compute shaders
  • Shadow mapping
  • Normal mapping
  • Different light types (directional, point and spot lights)
  • Texture mipmaps
  • Arcball camera
  • GUI

Other Features

  • Multi-threaded texture asset importing
  • Model loading

Repository structure

Croissant
|
|-- assets              
|   |-- models              # Meshes and textures
|   `-- skybox              # HDR files with their generated irradiance, prefiltered env. and BRDFlut textures
|
|-- bin                     # Contains the executable files
|
|-- build                   # CMake compile
|
|-- include                 # Project header files
|   `-- Settings            # All user tweakable settings files(scene, camera, pipeline, etc)
|
|-- libs                    # Dependencies
|   |-- ASSIMP
|   |-- GLFW
|   |-- GLI
|   |-- GLM
|   |-- Dear imgui           
|   |-- stb_image
|   |-- tracy
|   |-- Vulkan-Loader            
|   `-- Vulkan-Tools
|
|-- shaders
|
|-- src                     # C++ implementation files
|   |-- Buffer
|   |-- Camera
|   |-- Command
|   |-- Computation
|   |-- Descriptor
|   |-- Device
|   |-- Features
|   |-- Framebuffer
|   |-- GUI
|   |-- Image
|   |-- Math
|   |-- Model
|   |-- Pipeline
|   |-- Queue
|   |-- Renderer
|   |-- RenderPass
|   |-- Scene
|   |-- Shader
|   |-- Swapchain
|   |-- Texture
|   |-- VkInstance
|   `-- Window
|   
`-- CMakeLists.txt          # CMake build script

Third party libraries

Here's the list of the libraries included in the project:

  • ASSIMP: Mesh and material loading.
  • GLFW: A multi-platform library for window and input.
  • GLI: Image library(used to generate the BRDFlut texture).
  • GLM: Mathematics library for graphics software.
  • ImGui: GUI.
  • stb_image: Image loading/decoding.
  • Tracy: Frame profiler.
  • Vulkan-Loader
  • Vulkan-Tools: Validation Layers.

Render Graph

Render Graph (5) Render Graph (6)

Usage

Warning

  • The renderer currently only works with a dedicated graphics card, but I will add compatibility with integrated GPUs in the future.
  • To start the renderer, you need to add one skybox, one directional light, and at least one model.
  • To add a model or skybox to the render, add the folder in 'assets'.
  • Modify the config.h file in 'Settings' to change a lot of parameters.
/* Commands:
*   
*   - addSkybox(fileName, folderName);
*   - addObjectPBR(name, folderName, fileName, position, rotation, size);
*   - addDirectionalLight(name, folderName, fileName, color, position, targetPosition, size);
*   - addSpotLight(name, folderName, fileName, color, position, targetPosition, rotation, size);
*   - addPointLight(name, folderName, fileName, color, position, size);
*
*   - demo1(); // Damaged Helmet
*   - demo2(); // AK 47
*   - demo3(); // Collier Flintlock Revolver
*   - demo4(); // Sponza day
*   - demo5(); // Sponza night
*   - demo6(); // Metal Rough Spheres
*/

int main()
{
   Renderer app;

   try
   {
      // Scene
      {
         app.addSkybox("fileName.hdr", "folderName");
         app.addObjectPBR(
               "name",
               "folderName",
               "fileName",
               glm::fvec3(0.0f), // Position
               glm::fvec3(0.0f), // Rotation
               glm::fvec3(1.0f)  // Size
         );
         app.addDirectionalLight(
               "name",
               "folderName",
               "fileName",
               glm::fvec3(1.0f), // Color
               glm::fvec3(0.0f), // Position
               glm::fvec3(1.0f), // Target Position
               glm::fvec3(1.0f)  // Size
         );
      }

      app.run();

   } catch (const std::exception& e)
   {
      std::cerr << e.what() << "\n";

      return 0;
   }

   return 0;
}

Controls

Input Action
RMB drag Rotate camera
Scroll wheel Zoom in/out

Dependencies

  • cmake >= 3.9.1
  • gcc >= 9.4.0
  • vulkan-validationlayers-dev
  • spirv-tools
  • glslc

Building on Linux

$ git clone --recurse-submodules https://github.com/SaferGo/CroissantVulkanRenderer.git
$ cd CroissantVulkanRenderer/build
$ bash buildReleaseMode.sh
// or buildDebugMode.sh

After a successful build, the resulting executable can be found in the bin directory.

Tested toolchains

Compiler Operating System Architecture
GCC 9.4.0 Linux Ubuntu 20.04.4 with kernel 5.8.0-53 x64
? Windows 11 (will be added soon) x64

References

Included assets

The following assets are bundled with the project:

- HDRs

- Models

croissantvulkanrenderer's People

Contributors

safergo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.