Ex-game developer, ex-rasterizer, now doing ray tracing, low-level optimization and lecturing about it for fun and profit. Mostly for fun though! C+/"Sane C++".
New blog post: proper BVH construction, starting with the basics, with (sane C++) source code. Plan is a series of articles; this is the first one.
Up next: SAH, ordered traversal.
Two of my students (August van Casteren,
Shreyes Jishnu Suchindran) handed this in for the final assignment of the Advanced Graphics course. Every vertex of a 250K dragon was replaced by... a dragon. 60fps, 1080p, uses C# -> OpenTK -> compute shaders. I'm speechless.
What are the odds. Apparently some glass doors are oriented just right to cause the sun to reach an office via multiple specular bounces. Turner Whitted would approve. Via:
In 2010 I wrote a blog post about efficient trilinear interpolation on the GPU by exploiting direct manipulation of the bits of a floating point number for fast evaluation of 2^x:
The final episode of the tutorial on BVH construction is now available:
This time: GPU TLAS&BLAS, applied to a massive scene, CL/GL interop for faster frames. Code on Github, as usual:
This is the end... for now. Thanks for reading!
Descent Raytraced - Version 1.0.0 Release
Download here:
More info in the release announcement on reddit:
Awesome job by a talented group of
@BuasGames
#ThisIsIGAD
students!
I am going to write a path tracer in a couple of tweets. I will comment on each to clarify the functionality and some decisions. Brevity is key here, so sacrifices are made for that. Correctness is not one of those however.
(1/2^4)
2019 article on "Probability Theory for Physically Based Rendering":
Attempt to make this topic accessible to a broad audience. Got my site severely slashdotted. :)
There's a PART2 as well:
Episode 6 in the series on real-time Voxel Ray Tracing in C++ is now available:
This time: Path Tracing. Including: BRDF & pdf, the random bounce, cosine-weighted bounce and verifying ground truth.
Article 6 on constructing a BVH for animated scenes (on the CPU, in sane C++) is under construction. In the meantime, the first 5 articles are now available. In case you missed any of them:
(and two more!)
At the risk of boring many of my followers, here's a pure c ray tracer in 479 characters, including the
#includes
and mandatory \n's following those; excluding the clarifying remarks. In two tweets!
Based on the work by
@aaed3r
/
@Kweepa
(via
@bbcmicrobot
). Added a few tricks. :)
Article
#3
on proper BVH construction is now online:
In this post: binned BVH construction; SAH-guided trees at a fraction of the cost, with a minimal reduction of tree quality.
Tiny implementation as usual can be found on github: .
Utrecht University students Drenth & De Munck got a pull request for
#Godot
approved after taking the "Optimization and Vectorization" course and picking AStarGrid2D as their final project. They made the code 10x faster. Congrats!
Article
#7
on proper BVH construction is now available:
As always, complete with 'Sane C++' code on Github:
In this episode:
Barycentric coordinates, texturs, normals, uv-coordinates. Prepping for Whitted-style ray tracing.
In case this is relevant to anyone: Here's the full source code (~500 lines) for a sub-pixel / sub-texel accurate FATMAP2.TXT software rasterizer capable of rendering large scenes in real-time:
It's also available as a 'rendercore' in Lighthouse 2.
#RTXOff
Replication of a scene by M.C. Escher, rendered in Lighthouse 2: small scene (<12k tris) reflected in a metal ball. Scene has mirrors at the end of each hallway to obtain the infinite hallways.
Episode 3 of the Voxel Ray Tracing in C++ series is now available:
This time: stochastic techniques; anti-aliasing, the accumulator, soft shadows. And: scene loading.
Viking outpost scene credit: PabloDebusschere / Sketchfab.
The final article (
#6
) in the series on how to build a BVH is now available:
This time: building a TLAS over a group of bottom-level BVHs, with instancing and per-object transforms. Includes full source code on Github, in six steps:
The Lighthouse 2 rendering framework for real-time ray tracing / path tracing R&D is now open source:
Modules for Optix and Optix Prime are available now; Embree & OpenCL will follow later.
A proper blog post will follow shortly.
Article
#2
on proper BVH construction is now available on my blog:
This one deals with ordered traversal and SAH as well as some smaller things.
BVH construction times are through the roof; next article will discuss ways to speed this up.
The second episode in the series on Voxel Ray Tracing in C++ is now available:
In this episode we add recursive reflections and refraction with Snell's law and Fresnel. With the included template, everything runs in real-time on your CPU.
The first article in a new "intermediate" series on Ray Tracing with Voxels is now available:
Topics:
1. Lights and shadows
2. Whitted-style
3. Stochastic techniques
4. Noise reduction
5. Reprojection
6..9: ?
One article per week, until I run out!
Episode 4 of the series on Voxel Ray Tracing in C++ is now online:
In this episode: improving soft shadows using stratification and blue noise.
As always, it starts with the template, available from Github:
Made a quick blog post about reprojection without camera matrices, which is easy to use in a ray tracer. The method uses the view pyramid of the previous frame instead:
Probably not new, so if you have seen it before, let me know, so I can reference.
Update to the voxel engine: pure image based lighting, better 'short ray GI', and (basic) TAA. Together it seems sufficient (in most cases) for low-noise light, while reaching 120+ fps on a 2070. Git repo will be updated shortly.
Article
#5
on proper BVH construction is now online:
As usual, this comes with 'sane C++' source code on Github:
At least one more article is planned (next week or so), in which everything will be tied together properly.
Blog post: optimizing Lighthouse 2.
Various optimizations to the CUDA shading code, yielding ~30% faster code. Most of this should be applicable to generic GPU code. Optimized result: Lighthouse 2 benchmark (
#RTXON
/
#RTXOff
): .
Preparing episode 6 for the Voxel Ray Tracing in C++ series, of which the first 5 episodes are available on my blog:
Path tracing requires a tiny algorithm, but it produces some stunning results. Hopefully the article is done on Wednesday.
I used that paper for 10 years in the Utrecht University master course on Optimization & Vectorization. I think that what every programmer should *actually* know is hidden in there, but surrounded by other stuff. :) Nevertheless: Every programmer should read this at least once.
I wish colleges taught everything mentioned in this ~100-page paper for their computer architecture course.
The paper talks so much about cache, OS, threads, memory controller, and how the CPU juggles in between.
If you're in your 2nd or 3rd year and want to better understand
More great SIGGRAPH'24 papers on Ke-Sen Huang:
Realtime Path Guiding Using Bounding Voxel Sampling
Temporally Stable Metropolis Light Transport Denoising using Recurrent Transformer Blocks
Practical Error Estimation for Denoised Monte Carlo Image Synth.
Article 9b on proper BVH construction is taking a bit longer than expected - because it's long! In the meantime, you can find the in-progress code, with working TLAS/BLAS, on github:
It's fast too, and doesn't require RTX, just an OpenCL-capable GPU.
New in Lighthouse 2: optionally rendering without NEE (just IBL, reaching 10+ spp @ 1920x1080, 40Hz); increased max samples per pixel; new demo app (WIP); fixes to the animation system and Optix7 top-level hierarchy handling. Model by Robert Jordan, via .
Ancient research on ray tracing and games. :) Pretty much my first exposure to academia, thanks Carsten Wächter, Alexander Keller and Per Christensen for RT'07!
Link to paper:
Allow me to post something personal:
Today is a special day: me my wife Karin have been married for 10.000 days. :) Since our 25th anniversary was spoiled last-minute by COVID, we're celebrating this today. Love her very much, can't wait to see what the next 10k will bring!
"Ray Tracing is the future and ever will be", they said. It is a message of hope! 2022 may, in fact, be the year of Rust, Linux on the desktop, James Webb, and the defeat of Covid. Keep dreaming, keep tracing, in Rust, on Linux, vaccinated, or in 2023.
Advanced Graphics
@UUBeta
/
@UniUtrecht
starts tomorrow! In this course we cover light transport, acceleration structures (
#RTXOff
all the way!), probability theory and recent advances in filtering & sampling. This year I'm teaching with Dr. Peter Vangorp. Looking forward to it!
8192x512x8192 voxels ray traced at approx. 25fps on an i5 6500. Pure CPU renderer. Voxels are compressed to octree chunks, which are un/recompressed at runtime for editing. Voxel sprite globe has its own coordinate system.
Still working on the demo/benchmark. Now has far lower RMSE: the 8spp version is approaching the quality of what used to be 24spp. Performance also got better; fps for 10spp now equals fps for 8spp in the released demo. Will try to post an updated demo later this week.
Added an introduction to probability theory for physically based rendering to my blog:
This is part 1 of 2; part 2 will discuss the application of the theory to rendering.
Updated: bvh_article source repo, at:
Now with full OpenCL 3.0 support.
This takes you from basic CPU-side triangle intersection to real-time CPU ray tracing, and via basic GPU OpenCL first-hit to massive TLAS/BLAS. My poor UHD620. :)
Happy to announce that tomorrow will be my first day at
@TraverseBreda
! Looking forward to doing R&D with
@JasperBekkers
and friends - many of them former students. I'll be old, but wise. I hope.
New episode (number 5 already!) in the series on Real-time Voxel Ray Tracing in C++:
This time the topic is reprojection. This is a complex topic and thus a lengthy episode.
New lighthouse 2 release. Now reaches 4 paths per pixel @ 1920x1080, 30Hz on RTX2070 Max-Q. Added: asynchronous rendering for CPU-side scene updates during GPU path tracing. Next target: 5 paths per pixel. Shading taking 70+% of the frame time...
ARM NEON SIMD is gorgeous. Got the popular SSE slab test for ray/AABB intersection down to this (with the original code still there for reference). Needless to say, this is *a lot* faster.
Our
@BuasGames
year 1 students explored modern ray tracing this block: 6 weeks for the engine, 2 weeks for a game. Starting point: A basic CPU-only voxel tracer. End point: awesomeness. Posting one video per day.
Today's spotlight: 𝔼𝕣𝕚𝕜 ℂ𝕦𝕡𝕒𝕜's Water World.
Article
#8
on proper BVH construction is now online:
In this article, the BVH for animated scenes is applied to some Whitted-style ray tracing.
Full source code as usual is available on Github:
Next time: GPU ray tracing.
Lighthouse 2 was updated to CUDA 11.6 today.
Noise looks bad in one of the shots, but at 145 fps, it's actually quite acceptable. :)
LH2 is open source, modular, "Sane C++" and a great test for your
#RTX
HW.
A software rasterizer is also included.
The paper titled "Accelerating Ray Tracing using Origin Offsets" by Tim Zoet and me has been accepted for WSCG'20. Link: .
Idea is to offset ray origins to prevent traversal of the dense accstruc near surfaces, in a traversal implementation agnostic way.
TL;DR: Too hard to learn; many people stick with OpenGL. In the meantime, a colleague at my university asked if it would be safe to basically switch to path tracing altogether for year 2 courses next year, using the APIs to render 2 tris essentially...
The article series on proper BVH construction (, ...) will be extended with:
7. Consolidating: ray tracing textured and shaded meshes.
8. OpenCL: GPU ray tracing with CPU-maintained BVHs.
After that, I hope to start a new series, on proper path tracing.
Article
#2
in the series on Voxel Ray Tracing in C++ will arrive tomorrow around noon! In the meantime, the first one is available here:
Get the rendering template on Github:
I bought a thing. From Japan. Scary! Dream machine:
#MSX
Turbo R, with Z80 *and* R800 CPU. Really looking forward to giving it a good wash and doing some coding on it though. :)
Our
@BuasGames
students explored modern ray tracing this block: 6 weeks for the engine, 2 for a game. Starting point: A basic CPU-only voxel tracer. End point: awesomeness!
Final one: ℤ𝕙𝕒𝕟𝕘𝕚𝕣's Physics Pong.
New: Voxel Ray Tracing in C++ series:
Utrecht University recently moved some servers, which broke my BVH tutorial series. Everything is back! The series covers absolute basics all the way to building TLAS/BLAS data for GPU in 10 articles. There's detailed code for each article as well.
Link:
Fixed the CPU-only octree/voxelworld renderer source package link:
Pretty complete and very fast engine. Landscape is procedural and can be edited in real-time.
Article
#9
on proper BVH construction and rendering on CPU and GPU is now available:
This is mostly a GPGPU/OpenCL tutorial, applied to the BVH code of the series.
Code is as usual on Github:
In article
#10
we'll complete the port.
New on my blog: an overview page with (most of) the articles nicely organized per topic. Hopefully it's a bit easier to navigate than the main page of the blog. :)
Link:
Series:
Building a BVH
Probability Theory
Software Optimization
and: "Various".
Published a blog post on the internals of the voxel renderer, including notes on thread-safe two-level grid maintenance, false sharing and synchronizing CPU/GPU workloads with OpenCL:
Accompanying source code is now CC0 on Github:
Just got 40% boost (from ~1G to 1.42Grays/s on mobile 3070,
#RTXOff
) out of an optimization of my voxel grid traversal code, by adding a third level to the nested grid. And that's in the benchmark scene; more typical scenes should do even better. Happy.
SVGF with motion vector estimation for speculars. In progress; TAA has been disabled, recursive reflections are non-existent, object edges flicker, but still, progress. :)
We asked our first year
#thisisigad
students to write a 2D ray tracer (in 6 weeks), and a small game to demonstrate it (in 2 weeks). Amazing results. :) This is Peter Vaneveld's game.
What is the correct FOV to use in a game?
Think of your monitor as a window. Lines from your eye to the monitor (in the real world) should continue in the same direction in the virtual world.
You get this by taking the angle between the two solid lines: This is the correct FOV.
Not sure if I reinvented the wheel, but: here's a small tool that converts an .obj file to .vox at any desired res (1..255). The tool supports textured models.
@SebastianLague
has an excellent video up showing the impact of BVH (including SAH) on ray tracing performance. Good stuff.
And thanks for the references to the BVH tutorial on my blog!
Part 2 of the SIMD tutorial blog post is now available:
This one covers scalar flows, AoS versus SoA, and masking, applied to Moller-Trumbore triangle intersection.
First part is also still available of course. :)
Decided to implement a not-too-hard paper to get over my coder's block, picked "Realtime Stochastic Lightcuts" by
@DaqiLin
&
@cem_yuksel
. Turned out to be not so simple but satisfying, via agglomerative builds, cost functions, 16-byte reads in CUDA and point to aabb distances.
Some random pictures from assignment 2 ("BVH") of Advanced Graphics (Utrecht University). I didn't specifically ask for 'pretty pictures', but will do so for the final assignment. :)
Dusted off an older OpenGL project and uploaded it to github:
This is a basic multi-pass OpenGL renderer with omni-directional lights, cubemap reflections, screen space ray traced reflections and a ton of other stuff. Rebuilds in 5 seconds.
Just pushed a new version of Lighthouse 2: . This version adds filtering support (SVGF) and prepares for a proper Linux release by incorporating most of Marijn's changes (). Vid: 720p on a laptop 1060. No noise. :)
The blue noise scheme recently proposed by
@eric_heitz
has been added to the pt cores of Lighthouse 2: . Video shows 1spp quality using blue noise and the recently added Disney BRDF @ 1920x1080, 60fps without fraps.
Our
@BuasGames
year 1 students explored modern ray tracing this block: 6 weeks for the engine, 2 weeks for a game. Starting point: A basic CPU-only voxel tracer. End point: awesomeness. Posting one video per day.
Today's spotlight: 𝕃𝕖𝕠 𝕊𝕥𝕖𝕨𝕖𝕟's Eye of Sauron sim.
As paper co-chair for the High Performance Graphics conference (together with AMD's
@AaronKnoll1
) I am incredibly proud to announce that the paper line-up is now officially available on the HPG'24 website:
(1/4)
Yes, I tried to write a pretty complete and state-of-the-art overview of bounding volume hierarchy construction and traversal on CPU and GPU, including TLAS/BLAS. Only thing missing is GPU-side construction, but I am not even sure you should do that in the first place. ;)
Visited today. Looks like there is not a single question about graphics on the graphics forum:
It seems all about how to use APIs. How much of graphics programming is actual graphics programming these days?
Before the summer holiday Utrecht University students optimized my voxel engine. Behold: a SHMUP game running at up to 400fps. All world maintenance on the CPU, ray tracing on the GPU. Obviously you'll want vsync with that. ;)
A wise man (
@IngoWald
) once said that ray tracing performance is measured in millions of rays per second. These days, that is *billions* of rays: The Lighthouse 2 benchmark just peaked at 20Grays/s (shadow rays) on a 4090 card. :)
"Lumen has been a year-long project at Breda University of Applied Sciences. As team of 6 programmers, we were tasked with making a real-time path tracer on RTX 3000 hardware."
Realtime path tracing with ReSTIR and filtering by a team of students: