EEVEE-Next: Add tile deferred lighting #115820

Merged
Clément Foucault merged 14 commits from fclem/blender:eevee-next-deferred-lighting-tile into main 2023-12-07 17:05:06 +01:00

This adds a tile classification pass to the gbuffer.
This is then compact into streams of tiles for each
complexity level of lighting evaluation.

The benefit over a simpler approach of using a per
object stencil value is that we can have a per
tile granularity of the lighting complexity.

To avoid quad overshading, we use a prepass that
tags different stencil values for each complexity
level. This allows to still use a fullscreen quad
for the light evaluation pass and remove the
diagonal overshading cost.

This doesn't use compute shader at all to leverage
render pass merging and in-tile memory loads.

Using atomicOr for adding together the eClosureBits
revealed to be too slow. Using multiple non-atomic
writes to many data values is faster and not much
memory hungry.

Performance

The whole tile scheduling process takes ~70µs for
a half covered 3800x790 framebuffer and doesn't
get much more slower than this.

Using simpler lighting shader helps reduce the cost
of the lighting pass by half in most common cases.
SSS materials stay the most costly.

TODO

  • Make lighting shader variations.
  • Merge tile mask generation to the gbuffer pass and use subpass input.
  • Test Metal and remove workaround.
This adds a tile classification pass to the gbuffer. This is then compact into streams of tiles for each complexity level of lighting evaluation. The benefit over a simpler approach of using a per object stencil value is that we can have a per tile granularity of the lighting complexity. To avoid quad overshading, we use a prepass that tags different stencil values for each complexity level. This allows to still use a fullscreen quad for the light evaluation pass and remove the diagonal overshading cost. This doesn't use compute shader at all to leverage render pass merging and in-tile memory loads. Using `atomicOr` for adding together the `eClosureBits` revealed to be too slow. Using multiple non-atomic writes to many data values is faster and not much memory hungry. ### Performance The whole tile scheduling process takes ~70µs for a half covered 3800x790 framebuffer and doesn't get much more slower than this. Using simpler lighting shader helps reduce the cost of the lighting pass by half in most common cases. SSS materials stay the most costly. ### TODO - [x] Make lighting shader variations. - [x] Merge tile mask generation to the gbuffer pass and use subpass input. - [x] Test Metal and remove workaround.
Clément Foucault added this to the 4.1 milestone 2023-12-05 21:45:46 +01:00
Clément Foucault added the
Interest
EEVEE
label 2023-12-05 21:45:46 +01:00
Clément Foucault added 5 commits 2023-12-05 21:45:59 +01:00
Clément Foucault added 1 commit 2023-12-05 22:00:21 +01:00
Clément Foucault added 1 commit 2023-12-05 22:02:32 +01:00
Clément Foucault added 2 commits 2023-12-06 17:54:53 +01:00
Clément Foucault force-pushed eevee-next-deferred-lighting-tile from 20f3a24ea2 to 811354d166 2023-12-06 21:48:25 +01:00 Compare
Clément Foucault added 1 commit 2023-12-06 21:48:49 +01:00
Clément Foucault changed title from WIP: EEVEE-Next: Add tile deferred lighting to EEVEE-Next: Add tile deferred lighting 2023-12-06 21:48:59 +01:00
Author
Member

@blender-bot build

@blender-bot build
First-time contributor

"The whole tile scheduling process takes ~70µs for
a half covered 3800x790 framebuffer and doesn't
scale much more than this."

this is not realtime :(

Is there room here to fix its performance another way?

"The whole tile scheduling process takes ~70µs for a half covered 3800x790 framebuffer and doesn't scale much more than this." this is not realtime :( Is there room here to fix its performance another way?
Author
Member

"The whole tile scheduling process takes ~70µs for
a half covered 3800x790 framebuffer and doesn't
scale much more than this."

this is not realtime :(

Is there room here to fix its performance another way?

You clearly misunderstood what I wrote. I updated the PR description to avoid any misunderstanding.

~70µs is 0.4% of a 60Hz frame, and if it helps save 5% it's still a good. And that saving does scale up with resolution, whereas the preprocess doesn't cost much more.

> "The whole tile scheduling process takes ~70µs for > a half covered 3800x790 framebuffer and doesn't > scale much more than this." > > this is not realtime :( > > Is there room here to fix its performance another way? You clearly misunderstood what I wrote. I updated the PR description to avoid any misunderstanding. ~70µs is 0.4% of a 60Hz frame, and if it helps save 5% it's still a good. And that saving does scale up with resolution, whereas the preprocess doesn't cost much more.
Clément Foucault added 1 commit 2023-12-07 00:31:40 +01:00
First-time contributor

"The whole tile scheduling process takes ~70µs for
a half covered 3800x790 framebuffer and doesn't
scale much more than this."

this is not realtime :(

Is there room here to fix its performance another way?

You clearly misunderstood what I wrote. I updated the PR description to avoid any misunderstanding.

~70µs is 0.4% of a 60Hz frame, and if it helps save 5% it's still a good. And that saving does scale up with resolution, whereas the preprocess doesn't cost much more.

~70µs is 0.4% - for some reason I did a quick google says its 70 milliseconds - not .07 ms - sorry for the confusion
A microsecond != Milliseconds *

> > "The whole tile scheduling process takes ~70µs for > > a half covered 3800x790 framebuffer and doesn't > > scale much more than this." > > > > this is not realtime :( > > > > Is there room here to fix its performance another way? > > You clearly misunderstood what I wrote. I updated the PR description to avoid any misunderstanding. > > ~70µs is 0.4% of a 60Hz frame, and if it helps save 5% it's still a good. And that saving does scale up with resolution, whereas the preprocess doesn't cost much more. ~70µs is 0.4% - for some reason I did a quick google says its 70 milliseconds - not .07 ms - sorry for the confusion A microsecond != Milliseconds *
Clément Foucault merged commit 2cf64b9100 into main 2023-12-07 17:05:06 +01:00
Clément Foucault deleted branch eevee-next-deferred-lighting-tile 2023-12-07 17:05:08 +01:00
First-time contributor

how does one set the pipe to forward+ vs tiled deferred ?

how does one set the pipe to forward+ vs tiled deferred ?
Author
Member

@JacobMerrill-1 this is what the Dithered/Blended option is for.

But this isn't the place for asking this sort of thing. This is better asked on devtalk or blender.chat .

@JacobMerrill-1 this is what the Dithered/Blended option is for. But this isn't the place for asking this sort of thing. This is better asked on devtalk or blender.chat .
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
2 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#115820
No description provided.