DEVLOG JULY 2024
Hello folks!
It’s been a while since the last update, and I’m excited to share some significant progress on the shaders. Further below, I went into more detail on some of the topics. There’s a lot to cover in this devlog for July 2024, so let’s dive in!
RTGI (Ray-Traced Global Illumination)
- Specular Lighting Upgrade: More accurate and plausible ray intersections with a new ray generator.
- PBR Material Model: Uses GGX with a novel VNDF sampler for better efficiency and numerical stability.
- Detail Restoration: Specular GI using BRDF demodulation for better denoising, especially for bumpy surfaces and matte reflections.
- Temporal Reprojection: Improved reliability and sharpness, preserving micro-details during camera movement.
- Diffuse Lighting Bug Fix: Resolved an issue that caused loss of contact details.
ReLight
- Complete Overhaul: Switched to correctly handled spherical light sources using Projective Spherical Caps for optimal efficiency.
- Subsurface Scattering: Now using a spectral MIS path tracer with up to 128 light bounces for 100% physically correct images.
- Temporal Reprojection: Same improvements as RTGI.
- Random Number Generator: Optimized for perceptual noise reduction.
I’ve also made updates to other shaders, but these are the highlights. I’ve gone into more detail on some of the highlights below. Plus, there’s a new shader in the works—stay tuned for more updates!
Thank you for your continued support!
Release Highlights: RTGI
Infinite Radius for diffuse GI
I’ve decided to do away with the world-space radius modifier. We’re dealing with screen data anyway, might as well use the entire range. What does this mean: the “Ray Length” control is gone and RTGI performs optimal sample placement on its own. This makes the GI more predictable and easier to configure.
Improved tracing precision
Both diffuse and specular GI sample more accurately now and can deal with small occluders better.
New VNDF Sampler for specular GI
This is something I’m rather proud of. For a detailed explanation, scroll down to the end. The basic gist of it: there are several state-of-the-art functions to sample the material model RTGI uses. Each one of these has their own advantages and drawbacks, and I managed to combine them all into one ultimate solution. This is significant enough that I might write a paper about it.
For you, this means less noise in specular GI for the same amount of performance. Here’s a comparison in a toy scene with the same amount of rays on both sides:
Better temporal reprojection
I’ve done lots of work on the temporal accumulation part. Much less ghosting, sharper in motion and just plain awesome. This also partially comes from Launchpad, as I’ve much improved the optical flow.
In this video I’m toggling between the old and the new optical flow. You can easily see in the magnified part that it becomes much less blurry in motion.
Release Highlights: ReLight
Correct spherical lights
ReLight uses correctly handled spherical lights now. This means correct diffuse shadow handling and a physically accurate light falloff formula. The biggest improvement is probably my implementation of Sampling Projected Spherical Caps in Real Time. Stealing some image from the paper shows its benefits:
I had quite some trouble with it as the provided code refuses to compile on DirectX 9 because it uses so many registers and the formulas from the paper apparently have some bugs in them. So I ended up having to reimplement it all on my own again.
Path Traced Subsurface-Scattering
I greatly disliked the behavior of the existing implementation, but it was already pretty much state-of-the-art Burley Normalized Diffusion… so what is left to improve? Well, fully path trace it. And so I did. A complete path tracer with up to 128 bounces, full spectral MIS and all the bells and whistles you’d expect in an offline renderer.
For illustration purposes, meat pillars:
Addendum: RTGI VNDF Sampler
Specular GI uses a physically based microfacet model called GGX, or Trowbridge-Reitz. Microfacet models describe the way light interacts with the surface as a distribution of virtual, very small reliefs in the surface – microfacets. Smooth surface = even microfacets, rough surface = jaggy microfacets. The state-of-the-art method to raytrace GGX is so-called VNDF sampling.
The state of the art method to sample GGX is using the distribution of visible normals, or VNDF. This is a function that generates rays more densely where the GGX function is high – otherwise we would just send rays into the geometry or trace directions with a very low weight associated to them. There are 3 VNDF samplers:
- Sampling the GGX Distribution of Visible Normals (Heitz et al.)
- Sampling Visible GGX Normals with Spherical Caps (Dupuy 2023)
- Bounded VNDF Sampling for the Smith-GGX BRDF (Tokuyoshi & Eto 2024)
There are a few qualities to these samplers, let’s look at them in detail:
- Simplified GGX term: Heitz’ VNDF sampler has the neat property that using it, almost all the GGX terms cancel out and you end up with a very simple formula for weighting each ray. Since Dupuy’s VNDF sampler is a simplified variant of Heitz’ sampler, this applies to the second sampler too.
- More efficient sampling: The newest VNDF sampler improves upon the others by culling many impossible ray directions, making it more efficient. Its biggest caveat is that its different distribution means you cannot use it with the simplified GGX functions from Heitz/Dupuy’s samplers.
- Formula for isotropic GGX: GGX allows for anisotropic surface roughness. Materials like brushed metal are smooth in one direction but rough in the other. If you don’t need that, Dupuy figured out a way to restructure the math terms such that you don’t need to transform all the involved vectors into a local coordinate space. This again reduces the amount of calculations required.
Enter me. Read the new paper, implemented it straight away and… wait its brightness doesn’t match. WTF? After some digging, some more scribbling and even more cursing I figured out what the problem was – I had to ditch the simple GGX functions and go for the full model. Fuck. I was boneheaded enough to attempt to combine all the advantages of the above samplers, and after some more digging, scribbling and cursing I pulled it off.
Heitz VNDF | Dupuy VNDF | Tokuyoshi/Eto VNDF | Pascal Gilcher VNDF | |
---|---|---|---|---|
Simplified GGX terms | ✓ | ✓ | ✓ | |
More efficient sampling | ✓ | ✓ | ||
Formula for isotropic GGX | ✓ | ✓ |
So here it is, the holy grail of VNDF sampling. As efficient as Tokuyoshi and Eto’s sampler, can use the simplified GGX terms from Heitz/Dupuy and the cherry on top, can use the simplified isotropic formulation. Only sad part is that there’s like 1000 people on earth who would appreciate what I did but alas. In the next life I’ll become a football star.