Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

Working on sparse volumetric light maps for WebGPU. Got generation part sorted. The resolution is adaptive, refining near geometry and skipping through most of the empty space. The video is question uses a map that's only 10MB in size, including everything. That's less the amount of GPU memory that...

18,702 Aufrufe • vor 9 Monaten •via X (Twitter)

17 Kommentare

Profilbild von Tianyu Li
Tianyu Livor 9 Monaten

you can do visualization via sdf repetition. Treat your sparse volumetric data like a TLAS.

Profilbild von Alex Goldring
Alex Goldringvor 9 Monaten

That's a pretty cool idea, thanks! I just reached for the tool available, but yeah, I was wondering how to visualize 1M+ probes eventually

Profilbild von Sam Pavlovic
Sam Pavlovicvor 9 Monaten

super cool, ought to do something like this

Profilbild von Nicolas Lopez
Nicolas Lopezvor 9 Monaten

It reminds me of the Sparse Irradiance Volunes of Assassin’s Creed Origins and later games

Profilbild von Substrata
Substratavor 9 Monaten

That's cool but I wouldn't call this a lightmap. These are light probes. Lightmaps are usually 2d maps.

Profilbild von Alex Goldring
Alex Goldringvor 9 Monaten

You're right, it's a bit of a misnomer. I'm borrowing Unreal's terminology on this calling it "light map". Typically you'd call it a "volume" instead of a map. But "volumetric lightmap" also makes sense to me. Terminology in the space of GPU techniques is all over the place

Profilbild von Stefano Scolari
Stefano Scolarivor 9 Monaten

Have you tried any method that spawns cache entries from G-buffer hits, rather than pre-populating it everywhere in space?

Profilbild von Alex Goldring
Alex Goldringvor 9 Monaten

Actually yes! Played with this idea with SHaRC, the results were okay, but you're missing a lot of the signal due to angular cutoff from occlusion. Compensating for this is the real challenge, when you move the camera - you want to keep that accumulated result, while filling in missing angular contribution. I think it can work, with octahedral probes, where you clearly discretize contribution by angle

Profilbild von 😏
😏vor 9 Monaten

it does not look sparse to me

Profilbild von Alex Goldring
Alex Goldringvor 9 Monaten

And yet it's only about 4% the size of the dense grid of the same resolution :P

Profilbild von Mr F
Mr Fvor 9 Monaten

How many texture reads and indirections do you have per pixel for one sample?

Profilbild von Alex Goldring
Alex Goldringvor 9 Monaten

No texture reads, it's all just buffer data. There's 1 buffer, a metadata header followed by a flat `array<u32>`. It's a recursive structure, so the final number of reads depends on the depth. Typically it's within 4 levels as that gets you to ~1024x1024x1024 equivalent dense grid resolution. I use the standard tricks to speed up memory access. The tree nodes are laid out in memory using a hamilton curve and probes are packed into a continuous region at the end of the buffer. There are 2 indirections: 1. Node children are referenced via pointers (index into the buffer) 2. Probes of each node are referenced via pointers I believe a technique like Unreal's where the grid is basically an inverted MIP pyramid is going to be faster in terms of access. I'm having to do software trilinear filtering, and there is the indirection you mentioned. Can't say how much of an impact this will have in the end though, as this is still WiP and I'm yet to do benchmarks

Profilbild von nickreal03
nickreal03vor 9 Monaten

@guycalledfrank I think the question was... How do you use it when rendering? Do you sample nearest or linear etc...

Profilbild von Alex Goldring
Alex Goldringvor 9 Monaten

@guycalledfrank Sure, it's linear, we want lighting to be C0 continuous at least.

Profilbild von Bert Van den Bosch
Bert Van den Boschvor 9 Monaten

How do you encode the lighting data in each probe, SH? And is there visibility information as well?

Profilbild von Alex Goldring
Alex Goldringvor 9 Monaten

second order SH, that's 9 coefficients. Only irradiance. RGBE9995 encoding, so a total of 36 bytes per probe. No visibility. Light leakage can be an issue, but likely not a huge one, as resolution increases close to geometry, so probe density is quite high. For example, a volume restricted to ~30Mb has ~720,000 probes. That's a lot of probes :)

Profilbild von Bert Van den Bosch
Bert Van den Boschvor 9 Monaten

Gotcha, IIRC nvidia did press on the importance of visibility data for better filtering and occlusion information. Guess it is all a performance to quality ratio

Ähnliche Videos

Working on Sparse Volumetric Light-maps. Thanks to CynicatPro🎃 for pointing me at Unreal's version. In a nutshell it's just another sparse voxel data structure. My implementation is, no doubt, different from Epic Games Store's own. I'm using 4x4x4 probe grid with intermediate nodes having very wide branching factor of 64 as well (4x4x4). I liked the parameters that Unreal is using, of limiting both total memory as well as the lowest level of detail, which is common in sparse grid implementations. Here's Bistro scene with just 1Mb limit. This is roughly equivalent to a 512x512 lightmap texture in 2d, except surface light maps require unique UVs and you typically get very little detail out of 512 resolution texture with a lot of light leaking. There is also no directional response. My implementation encodes second-order spherical harmonics for each probe (9 coefficients), encoding RGB channels as RGBE9995 (4 bytes). So far only worked on the structure, actual bake is yet to come. I've been eyeing sparse voxel structures for a while now, and have been studying them roughly since the GigaVoxel paper by Cyril Crassin but never really implemented anything for the GPU before. I was always the BVH-kind of guy. It's a fascinating topic. --- Stats for the scene: --- Total memory usage: 1.000 MB Node count: 609 Unique probe count: 24,025 Probe reuse: 38.36 % Unexpanded nodes: 15,714 --- Again, note that there is no GI going on here, only the structure of the probe tree and the algorithm for building it from a given scene.

Alex Goldring

11,519 Aufrufe • vor 9 Monaten