Voxel GI with clipmaps

Hi there,
I’m opening a discussion here to get feedback in order to be able to complete the module before I open a pull request. This is a rebrand of the old GI module hosted here for now: armory and iron. You must checkout to “voxelgi”.

For now voxel_light compute shaders are not working, so I’m left with the decision of trying more (that I’m going to do first), or pass the lighting mechanism into the voxel’s fragment shaders.
There are a few things I can’t get, like why the image needs to be RGBA64 for voxels to hold colors, and why compute shaders don’t read / write from opacity to voxels.

I’d also like to re-implement the GPU particles mechanism ; there is the option but I don’t think this works, it will be a matter of copying the old branch’s code into this one.

We’r using clipmaps (for AO and GI) to get high scale voxelization, this means revoxelize and center voxels around camera are no longer options. Keeping the temporal filter and everything else.

DONE:
Clipmaps
Voxel irradiance (allows diffuse, specular, and refraction)

TODO:
Voxel light (lamp shadows)
Bounces
Particles (don’t know if related to voxels, will probably not do anything more that retrieving the old code).

Thanks for any feedback.

1 Like

Hi, I’m not sure whether this is still an issue or not, but to my knowledge and experience Kha’s compute shader support is quite limited especially when it comes to texture/image formats. Maybe these things are just not implemented…

1 Like

Hi, regarding your issues mentioned in https://github.com/armory3d/armory/discussions/2967: Do you have a test file for them by chance?

Update:
Done:

  • clipmap mechanism
  • conetracer
    Todo:
  • temporal reprojection

At the moment i’m waiting on the Kore’s devs to find what’s causing issue with the compute shaders, once this is set we’ll be able to do proper voxel lighting and also temporal reprojection to stabilize the grids.

Update:
DONE:

  • Conetracer
  • Voxelizer
  • Anisotropic mechanism
  • Temporal reprojection

TODO:

  • lighting + bounce

In other words, the whole procedure is setup and AO is already functional.
But with GI there still isn’t a lighting (actually shadowing) from lamps because I got an issue with the lamp’s projections, nor a secound diffuse bounce, there might be an issue with the position passed to the conetracing function, or maybe it’s an issue with the sampler.

I’ll be working on that for the end of this week.

Hello there !
I fixed the above mentioned issues, we got proper shadowing from lamps on voxels, and also material emission.

TODO:

  • Second bounce.
  • Find a way to either use the clearing mechanism each frame and / or generate the mipmaps each frame. Right now we only clear on level 0 and generate mipmaps on lod clipmap_count - 1. This creates a small lag that is not really acceptable.
  • Fix the point maps shadowmap altlas.

Hello there !
I have dealt with point one and two of the above todos,
The clipmaps are now stable and optimized due to conetracing via a compute shader (that allows for skipping fragment that have the same voxel data) and that I’m passing the clipmaps structure to the conetracer for indexing with the lod that is computed here.

TODO:

  • Implement environment light for voxels (this will allow for sky irradiance).
  • Fix shadowmap altlas for points.

Update:

  • fixed pre_clear mechanism of resolve images (no more heavy lag on startup).
  • fixed alternating mechanism (extra stable).
  • fixed voxel lighting procedure by writing only the colored shadows to an image passed to the compute shader that generates levels and anisotropic datas (we do the bounce here).

TODO:

  • fix point light atlas.
  • implement environment light.
  • write hlsl shader variants for make_voxels.py

The module is (almost) over with two bugs:

  • User has to use full screen.
  • User has to use deferred render path.

I will try to fix them in the order I mentioned them.

The last bugs are fixed, clipmaps are working as expected with several levels of details for AO and GI.
There are two last issues that I will look into, but pull requests are opened on github:

  • The voxels shadows don’t seem to work.
  • The irradiance isn’t working with forward render.

(post deleted by author)