正在加载视频...

视频加载失败

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 次观看 • 9 个月前 •via X (Twitter)

17 条评论

Tianyu Li 的头像
Tianyu Li9 个月前

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

Alex Goldring 的头像
Alex Goldring9 个月前

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

Sam Pavlovic 的头像
Sam Pavlovic9 个月前

super cool, ought to do something like this

Nicolas Lopez 的头像
Nicolas Lopez9 个月前

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

Substrata 的头像
Substrata9 个月前

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

Alex Goldring 的头像
Alex Goldring9 个月前

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

Stefano Scolari 的头像
Stefano Scolari9 个月前

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

Alex Goldring 的头像
Alex Goldring9 个月前

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

😏 的头像
😏9 个月前

it does not look sparse to me

Alex Goldring 的头像
Alex Goldring9 个月前

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

Mr F 的头像
Mr F9 个月前

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

Alex Goldring 的头像
Alex Goldring9 个月前

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

nickreal03 的头像
nickreal039 个月前

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

Alex Goldring 的头像
Alex Goldring9 个月前

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

Bert Van den Bosch 的头像
Bert Van den Bosch9 个月前

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

Alex Goldring 的头像
Alex Goldring9 个月前

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 :)

Bert Van den Bosch 的头像
Bert Van den Bosch9 个月前

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

相关视频

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 次观看 • 9 个月前