Blender Git Statistics -> Branches -> eevee-closure-lib-cleanup

"Eevee-closure-lib-cleanup" branch

Total commits : 12
Total committers : 1
First Commit : February 7, 2021
Latest Commit : February 12, 2021

Commits by Date

DateNumber of Commits
February 12, 20211
February 11, 20210
February 10, 20210
February 9, 20212
February 8, 20214
February 7, 20215


AuthorNumber of Commits
Clément Foucault12

Popular Files

FilenameTotal Edits

Latest commits Feed

February 12, 2021, 23:54 (GMT)
EEVEE: Refactor closure_lit_lib.glsl

This refactor was needed for some reasons:
- closure_lit_lib.glsl was unreadable and could not be easily extended to use new features.
- It was generating ~5K LOC for any shader. Slowing down compilation.
- Some calculations were incorrect and BSDF/Closure code had lots of workaround/hacks.

What this refactor does:
- Add some macros to define the light object loops / eval.
- Clear separation between each closures which now have separate files. Each closure implements the eval functions.
- Make principled BSDF a bit more correct in some cases (specular coloring, mix between glass and opaque).
- The BSDF term are applied outside of the eval function and on the whole lighting (was separated for lights before).
- Make light iteration last to avoid carrying more data than needed.
- Makes sure that all inputs are within correct ranges before evaluating the closures (use `safe_normalize` on normals).
- Making each BSDF isolated means that we might carry duplicated data (normals for instance) but this should be optimized by compilers.
- Makes Translucent BSDF its own closure type to avoid having to disable raytraced shadows using hacks.
- Separate transmission roughness is now working on Principled BSDF.
- Makes principled shader variations using constants. Removing a lot of duplicated code. This needed `const` keyword detection in `gpu_material_library.c`.
- SSR/SSS masking and data loading is a bit more consistent and defined outside of closure eval. The loading functions will act as accumulator if the lighting is not to be separated.
- SSR pass now do a full deferred lighting evaluation, including lights, in order to avoid interference with the closure eval code. However, it seems that the cost of having a global SSR toggle uniform is making the surface shader more expensive (which is already the case, by the way).
- Principle fully black specular tint now returns black instead of white.
- This fixed some artifact issue on my AMD computer on normal surfaces (which might have been some uninitialized variables).
- This touched the Ambient Occlusion because it needs to be evaluated for each closure. But to avoid the cost of this, we use another approach to just pass the result of the occlusion on interpolated normals and modify it using the bent normal for each Closure. This tends to reduce shadowing. I'm still looking into improving this but this is out of the scope of this patch.
- Performance might be a bit worse with this patch since it is more oriented towards code modularity. But not by a lot.

Render tests needs to be updated after this.

Differential Revision:
February 9, 2021, 01:02 (GMT)
EEVEE: Fix issue with planar SSR
February 9, 2021, 00:36 (GMT)
EEVEE: Fix most regression with ambient occlusion

Occlusion had change because of the way it was applied.
Get back to almost the same thing we had previously. The only thing
that changed is the occlusion of Normal mapped surface.

It is a bit less noticeable due to a new approximation we make.
February 8, 2021, 16:11 (GMT)
EEVEE: Cleanup: Remove use of macros for the loops
February 8, 2021, 15:45 (GMT)
EEVEE: Fix occlusion applied on SSR
February 8, 2021, 14:43 (GMT)
EEVEE: Add back support for user occlusion on eevee_specular BSDF
February 8, 2021, 00:25 (GMT)
EEVEE: Split closure_lit_lib.glsl
February 7, 2021, 19:46 (GMT)
EEVEE: Fix missing shadowing factor
February 7, 2021, 19:46 (GMT)
EEVEE: Fix lightgrid accumulation not using diffuse_accum

Also add safe normalize to interpolated normals.
February 7, 2021, 19:46 (GMT)
EEVEE: Replace constant booleans by const float

This makes principled optimization easier and less verbose. Tests shows
no differences in performance.
February 7, 2021, 19:13 (GMT)
EEVEE: Fix typo in macro leading to undefined behavior

Only the 1st closure radiance accumulator was initialized correctly.
February 7, 2021, 17:03 (GMT)
EEVEE: Rewrite closure_lit_lib to reduce complexity

This rewrite improves:
- Code clarity: Less duplicated code and removes a few hacks.
- Compile time performance: Shader code was divided by 3 in average.
I did not profile the compilation time but it is faster.
- Shading Perf: Noticed a 25% performance improvement on
the shading pass with default dielectric principled bsdf.
- Fix Principled Tint being white if color is black
- It seems to have fixed issues on some drivers giving some incorect
- Changes Principled BSDF support to be less hacky.

MiikaHweb - Blender Git Statistics v1.06
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021