All Projects → kayru → Raytracedshadows

kayru / Raytracedshadows

Licence: mit
This demo implements BVH construction and GPU traversal for rendering hard shadows.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Raytracedshadows

zig-gamedev
Building game development ecosystem for @ziglang!
Stars: ✭ 1,059 (+889.72%)
Mutual labels:  vulkan, raytracing
Diligentcore
Core functionality of Diligent Engine
Stars: ✭ 263 (+145.79%)
Mutual labels:  vulkan, raytracing
Nabla
OpenGL/OpenGL ES/Vulkan/CUDA/OptiX Modular Rendering Framework for PC/Linux/Android
Stars: ✭ 235 (+119.63%)
Mutual labels:  vulkan, raytracing
Wickedengine
3D engine focusing on modern rendering techniques and performance.
Stars: ✭ 3,148 (+2842.06%)
Mutual labels:  vulkan, raytracing
Vk denoise
Denoising a Vulkan ray traced image using OptiX denoiser
Stars: ✭ 41 (-61.68%)
Mutual labels:  vulkan, raytracing
Lift
Vulkan Path Tracer with Optix Denoiser integration
Stars: ✭ 30 (-71.96%)
Mutual labels:  vulkan, raytracing
CLUSEK-RT
Vulkan based C++ ray-tracing game engine.
Stars: ✭ 24 (-77.57%)
Mutual labels:  vulkan, raytracing
vulkan-raytracing
"Simple" Vulkan raytracing
Stars: ✭ 27 (-74.77%)
Mutual labels:  vulkan, raytracing
Vk mini path tracer
A beginner-friendly Vulkan path tracing tutorial in under 300 lines of C++.
Stars: ✭ 599 (+459.81%)
Mutual labels:  vulkan, raytracing
Vk raytracing tutorial khr
Ray tracing examples and tutorials using VK_KHR_ray_tracing
Stars: ✭ 461 (+330.84%)
Mutual labels:  vulkan, raytracing
Vk raytracing tutorial
Vulkan ray tracing tutorials
Stars: ✭ 144 (+34.58%)
Mutual labels:  vulkan, raytracing
Vk raytrace
Ray tracing glTF scene with Vulkan
Stars: ✭ 91 (-14.95%)
Mutual labels:  vulkan, raytracing
Diligentengine
A modern cross-platform low-level graphics library and rendering framework
Stars: ✭ 2,142 (+1901.87%)
Mutual labels:  vulkan, raytracing
awesome-rtx
Curated collection of projects leveraging NVIDIA RTX technology (OptiX, DXR, VKR)
Stars: ✭ 73 (-31.78%)
Mutual labels:  vulkan, raytracing
Quartz
Vulkan RTX path tracer with a declarative ES7-like scene description language.
Stars: ✭ 367 (+242.99%)
Mutual labels:  vulkan, raytracing
Gears Vk
Powerful low-level C++20 rendering framework for Vulkan 1.2, including Real-Time Ray Tracing (RTX) support, built atop Auto-Vk.
Stars: ✭ 71 (-33.64%)
Mutual labels:  vulkan, raytracing
Flycube
Graphics API wrapper is written in C++ on top of Directx 12 and Vulkan. Provides main features including ray tracing.
Stars: ✭ 78 (-27.1%)
Mutual labels:  vulkan, raytracing
50yearsofraytracing
以历史的发展的眼光来看光线追踪技术,1968年至2018年重点论文相关算法复现。
Stars: ✭ 90 (-15.89%)
Mutual labels:  raytracing
Nova Rs
Nova Renderer, but in Rust
Stars: ✭ 98 (-8.41%)
Mutual labels:  vulkan
Monte carlo ray tracer
A program with an implemented Monte Carlo Ray Tracer algorithm for global illumination of a virtual 3D scene.
Stars: ✭ 90 (-15.89%)
Mutual labels:  raytracing

Ray Traced Shadows

This demo implements BVH construction and GPU traversal for rendering hard shadows.

BVH Construction and Layout

BVH is constructed on CPU. The build process is fairly naive, but results in a high quality hierarchy that's fast to traverse. The tree is constructed using a top-down strategy, using a surface area heuristic (SAH) to find optimal split point at every level.

Nodes are laid out in memory using a depth-first traversal order. Child node with the larger surface area is always on the left. This heuristic aims to find an intersected primitive for a ray in a cache-coherent manner.

Each intermediate BVH node is packed into 32 bytes:

struct BVHNode
{
	vec3 bboxMin;
	uint primitiveId;
	vec3 bboxMax;
	uint next;
};

Leaf BVH nodes are packed into 48 bytes:

struct BVHNodeLeaf
{
	vec3 edge0;
	uint padding0;
	vec3 edge1;
	uint next; // node miss pointer
	vec3 vertex;
	uint padding2;
};

BVH Traversal

Hard shadows are implemented by using any-hit BVH traversal for a ray on GPU. A stackless algorithm is used, which relies on the depth-first memory layout of the tree.

The bounding box of each visited intermediate node is tested against a ray. On hit, the next node that must be visited is next in memory. On miss, current node's next pointer is used to skip part of the tree. This either jumps to the current node's right sibling or to the parent's right sibling.

Each intermediate node contains a primitiveId field. If this field is not 0xFFFFFFFF, then current node is reinterpreted as BVHNodeLeaf. Extra data for leaf nodes is stored deinterleaved (at the end of the BVH buffer).

How to build on Windows with Visual Studio 2017

Clone repository

[email protected]:kayru/RayTracedShadows.git
cd RayTracedShadows
git submodule update --init

Generate Visual Studio solution

cd Scripts
cmake-vs2017-vk.cmd

Solution files written to Build directory in the root of the repository.

Acknowledgements

This demo uses similar ideas to what is described in the following work:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].