EEVEE-Next: Sunlight Extraction #121455

Merged
Clément Foucault merged 26 commits from fclem/blender:eevee-next-sun-extraction into main 2024-05-14 16:36:24 +02:00

Sun extraction convert part of light comming from the world to a
sun light which increases the quality of the rendering. The goal
of this feature is to workaround the limitation of the storage
techniques used for environment lighting inside EEVEE.

This first implementation works by clamping the world lighting and
summing the excess lighting and (and its incomming directions) to
deduce the sun position.
All the lighting is then transfered into this light power. The sun
angle is computed based on the directionnality of the excess lighting,
the more divergent the excess lighting is, the bigger the angle.

This has a few benefits:

  • It's stable and behave well under animation. This is because we
    average a lot of data.
  • It's fast as it can be done inside the remap shader in one pass.
  • It requires only one parameter, the clamp threshold.

However, it has some issue:

  • It modifies the lighting as we change the incomming direction for
    excess lighting away from the chosen sun direction. This could be fixed
    by masking only lighting around the chosen sun direction (requires 2
    passes, slower).
  • Given that this only average the direction, it behaves poorly if there
    two opposite bright light sources (it puts the sun in the middle). This
    could be fixed by extracting more suns, but that becomes more complex
    and requires even more passes.
  • It looks bad if the summed lighting is not supposed to be a perfect
    disk in specular reflections or if the sources are too divergent as the
    disk is too big and the approximation fails short. This could be
    mitigated by adding an upper bound to the sun radius. For now we
    workaround this issue by exposing the sun angle parameter in the UI.

A more precise algorithm can be implemented in the future to avoid
having to deal with these limitations. A possibility is to use
importance sampling to randomize sun position. But that would be only
for final render.

Results


Failure case: Tow opposite light sources

This patch
Cycles
Sun extraction convert part of light comming from the world to a sun light which increases the quality of the rendering. The goal of this feature is to workaround the limitation of the storage techniques used for environment lighting inside EEVEE. This first implementation works by clamping the world lighting and summing the excess lighting and (and its incomming directions) to deduce the sun position. All the lighting is then transfered into this light power. The sun angle is computed based on the directionnality of the excess lighting, the more divergent the excess lighting is, the bigger the angle. This has a few benefits: - It's stable and behave well under animation. This is because we average a lot of data. - It's fast as it can be done inside the remap shader in one pass. - It requires only one parameter, the clamp threshold. However, it has some issue: - It modifies the lighting as we change the incomming direction for excess lighting away from the chosen sun direction. This could be fixed by masking only lighting around the chosen sun direction (requires 2 passes, slower). - Given that this only average the direction, it behaves poorly if there two opposite bright light sources (it puts the sun in the middle). This could be fixed by extracting more suns, but that becomes more complex and requires even more passes. - It looks bad if the summed lighting is not supposed to be a perfect disk in specular reflections or if the sources are too divergent as the disk is too big and the approximation fails short. This could be mitigated by adding an upper bound to the sun radius. For now we workaround this issue by exposing the sun angle parameter in the UI. A more precise algorithm can be implemented in the future to avoid having to deal with these limitations. A possibility is to use importance sampling to randomize sun position. But that would be only for final render. #### Results ![](https://projects.blender.org/attachments/8b283213-d288-4d4c-95d4-5fd8f2288102) ![](https://projects.blender.org/attachments/30939212-a9f9-4d7c-b4f3-440a974c7c10) Failure case: Tow opposite light sources | This patch | ![](https://projects.blender.org/attachments/0c7f0bcc-cc90-41d0-bbc6-61db053549f1) | | -------- | -------- | | Cycles | ![](https://projects.blender.org/attachments/08185939-1bbc-4ca7-ac04-fa1643770a57) |
Clément Foucault added this to the 4.2 LTS milestone 2024-05-06 00:17:46 +02:00
Clément Foucault added the
Interest
EEVEE
label 2024-05-06 00:17:46 +02:00
Clément Foucault added 4 commits 2024-05-06 00:17:58 +02:00
Clément Foucault added 1 commit 2024-05-07 19:09:09 +02:00
Clément Foucault added 2 commits 2024-05-07 19:24:49 +02:00
Clément Foucault added 2 commits 2024-05-07 20:37:47 +02:00
Clément Foucault added 1 commit 2024-05-07 20:38:29 +02:00
Clément Foucault added 1 commit 2024-05-09 12:50:23 +02:00
Clément Foucault changed title from EEVEE-Next: Sunlight Extraction to WIP: EEVEE-Next: Sunlight Extraction 2024-05-09 19:43:39 +02:00
Clément Foucault added 2 commits 2024-05-11 11:43:15 +02:00
Clément Foucault added 1 commit 2024-05-11 11:43:50 +02:00
Clément Foucault added 2 commits 2024-05-13 18:42:18 +02:00
Clément Foucault added 2 commits 2024-05-13 23:32:27 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
e5c573c600
Add other parameters, versionning and bypass radius estimation
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR121455) when ready.
Clément Foucault changed title from WIP: EEVEE-Next: Sunlight Extraction to EEVEE-Next: Sunlight Extraction 2024-05-13 23:51:44 +02:00
Clément Foucault added 1 commit 2024-05-14 11:37:36 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
26d4744b44
Fix compilation errors
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR121455) when ready.
Clément Foucault added 3 commits 2024-05-14 12:59:38 +02:00
Simon Thommes requested review from Simon Thommes 2024-05-14 14:09:21 +02:00
Clément Foucault added 2 commits 2024-05-14 15:32:48 +02:00
Clément Foucault added 1 commit 2024-05-14 15:40:20 +02:00
Simon Thommes approved these changes 2024-05-14 16:12:32 +02:00
Simon Thommes left a comment
Member

Adds great functionality, that is already useful in it's current implementation limited to one extracted light source.

I did some testing and the settings seem intuitive and the defaults reasonable, so to me this is good to go 👍

Adds great functionality, that is already useful in it's current implementation limited to one extracted light source. I did some testing and the settings seem intuitive and the defaults reasonable, so to me this is good to go 👍
Clément Foucault added 1 commit 2024-05-14 16:35:46 +02:00
a75fbf50f7 Merge branch 'main' into eevee-next-sun-extraction
# Conflicts:
#	source/blender/blenloader/intern/versioning_400.cc
Clément Foucault merged commit ea5e1fef2a into main 2024-05-14 16:36:24 +02:00
Clément Foucault deleted branch eevee-next-sun-extraction 2024-05-14 16:36:27 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#121455
No description provided.