Canavar Graphics Engine is a basic graphics engine written in C++ using the OpenGL API and Qt 6. It leverages Qt 6 for window and event management, and utilizes Qt's math module for all 3D math operations. The engine is designed to be modular and extensible, supporting a variety of modern rendering features and tools for 3D graphics applications.
- Supports loading GLTF/OBJ/PLY 3D model formats (powered by assimp)
- Parent-child node hierarchy
- Procedural terrain generation with tessellation
- Sky with atmospheric scattering
- Haze effects
- Point lights
- Directional lights
- Spot lights
- Free camera and persecutor camera modes
- Transformation of individual meshes within models
- Primitive models (Circle, Disk, Line, Plane, Sphere)
- Gizmo for interactive object manipulation
- Scene import/export (JSON)
- Opaque and transparent rendering passes
- Editor with ImGui integration
- Physically Based Rendering (PBR) and Phong shading
- Post-processing effects pipeline:
- ACES tone mapping
- Depth of Field
- FXAA anti-aliasing
- Color Grading
- Sharpen
- Chromatic Aberration
- Lens Distortion
- Cinematic effect
- Bloom
- Motion Blur
- Screen Space Ambient Occlusion (SSAO)
- Screen Space Reflections (SSR)
- Point Shadows
- Directional Shadows
- Spot Shadows
- Deferred rendering
- Forward+ rendering
- Ray tracing
- Global illumination
- Volumetric lighting
- Terrain LOD (Level of Detail)
- Terrain texturing with splat maps
- Particle generator
- Volumetric clouds
- Water rendering
- WGS84 ellipsoid support
- Terrain generation using DTED and satellite images
City.mp4
Simulator.mp4
MultipleViews.mp4
-
Install CMake 3.25.1 or newer.
-
Install Visual Studio 2022 and the MSVC 2022 C++ Compiler.
-
Install Qt 6.x.y MSVC2022 64bit kit.
-
Set the environment variable
Qt6_DIRto the path of your Qt installation (e.g.,C:/Qt/6.x.y/msvc2022_64/lib/cmake/Qt6). -
Clone the repository:
git clone https://github.com/berkbavas/CanavarGraphicsEngine.git
-
Create a build directory:
mkdir Build
-
Navigate into the build directory:
cd Build -
Run CMake to configure the project:
cmake ..
-
Open the generated solution file (
Canavar.sln) with Visual Studio 2022. -
Edit
MODELS_FOLDERvariable inSource/Canavar/Engine/Core/Constants.hto point to your models directory. Supported formats: GLTF, GLB, OBJ, PLY. -
Set Editor as the startup project.
-
Build and run the project using the Release configuration.
The Engine module is the core of the Canavar Graphics Engine, providing all essential systems for 3D rendering, scene management, and extensibility. It is written in C++ and leverages Qt 6 for windowing, math, and event handling, and OpenGL 4.5 for graphics.
Source/Canavar/Engine/Camera/— Camera types (FreeCamera, PersecutorCamera, PerspectiveCamera)Source/Canavar/Engine/Core/— Core engine classes (OpenGLWidget, Shader, Framebuffer, RenderingContext, etc.)Source/Canavar/Engine/GlobalNode/— Scene-wide singleton nodes (Sky, Haze, Terrain)Source/Canavar/Engine/Light/— Light types (DirectionalLight, PointLight)Source/Canavar/Engine/Manager/— Managers for rendering, nodes, lights, cameras, etc. (Renderer, NodeManager, LightManager, CameraManager, TexturedModelRenderer, PrimitiveModelRenderer)Source/Canavar/Engine/Model/— Model types and materials (TexturedModel, PrimitiveModel, PbrMaterial, PhongMaterial)Source/Canavar/Engine/Node/— BaseNodeclass with hierarchy supportSource/Canavar/Engine/Object/—Objectbase class (scene objects with transform)Source/Canavar/Engine/PostProcessEffect/— Post-processing effects (ACES, DoF, FXAA, Color Grading, Sharpen, etc.)Source/Canavar/Engine/Scene/— Scene graph internals (Scene, SceneNode, Mesh, TextureMaterial)Source/Canavar/Engine/Util/— Utilities (Logger, AssimpModelImporter, ImGuiWidget, Gizmo, etc.)Resources/Shaders/— GLSL shaders used by the engine
To use the Engine module in your application:
- Create an
OpenGLWidgetas the rendering surface. - Instantiate a
Rendererwith the widget. - Optionally create an
ImGuiWidgetfor the built-in editor UI. - Use the managers (
NodeManager,CameraManager, etc.) to set up your scene. - Implement your own logic by connecting to
Renderersignals (Initialized,Updated,PostRender).
Example:
#include <Canavar/Engine/Core/OpenGLWidget.h>
#include <Canavar/Engine/Manager/Renderer.h>
#include <Canavar/Engine/Util/ImGuiWidget.h>
void MyClass::Run()
{
// Create the OpenGL rendering surface
mOpenGLWidget = new Canavar::Engine::OpenGLWidget(nullptr);
// Create the renderer (owns NodeManager, CameraManager, LightManager, etc.)
mRenderer = std::make_unique<Canavar::Engine::Renderer>(mOpenGLWidget);
// Optionally attach the built-in ImGui editor
mImGuiWidget = std::make_unique<Canavar::Engine::ImGuiWidget>(mRenderer.get());
// Setup connections
connect(mRenderer.get(), &Canavar::Engine::Renderer::Initialized, this, &MyClass::Initialize);
connect(mRenderer.get(), &Canavar::Engine::Renderer::Updated, this, &MyClass::Update);
connect(mRenderer.get(), &Canavar::Engine::Renderer::PostRender, this, &MyClass::PostRender);
mOpenGLWidget->showMaximized();
}
void MyClass::Initialize()
{
mRenderer->GetNodeManager()->ImportNodes("/path/to/your/scene.json");
}
void MyClass::Update(float ifps)
{
// Update code here
}
void MyClass::PostRender(float ifps)
{
// Post-render code here (e.g. custom ImGui windows)
}- Joey de Vries for OpenGL tutorials
- Contributors to Qt, assimp, freetype, JSBSim
This project is licensed under the MIT License. See the LICENSE file for details.