Closed ddutchie closed 6 years ago
To get the voxel grid to follow the camera, what you could possibly do is use the distance and direction the camera moved in last frame and run a compute shader for every voxel in the grid, traverse in the opposite direction the camera moved by the same distance, convert that position from world space to voxel space and store that value into the current voxel. Will probably need 2 sets of voxel grids for double buffering but there are some other implementations which do this already. VXGI is one of them if i remember correctly so I'd recommend reading up on other ways as well.
Also btw, this project in Unity was just meant to be a prototype for the algorithm. The actual upto date implementation is in my DX12 engine. This one is not energy conserving, doesn't have specular GI in it and performs cone tracing per pixel. I'm using a spherical harmonics grid in the new implementation and cone tracing for every cell which is way more faster and you can scale the grid based on how local you want the reflections to be and the performance you're aiming for. I'm still doing specular cone tracing per-pixel though since I need roughness information but overall GI is taking < 1 ms. You should be able to get this working with Forward rendering using Depth + DepthNormals textures in Unity.
As of now, I have no intentions of working on this Unity project further since it was meant only to be a prototype of the algorithm but I'm constantly updating my PVGIEngine repository and all the shaders will still be applicable to Unity as well. So, I would suggest you to look up my code there and get it working.
Hello Parikshit
I am trying to get this to work using Forward Rendering. I am able to get some results, but obviously do not have access GBuffers etc.
I am also trying to have the voxel grid follow the camera after a certain distance. Any ideas/pointers?
Regards