VKG5 / OpenGL

Making an OpenGL/Vulkan based Rendering Engine!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenGL

A rendering engine written in C++ with OpenGL. WIP, trying to make a ray-tracing/path tracing engine with a complete interface. I am not on the dockable branch of ImGUI so there's no docking yet. Docking would be really cool though!

  • Resizeable Window
  • Phong Illumination Model (Ambient, Diffuse, Specular)
  • Shadows (Omni-directional)
  • Light Sources (Directional, Point, Spotlight)
  • Model loading (Now supports multiple textures!)
  • Texture support (Only diffuse)
  • Multi model support
  • Environment Mapping

Below are two different render modes (Material Preview and Wireframe). You can refer to the Files folder which includes more snapshots from the application.

Controls

The application supports various keyboard and mouse events. Listed below are some of the important ones:

- WASD : Fly around the scene in "Camera Mode" like a first person game
- QE : Fly up and down in "Camera Mode"
- Shift + WASD/QE : Speed up in "Camera Mode" as if running in a first person game
- C : Toggle "Camera Mode"
- B : Cycle through various "Rendering Modes"
- M : Cycle through "Anaglyph Rendering Modes"
- F (Path Tracer) : Render the current frame to disk

Physically Based Rendering Support

The renderer supports PBR materials with the following properties! There is basic control over combination of various properties and all the switching happens in 1 Fragment Shader. There are 4 rendering modes:

- Phong Illumination
- Blinn-Phong Illumination
- Gooch Shading
- Minnaert Shading
  • Reflective
  • Refractive
  • Fresnel
  • Dispersion
  • Specular
  • Metallic (This works inversely because of the way it is setup)
  • Multiple Maps - Normal, Specular, Diffuse (TODO : Add Ambient Occlusion and Alpha Maps)

One important point to keep in mind is that, the normals are being inverted while reading models. Why? I made the computations happen as such, which is not the best approach, but I will be switching that out later.

You can refer to the following playlist on YouTube that showcase the exact features!

Procedural

This is a very simple generator that distributes random points in a NxN grid and prevents overlap. The functions can be found in randomDistribute.cpp. There are user friendly controls that can change various parameters such as the seed, gride size, point scale, and number of points. The "update" button is used to reflect the changes! (There may be crashes at some values)

  • Basic Procedural City Generator

Some samples of the for the city are attached below:

The generator runs in real-time, without any noticeable delay.

Animation

I want to integrate rigged characters. I tried using ASSIMP but didn't find that too optimal? Currently looking for more ways to do so!

  • Animation models

Path Tracing

This path tracer has been adapted largely from Sebastian Lague's Ray-Tracing Series. All credits to him for making such useful and easy to understand tutorials :) The Path Tracer currently supports rendering basic shapes such as cubes and spheres. I developed it on a separate branch due to large changes in the main code, because I did not want to scrape off my older code. I am planning to integrate it in the main branch soon. Also, it is very inefficient at the moment, gives about 5-10 FPS on Path Tracing mode.

Below are some renders that were taken by pressing 'F' on the keyboard. The scenes are pre-defined and present in the Procedural_scenes.h


The renders have been denoised using the Blender Denoiser (Compositor). They were exported using the AGX color space in Blender 4.1.0

Supporting Documentation

References

I really love the following books from Packt, which go over OpenGL, CMake, and the supporting dependencies.

Conclusion

This has been one of the best projects that I have worked on in a long while! I want to improve the engine as much as I can, in free time. This is a good starting point with all the core functionality in-place with a fairly good project structure. Feel free to use and modify it as suited to your needs :D

About

Making an OpenGL/Vulkan based Rendering Engine!

License:MIT License


Languages

Language:C++ 61.1%Language:C 36.1%Language:GLSL 2.1%Language:Objective-C 0.3%Language:Python 0.2%Language:CMake 0.1%Language:Makefile 0.0%