# 3D Cascaded Voxel Cone Tracing GI - How to sample sky color?

## Recommended Posts

I've implemented a basic version of Voxel Cone Tracing that uses a single volume texture (covering a small region around the player).

But I want to have large and open environments, so I must use some cascaded (LoD'ed) variant of the algorithm.

1) How to inject sky light into the voxels and how to do it fast? (e.g. imagine a large shadowed area which is lit by the blue sky above.)

I think, after voxelizing the scene I will introduce an additional compute shader pass where, from each surface voxel, I will trace cones in the direction of the surface normal until they hit the sky (cubemap), but, I'm afraid, it would be slow with Cascaded Voxel Cone Tracing.

2) How to calculate (rough) reflections from the sky (and distant objects)?

If the scene consists of many "reflective" pixels, tracing cones through all cascades would destroy performance.

Looks like Voxel Cone Tracing is only suited for smallish indoor scenes (like Doom 3-style cramped spaces).

##### Share on other sites
2 hours ago, Anfaenger said:

How to inject sky light into the voxels

The injection of sky irradiance into the voxel irradiance could be approximated by a linear addition: L_voxel = L_voxel_local + Co_sky * V_sky * L_sky.

L_voxel_local is all the local irradiance you gathered by your Voxel Cone Tracing and other local illumination techniques.

The L_sky is the sky irradiance. You could get sky irradiance directly from the cubemap of your sky by some downsample and convolution processes, and then you could inject the sky irradiance into your voxel's irradiance later. Depends on how you stored the sky irradiance (Sphere harmonics? Sphere Gaussians? HL2?), the Co_sky - sky irradiance coefficient would variant from some simple constants to some normal-interleaved variables.

When calculating the sky irradiance, the diffuse part it's just a simple cosine-weighted convolution, for specular part you could use the "split-sum" trick which was first introduced in "Real Shading in Unreal Engine 4" by Brian Karis in SIGGRAPH 2013.

The V_sky is the "sky visibility". In order to get the "sky visibility" or "shadow mask" of each voxel, you could reuse the directional light shadow information (or any kind of voxelized shadow techniques' results if you had) from any previous pass (if you've already had some shadow passes).

2 hours ago, Anfaenger said:

how to do it fast?

The algorithm I list above won't be too expensive, it's basically just some IBL techniques running fully in real-time. If your sky irradiance didn't change in a quite rapid way, you could use some temporal techniques to reuse some previous frame's data in order to boost the performance.

2 hours ago, Anfaenger said:

How to calculate (rough) reflections from the sky

It's the diffuse part of the sky irradiance.

2 hours ago, Anfaenger said:

(and distant objects)?

It's the question about the multiple-light-bounce problem in Global Illumination already. Since you are playing with some voxel techniques, I guess it's won't be soo difficult for you to figure out how to simulate the light propagation among different voxels. The real problem may be how to effectively calculate the distant voxel's irradiance and integrate them to the nearby voxels. I'd choose cascaded + temporal solutions maybe, but again there won't be a silver bullet, personally speaking I would recommend you to take a look at Scalable Real-Time Global Illumination for Large Scenes in GDC 2019, they implemented some amazing voxelization GI solutions in real-time, and maybe they could answer your question better than me😅.

##### Share on other sites

I found another nice presentation from SIGGRAPH 2019:

## Create an account

Register a new account

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 16
• 11
• 23
• 42
• 75