Global illumination pre-req visualizations


I've been working on more perquisites to getting global illumination working.  For efficiency / performance my voxel engine will only do global illumination on a per on screen voxel basis.  That being said, I needed a way to build a set of unique voxel world space coordinates (voxels are on whole number coordinates) from the gbuffer counterpart I'm calling a "vbuffer" (buffer of voxel's and respective world space coordinate).  Here are debug images showing visualizations:

Voxels color coded by world space coodinates:



First compute pass (currently done on CPU in compiled C++ code because it's easier to debug) of reduction of vbuffer screen space respective rows to unique voxel world space coordinates.  This pass can be done in parallel by rows on GPU.



Second pass reduces rows to one set of unique voxel world space coodinates.  (This image shows it as a 2D image for easier visualization.)



At the same time the second pass generates a hash table with voxel world space coordinates as keys, voxel color and respective storage space for lighting values.  To visually debug hash table, this image shows color coded voxel world space coordinates corresponding to hash table entries occupied.  (This image shows hash table as a 2D image for easier visualization.)



The vbuffer of unique voxel world coordinates will be used in global illumination passes to determine which voxels to generate global illumination light data for and then store said light data in the hash table.  The final deferred render pass will use voxel world space coordinates in gbuffer to fetch voxel color and light values from hash table and render pixels from it.

My next step in development is to implement these algorithms in compute shaders rather than being done as a proof of concept in C++.  I will implement direct sunlight light first, and then cone tracing after that.

P.S.  After more research, parallel reduction is the exactly what I will implement to get optimal performance.

Leave a comment

Log in with itch.io to leave a comment.