GithubHelp home page GithubHelp logo

vkg5 / opengl Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 743.9 MB

Making an OpenGL/Vulkan based Rendering Engine!

License: MIT License

CMake 0.11% Makefile 0.01% C++ 61.10% C 36.14% GLSL 2.13% Python 0.22% Objective-C 0.29%

opengl's Introduction

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

opengl's People

Contributors

vkg5 avatar

Watchers

 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.