Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gi clipmaps #3012

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Gi clipmaps #3012

wants to merge 2 commits into from

Conversation

e2002e
Copy link
Contributor

@e2002e e2002e commented Apr 11, 2024

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.

@e2002e e2002e closed this Apr 12, 2024
@e2002e e2002e reopened this Apr 14, 2024
@e2002e e2002e closed this Apr 15, 2024
@e2002e e2002e reopened this Apr 16, 2024
@e2002e e2002e force-pushed the gi_clipmaps branch 7 times, most recently from 2ad4137 to 9d6acc7 Compare April 22, 2024 07:12
@e2002e e2002e closed this Apr 23, 2024
@e2002e e2002e reopened this Apr 25, 2024
@e2002e e2002e closed this Apr 25, 2024
@e2002e e2002e reopened this Apr 25, 2024
@e2002e e2002e force-pushed the gi_clipmaps branch 2 times, most recently from 551170e to 5e9f4a9 Compare April 25, 2024 13:01
@e2002e
Copy link
Contributor Author

e2002e commented Apr 25, 2024

This produces correct renders, sampling is consistent and seams are not abrupt, in the worst case the blending handles the transition.
Capture du 2024-04-25 16-42-34
BUGS:

  • GI and physical environment light doesn't work with forward renderer, so it's simply adding envl to indirect, loosing the effect we get by conetracing environment light.
  • Voxels shadows don't work for some reasons.
  • Hosek / Wilkie and GI don't work in every situations. The environment light must be set to an abnormaly high value to show and produces red light under certain angles.

Here the voxel resolution is set to lowest, with 5 clipmaps, and a voxel size of 0.25.
Capture du 2024-04-27 11-28-40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant