EEVEE-Next: Irradiance Cache: Initial Implementation #108639

Merged
Clément Foucault merged 86 commits from fclem/blender:eevee-next-irradiance-cache into main 2023-06-23 08:39:52 +02:00

86 Commits

Author SHA1 Message Date
Clément Foucault d370e3ef4b Merge branch 'main' into eevee-next-irradiance-cache 2023-06-23 08:31:00 +02:00
Clément Foucault e612b16a4f Fix cast style 2023-06-23 00:01:06 +02:00
Clément Foucault cdcd3b4b60 Address review 2023-06-22 23:14:23 +02:00
Clément Foucault 87bd956ea1 Merge branch 'main' into eevee-next-irradiance-cache
buildbot/vexp-code-patch-coordinator Build done. Details
2023-06-22 22:51:35 +02:00
Clément Foucault 01e3b3c84a Fix NaN in the Spherical Harmonic evaluation 2023-06-22 22:49:16 +02:00
Clément Foucault 8924f86930 Attempt to fix linking issue on linux 2023-06-22 20:43:18 +02:00
Clément Foucault d0a456db2d Address Review
buildbot/vexp-code-patch-coordinator Build done. Details
2023-06-22 18:38:24 +02:00
Clément Foucault 7ac93775b0 Add eevee_lightcache.hh to CMakeLists.txt 2023-06-22 18:22:54 +02:00
Clément Foucault becf326283 Fix naming convention
buildbot/vexp-code-patch-coordinator Build done. Details
2023-06-22 12:02:42 +02:00
Clément Foucault e8943b3831 Fix clang-format issues 2023-06-22 11:59:09 +02:00
Clément Foucault 08df95c35c Merge branch 'main' into eevee-next-irradiance-cache 2023-06-22 11:55:44 +02:00
Clément Foucault 4c294146bc Merge branch 'main' into eevee-next-irradiance-cache
# Conflicts:
#	source/blender/blenloader/intern/versioning_400.cc
#	source/blender/draw/CMakeLists.txt
#	source/blender/draw/engines/eevee_next/eevee_defines.hh
#	source/blender/draw/engines/eevee_next/eevee_shader.cc
#	source/blender/draw/engines/eevee_next/eevee_shader.hh
#	source/blender/draw/engines/eevee_next/eevee_shader_shared.hh
#	source/blender/draw/engines/eevee_next/shaders/infos/eevee_hiz_info.hh
2023-06-21 13:35:08 +02:00
Clément Foucault 29a9e55cf8 EEVEE-Next: Fix wrong image format 2023-06-21 12:48:23 +02:00
Clement 572141423e EEVEE-Next: Fix shader compilation on Nvidia 2023-06-09 20:40:45 +02:00
Clement c08c3a9a77 Merge branch 'main' into eevee-next-irradiance-cache
# Conflicts:
#	source/blender/blenloader/intern/versioning_400.cc
2023-06-09 20:40:11 +02:00
Clément Foucault ed211704aa Merge branch 'main' into eevee-next-irradiance-cache 2023-06-06 23:54:28 +02:00
Clément Foucault ec45c23ce0 EEVEE-Next: Irradiance Bake: Attempt to fix compilation on NVidia GPU 2023-06-06 23:53:59 +02:00
Clément Foucault 2b53b64506 EEVEE-Next: Irradiance Bake: Change display size UI range 2023-06-06 23:53:17 +02:00
Clément Foucault 6627263d40 EEVEE-Next: Irradiance Bake: Move baking props to irradiance volumes
buildbot/vexp-code-patch-coordinator Build done. Details
2023-06-05 23:26:00 +02:00
Clément Foucault 599e3d073b EEVEE-Next: Fix irradiance display size range
This is needed now that more denser irradiance volumes
are possible
2023-06-05 20:16:45 +02:00
Clément Foucault 0c156e4bbb EEVEE-Next: Fix issues with irradiance volume ordering
The reordering was making the grid upload broken
2023-06-05 20:15:56 +02:00
Clément Foucault 1d4df1bfef Merge branch 'main' into eevee-next-irradiance-cache 2023-06-05 15:46:00 +02:00
Clément Foucault 08a188d7b9 Fix shader compilation 2023-06-05 15:40:38 +02:00
Clément Foucault f11a873162 EEVEE-Next: Irradiance Bake: Improve cache deletion operator...
... to work with selection and all objects.
2023-06-05 15:40:15 +02:00
Clément Foucault 573f698b2c Merge branch 'main' into eevee-next-irradiance-cache
# Conflicts:
#	source/blender/draw/engines/eevee_next/eevee_defines.hh
#	source/blender/draw/engines/eevee_next/shaders/eevee_deferred_light_frag.glsl
#	source/blender/draw/intern/draw_manager.c
2023-06-05 11:23:48 +02:00
Clément Foucault 0577413506 EEVEE: Irradiance Bake: Improve UI
- Cleanup unused options
- Add global surfel density option
- Increase default samples
2023-06-05 11:18:34 +02:00
Clément Foucault 0dcfdda6c2 EEVEE: Irradiance Bake: Add infinite light bounce evaluation
This mode allows much faster convergence.
Also fixes a lot of small issues with surfel list projections
such as aliasing producing banding in SH volumes.
2023-06-05 01:37:55 +02:00
Clément Foucault d3cac7d602 EEVEE-Next: Add non-negative spherical harmonic evaluation 2023-05-31 20:28:00 +02:00
Clément Foucault 8021e0ba76 Merge branch 'main' into eevee-next-irradiance-cache
# Conflicts:
#	source/blender/blenloader/intern/versioning_400.cc
2023-05-26 15:38:06 +02:00
Clément Foucault befd3465d6 EEVEE-Next: Add spherical harmonic de-ringing 2023-05-26 00:43:09 +02:00
Clément Foucault 9ef8e9ac6b EEVEE-Next: Fix surfel creation view 2023-05-25 18:12:25 +02:00
Clément Foucault 36a6a02050 EEVEE-Next: Make irradiance grid composition stable 2023-05-25 18:11:56 +02:00
Clément Foucault 1be9514e8b EEVEE-Next: Make progressive accumulation normalized 2023-05-25 01:26:51 +02:00
Clément Foucault 4ad77fcc74 EEVEE-Next: Add progress to irradiance bake 2023-05-24 22:51:44 +02:00
Clément Foucault fc91ed10a9 Merge branch 'main' into eevee-next-irradiance-cache
# Conflicts:
#	source/blender/blenloader/intern/versioning_400.cc
2023-05-23 12:35:40 +02:00
Clément Foucault 487ab2073b EEVEE-Next: Irradiance Bake: Avoid asserts on Metal
This avoid triggering the asserts in place in the Metal
backend. However it does not work yet.
2023-05-07 16:06:04 +02:00
Clément Foucault 63a2736e5e Merge branch 'main' into eevee-next-irradiance-cache 2023-05-05 16:18:36 +02:00
Clément Foucault 12fc600d7f EEVEE-Next: Fix compilation error with Metal 2023-05-05 16:14:11 +02:00
Clément Foucault 76777bb874 Merge branch 'main' into eevee-next-irradiance-cache 2023-05-05 14:54:31 +02:00
Clément Foucault dcf3392cec Merge branch 'main' into eevee-next-irradiance-cache 2023-04-30 22:14:57 +02:00
Clément Foucault e6d1a42d12 EEVEE-Next: Irradiance Cache: Add version control for new parameter 2023-04-30 22:08:45 +02:00
Clément Foucault 502d9db82c EEVEE-Next: Irradiance Cache: Add support for cancelling operator 2023-04-30 22:02:56 +02:00
Clément Foucault 95b8b71908 EEVEE-Next: Irradiance Cache: Reserve slot for world irradiance
This doesn't implement the world irradiance extraction process,
but only reserve the storage for it.
2023-04-30 21:35:42 +02:00
Clément Foucault 12095b8e16 EEVEE-Next: Irradiance Cache: Use scene bounds for surfel cache
This remove the per irradiance grid approach. The idea is to do the light
transport only once for each visibility collection and store the
irradiance for all irradiance grid using this visibility mask.

This removes the need for the lightprobe near/far clip parameters.
2023-04-30 21:19:08 +02:00
Clément Foucault 0388f93e79 EEVEE-Next: Irradiance Cache: Store final format 2023-04-27 19:59:11 +02:00
Clément Foucault f14c7e804c EEVEE-Next: Irradiance Cache: Load irradiance in atlas
This approach allow streaming of visible grids and
has a controlled memory budget.
2023-04-27 19:26:36 +02:00
Clément Foucault 3452d3998c Merge branch 'main' into eevee-next-irradiance-cache
# Conflicts:
#	source/blender/blenkernel/intern/lightprobe.cc
#	source/blender/draw/engines/eevee_next/shaders/eevee_debug_surfels_frag.glsl
#	source/blender/editors/render/render_shading.cc
#	source/blender/makesdna/DNA_lightprobe_types.h
2023-04-22 17:37:49 +02:00
Clément Foucault d3e761cda3 EEVEE-Next: Make Spherical harmonic follow object transform
This make the baking step output local space spherical harmonics which
need to be rotated back to world before being evaluated.
In practice we rotate the evaluated direction.
2023-04-16 22:00:56 +02:00
Clément Foucault a5310b7720 EEVEE-Next: Adapt code to new irradiance cache 2023-04-15 21:29:53 +02:00
Clément Foucault b1af33d52a Merge branch 'main' into eevee-next-irradiance-cache 2023-04-13 14:12:40 +02:00
Clément Foucault 892f7077bc Add new lightprobe cache
Waiting for the commit to be in master.
2023-04-13 11:51:59 +02:00
Clément Foucault 2018d6c8c1 Merge branch 'main' into eevee-next-irradiance-cache 2023-04-13 11:40:30 +02:00
Clément Foucault d30ad0e381 Cleanup: EEVEE-Next: Avoid implicit type cast 2023-04-05 12:47:24 +02:00
Clément Foucault a0610ef654 EEVEE-Next: IrradianceBake: Fix shadow tagging & rendering 2023-04-05 12:46:58 +02:00
Clément Foucault ff5db3a72e Merge branch 'eevee-next-irradiance-cache' of projects.blender.org:pragma37/blender into eevee-next-irradiance-cache 2023-04-02 16:23:52 +02:00
Clément Foucault 74d89d0b24 Merge branch 'main' into eevee-next-irradiance-cache 2023-04-01 17:17:19 +02:00
Clément Foucault 9461d7fc9a EEVEE-Next: IrradianceBake: Add spherical harmonic encoding
This adds a separate pass to project the neighbor surfels to the final
irradiance sample points.
2023-04-01 17:10:23 +02:00
Clément Foucault 6a6ff3310a Merge branch 'main' into eevee-next-irradiance-cache 2023-04-01 13:31:18 +02:00
Clément Foucault 85bbf53f84 EEVEE-Next: Fix wrong irradiance surfel spawning area 2023-04-01 12:02:46 +02:00
Clément Foucault 14973fabe6 BLI: Rotation: Add CartesianBasis `transform_point` and `invert` 2023-04-01 12:00:33 +02:00
Clément Foucault 34adebcf43 GPU: FrameBuffer: Fix empty framebuffer update
The framebuffer default size was only set during the first bind. This
is because the `dirty_attachments_ tag` wasn't set and thus the
framebuffer size was never passed down to the GL.

Split to `default_size_set()` to not affect other code paths that use
`size_set()`.
2023-04-01 11:54:02 +02:00
Miguel Pozo 70970299ef Shadow tag usage for surfels 2023-03-30 19:54:58 +02:00
Clément Foucault bfeb1a1a8d EEVEE-Next: IrradianceBake: Fix light bounce
Light bouncing needs a feedback mechanism. We cannot reuse the same
radiance for scattering light and accumulating it.

This splits the final accumulation to `radiance` and bouncing light into
`incomming_light` and `outgoing_light`.
2023-03-29 21:01:09 +02:00
Clément Foucault 5dc6535591 EEVEE-Next: IrradianceBake: Fix integration power and inconsistencies
Now it follows proper conventional notation.

# Conflicts:
#	source/blender/draw/engines/eevee_next/shaders/eevee_surfel_ray_comp.glsl
2023-03-29 14:52:44 +02:00
Miguel Pozo a484f43a17 Irradiance Cache: Display Grid 2023-03-28 20:06:19 +02:00
Miguel Pozo 114713c354 Workaround compilation error on Win Nvidia drivers 2023-03-28 20:06:19 +02:00
Miguel Pozo a4c571dc8e Fix irradiance_grid.world_to_grid 2023-03-28 20:06:19 +02:00
Miguel Pozo 22ccf83700 Cleanup: Fix typo 2023-03-28 20:06:18 +02:00
Clément Foucault 73f96fe216 EEVEE-Next: IrradianceBake: Implement multi bounce support
This is still broken as the light seems to never converge.
2023-03-28 18:12:28 +02:00
Clément Foucault db3028a624 EEVEE-Next: IrradianceBake: Implement light propagation 2023-03-28 13:43:26 +02:00
Clément Foucault 4e3eb2f7a5 EEVEE-Next: IrradianceBake: Fix crash caused by motion blur 2023-03-28 13:18:22 +02:00
Clément Foucault 5de76bbbff EEVEE-Next: IrradianceBake: Fix light-leak
This fixes the light leaking issue caused by the surfel lists.
The fix consists in clumping more surfel together when creating the lists
then rewire the coplanar surfels to more valid surfels up and down the
same list.
2023-03-28 13:17:25 +02:00
Clément Foucault da91a2ccb0 EEVEE-Next: IrradianceBake: Fix memleak 2023-03-26 15:39:17 +02:00
Clément Foucault 75b62a9cfb EEVEE-Next: IrradianceBake: Add surfel list & sorting 2023-03-25 22:00:49 +01:00
Clément Foucault 6f6c3afe91 Merge branch 'main' into eevee-next-irradiance-cache 2023-03-24 17:45:20 +01:00
Clément Foucault 0297bde629 EEVEE-Next: Debug: Fix surfel debugging showing background 2023-03-24 17:34:39 +01:00
Clément Foucault caa0e7edcf EEVEE-Next: IrradianceBake: Correct surfel placement from grid objects 2023-03-24 17:34:20 +01:00
Clément Foucault 6669771215 EEVEE-Next: LightBake: Fix few mistakes preventing correct baking & debug
Was missing manager sync, a buffer read and copy-on-write tagging.
2023-03-23 18:16:22 +01:00
Clément Foucault e696507aa5 Merge branch 'main' into eevee-next-irradiance-cache 2023-03-23 16:44:05 +01:00
Clément Foucault 38f6de30cf EEVEE-Next: LightCache: Solidify the baking pipeline 2023-03-23 16:41:48 +01:00
Clément Foucault e6de2fc4f7 EEVEE-Next: GI: Add irradiance sample count option 2023-03-23 16:39:02 +01:00
Clément Foucault 7b3d4c9e49 EEVEE-Next: LightCache: Add basis of new lightcache version
This should allow to keep both version working during the period where
both eevee versions are available.
2023-03-21 20:15:59 +01:00
Clément Foucault 795bc96cfe EEVEE-Next: LightCache: Add GL & GPU context functions 2023-03-21 12:25:17 +01:00
Clément Foucault dddfcd6f7a EEVEE-Next: LightProbe: Add auto update detection
This allow probe update and deletion to trigger an auto bake.
2023-03-20 22:07:21 +01:00
Clément Foucault 52a7125ce3 EEVEE-Next: LightCache: Port basic lightcache structure to C++
This removes the complexity of resource sharing as it isn't even leveraged
yet. So keep the code as simple as possible for now.
2023-03-20 19:45:25 +01:00
Clément Foucault 408c5d7281 EEVEE-Next: Irradiance-Cache: Add surfel placement
Spawning surfels uses a new shader pipeline (called `capture`) to avoid
the complexity of modifying the deferred or forward pipeline.
The shaders are light to compile and should only be compiled on bake.

This is very WIP: the surfel projection box is hardcoded and the 3
projections are done every frame. The surfels are placed in a regular
grid because of the raster pipeline used to spawn them.

Note: While this is really fast, I am not sure this will scale well for
highly detailed lighting conditions. In the case where the surfel density
is too low, the aliasing might create really poor result.
2023-03-19 21:33:55 +01:00