Skip to content

Tsagae/rtgp-project

Repository files navigation

Real-Time Graphics Programming Project

The project consists in implementing a disintegrating mesh particle effect

demo

Rendering Steps

  1. Drawing the mesh to the main framebuffer but discarding fragments that have a value lower than a (gradually increasing) threshold on a mask texture
  2. Draw the mesh but only the discarded fragments to a separate off-screen framebuffer
  3. Read the off-screen framebuffer on cpu and spawn particles at the position of the discarded fragments
  4. Update particles
  5. Draw particles with instancing

Build

Windows

Dependencies

Install git and cmake

Install build tools for visual studio and check optional during installation:

  • msvc v143
  • c++ cmake tools for windows
  • Windows 10 sdk

Compilation

Open cmd with "Launch" in visual studio build tools 2022 or from start "Developer powershell for VS 2022" and in the root folder of the project run:

   git clone https://github.com/microsoft/vcpkg.git
   cd vcpkg; .\bootstrap-vcpkg.bat -disableMetrics
   cmake -DCMAKE_BUILD_TYPE=Release --preset=default
   cmake --build .\build -- -j 10

To not build the benchmark executable add -DBUILD_BENCHMARK=OFF to this cmake command:

   cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_BENCHMARK=OFF --preset=default

Linux

Dependencies

  • Ubuntu
git cmake g++ libglfw3-dev libassimp-dev libglm-dev libbenchmark-dev
  • Fedora
git cmake g++ glfw-devel assimp-devel glm-devel google-benchmark-devel

Compilation

  • Debug build
  cmake -DCMAKE_BUILD_TYPE=Debug -G "Unix Makefiles" -S . -B ./cmake-build-debug
  cmake --build ./cmake-build-debug -- -j 10
  • Release build
  cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -S . -B ./cmake-build-release
  cmake --build ./cmake-build-release -- -j 10

To not build the benchmark executable add -DBUILD_BENCHMARK=OFF to this cmake command:

   cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_BENCHMARK=OFF -G "Unix Makefiles" -S . -B ./cmake-build-release

Running

Models and textures can be added respectively to assets/models and assets/textures and will automatically appear in the menu after a restart of the application

Options

  • RTGP-Project [width] [height] - Run the program with a custom resolution (without arguments defaults to 1920x1080)

Controls

  • Esc - Toggles the menu on and off
  • R - Resets the simulation
  • P - Pauses the simulation
  • Mouse - Moving the mouse while the menu is closed moves the model on the XY plane

Menu Features

  • Change model and texture
  • Change mask texture used to make the model disappear
  • Rotate and scale the model
  • Particle control (max number, size, speed, lifetime, direction, movement randomness)

Benchmarks

The executable Benchmarks-RTGP-Project runs all benchmarks To run a subset of benchmarks: --benchmark_filter=<regex> Benchamark library docs

Note that running all the benchmarks sequentially can result in a crash on some configurations (Linux/AMD, not on windows). Running the single benchmarks does not result in a crash.

List of benchmarks:

  • BM_UpdateParticles
  • BM_SpawnParticles
  • BM_SpawnAndReplaceParticles
  • BM_DrawParticles
  • BM_CopyFrameBuffer
  • BM_ReadFrameBuffer
  • BM_Pipeline_Step_1
  • BM_Pipeline_Step_2
  • BM_Pipeline_Step_3
  • BM_Pipeline_Step_4
  • BM_Pipeline_Complete

Resources

About

Disintegrating mesh particle effect built with C++ and OpenGL

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors