Closed e2002e closed 6 months ago
This produces correct renders, sampling is consistent and seams are not abrupt, in the worst case the blending handles the transition. BUGS:
Here the voxel resolution is set to lowest, with 5 clipmaps, and a voxel size of 0.25.
Hi @luboslenco, this is finished ! I spent the week testing it and there aren't any other bugs than those listed. It's actually seamless now. I'll still be trying to get voxels shadows to work. But I think you can merge.
@luboslenco don't forget to ship the updated Krom with this. It needs the commits you merged a few months ago (rgba8 3d images and compute shaders support). I'll be looking for a way to implement transparent shadows now.
Hello ! This pull request implements voxels global illumination with clipmaps (level of details). The AO module also benefits from the clipmaps. Forum's thread: https://forums.armory3d.org/t/voxel-gi-with-clipmaps/5242
The voxelizer is pretty much the same thing appart that it writes to an image that is 6 times bigger on the x axis to store anisotropy (data modified by normal weight), and 9 times bigger on the z axis to store the different channels (4 for rgba, 3 for emission rgb, and 2 for normals).
A ping-ponging mechanism is used for stability between a shader computing the offset from the previous frame and the temporal shader that will do some extra boundary checks and radiance modification, using data from a simple lighting shader, the environment light, and a second diffuse bounce.
This temporal compute shader is also responsible for generating the different levels of details stored on the images y axis and the precomputed datas (on x axis).
The conetracer has been replaced and doesn't compute cone direction from the normal, instead it has a list of 16 precomputed directions.
The conetracing functions are called inside of compute shaders to avoid unecessary work and the final result from the voxelization is writen on 2D images here before being sampled in deferred_light. This procedure is not possible in forward render and we trace the cones directly in the object's shader.
The extents option has been removed and a new "clipmap count" and "size" option were added. The total extents is now (resolution * voxelSize) ^ clipmap_count. The offset option was also removed.
The voxels refraction is not (re)implemented. Let me know if this should be a TODO.
NOTE: All compute shaders (excepted voxels_light) come from WickedEngine, the licence is included on top of these files, even though they are converted from hlsl to glsl, and use armory's functions. I have worked a long time with legacy conetracer before implementing WickedEngine's. From here, to have everything work together, it was better to implement (let's not say copy) the whole procedure.