Awesome
MAGE Framework
Vulkan Framework for testing out and demoing shader techniques I've been intrigued by
Design Goals:
- Framework is meant to ease exploration of graphical techniques and ideas.
- This framework will optimize for the individual techniques rather than the framework itself. The framework is not meant to be slow but resources will be put towards exploring techniques and creative ideas rather than fine grained optimization of the framework.
- Cross API; Currently it only supports Vulkan but I want to have it support both Vulkan and DX12/DXR
To Do List (Features/Tasks/Demos)
- Scene Rendering (Multuiple meshes, textures, and shaders. Meshes are stored and rendered from a single buffer using vertex offsets. Use push constants, separate per-model and scene descriptor sets are used to pass data to the shaders).
- Sky Compute Shader
- Grass Shaders (Compute, Tesselation and Frag shader)
- Witcher 3 painted world post process shader
- VK_NV_raytracing
- Terrain
- Visibility Buffer
- Clouds
- Sea/Water
- Demo
- DXR/DX12 support
Design Decisions
Writing to the Swapchain Image:
I've elected to write to the swapchain only after all of the post process passes have been executed. These post process passes write to their own frame buffers. And after the last pass is executed I copy the image from the frame buffer into the swapchain via vkCmdCopyImage(...) I use a copy image command instead of using a subpass because:
- I want the post process pipeline to be relatively independent of the swapchain, this way if I choose to reorder the order of the passes I dont have to worry about removing and adding the subpass that writes to the swapchain image.
- Setting #1 above to work automatically is definitely possible but requires more effort than the current approach.
- Unsure of the performance benefit (I'm sure there is one I just don't know if it will be significant enough) to justify the increase in code complexity necessitated by the automated setup mentioned in #2
- The framework has a design goal of efficiency in the individual techniques rather than the framework itself. Because trying to optimize a framework/engine is it's own beast.
Render Order
Compute passes -- for things that dont run on a per pixel basis Forward render pass / Deferred rendering / RayTracing Composite compute onto forward render Post process Passes: - First few high res passes make use of compute results to render additional scene elements like grass or the sky. - High Res passes - Tone Map - Low Res passes - Last post process also does gamma correction Copy last post process pass's framebuffer into swapchain render imgui UI to the swapchain
Adding Post Process Passes
-
Create the descriptors (expand pool, create descriptor set and layout, write to and upadte descriptor set)
-
Add the pass in void VulkanRendererBackend::createAllPostProcessEffects(...)
-
(Optional), decide how often it is updated (not a generic process yet)
Credits/Dependencies:
Tested On:
- Windows 10
- Vulkan 1.2.131.2
- Visual Studio 2019
- GPU: Nvidia GeForce RTX 2080 Ti
- CPU: AMD Ryzen 7 3700X 8-core Processor