Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

GPU Voxel Downsampling with Compute Shaders



For downsampling of GI voxel data, I found that a compute shader offers the best performance. The first step was to add support for compute shaders into Ultra Engine. :cool:

I've never used these before but I was able to get them working pretty quickly. I think the user API will look something like this:

//Load compute shader
auto module = LoadShaderModule("Shaders/Compute/test.comp.spv");
auto shader = CreateShader();
shader->SetModule(module, SHADER_COMPUTE);

//Create work group
int workercount = 8;
auto workgroup = CreateWorkgroup(shader, workercount, workercount, workercount);

This is not using my final formula. It's not even using bilinear sampling, it's just using a single sample from the previous mipmap. But it's basically working:


Next I will fix up the downfilter sampling and then we can start doing GI and reflections again. Basically, we are in exactly the same place we were a month ago, except now the voxelization process is instantaneous, and will work with animated models and objects in motion. Below is a shot of the results I was getting previously:


It will be very interesting to see this working with animated models. Maybe we can remake the first level of Quake 2 and compare it to the RTX version.

I'd like to thank Vilém Otte for his helpful advice with this.

  • Like 4


Recommended Comments

Lots of work to do, but reflections basically work. The difference now is the latency problems are solved.


  • Like 1
Link to comment

Do I understand that correctly? Reflected visuals are geometry that got voxelized and then polygonized back?

Link to comment
54 minutes ago, Genebris said:

Do I understand that correctly? Reflected visuals are geometry that got voxelized and then polygonized back?

The first part is correct, the geometry is rasterized / voxelized into a 3D texture. The reflection is a bunch of texture lookups into that texture.

Link to comment
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...