EEVEE-Next Planar Capture #112966

Closed
opened 2023-09-27 18:43:55 +02:00 by Clément Foucault · 0 comments

Motivations

For feature parity reason, we need to implement back support for planar capture objects.
The main use of them is to fix screen space tracing artifacts on highly reflective planar surfaces.

Clipping plane

In order to not reflect object above the planar lightprobe, surfaces above the capture plane need to be clipped.

The previous implementation created a non-negligeable overhead for the vertex shader and was slowing down the whole scene rendering even when planar capture lightprobes are not used.

Creating a new shader variation will considerably increase the shader compilation time of materials.
A better solution would be to use an oblique projection matrix that clip the geometry using the near plane.

References for constructing the oblique projection:

While this construction looks good, we do need assess if the depth distribution is still good for screen tracing. Otherwise, we should revert to construct the matrix from scratch.

EDIT: Experiment showed that the resulting frustum is really not ideal. Maybe I did it wrong, but this is the result I got.
image

Instead of using oblique frustum, we can use software clip-plane using discard in the prepass fragment shader. Contrary to the hardware clip distance, this won't have any discrepancy with the shading pass which can stay untouched. Also, since most materials have the same opaque prepass shader, so the compilation time for another prepass variation is not that much.

Capture Pipeline

We want to have different visibility pool for cubemap lightprobes and planar lightprobes. So there need to be another DeferredProbePipeline inside PipelineModule which is dedicated to this type of capture. To avoid the CPU overhead of having to always populate it, it should only be populated when there is a visible planar capture. This can only be done with a one frame delay in the viewport like for the cubemap lightprobes. Render mode might want to always populate it for now.

Note that for now, we should only capture opaque deferred with diffuse lighting only. This is to limit the complexity of this feature and the performance impact. This can be revisited later.

Integration with tracing pipeline

The tracing shader need to be specialized to trace these. We actually do not want to recreate a HiZ for each of these so we have to trace the depth buffers directly. We can leverage the tiled tracing to have an indirect dispatch to trace only where there is pixels that use the planar lightprobe. One indirect dispatch per lightprobe should allow for spliting resources access between dispatches. This will make different resolution per planar capture possible.

Tasks

  • 1b1b1a19bf Add support for software clip plane.
  • #113203 Create draw::View from planar lightprobe and render draw::View.
  • #113203 Add a dedicated pipeline and add drawcalls to it.
  • #113203 Add a PlanarProbeView
  • #113203 Add an object visibility option.
  • #113453 Integration to tracing pipeline
  • Port viewport display

Extended targets

  • Capture resolution scaling
## Motivations For feature parity reason, we need to implement back support for planar capture objects. The main use of them is to fix screen space tracing artifacts on highly reflective planar surfaces. ## Clipping plane In order to not reflect object above the planar lightprobe, surfaces above the capture plane need to be clipped. The previous implementation created a non-negligeable overhead for the vertex shader and was slowing down the whole scene rendering even when planar capture lightprobes are not used. Creating a new shader variation will considerably increase the shader compilation time of materials. A better solution would be to use an oblique projection matrix that clip the geometry using the near plane. References for constructing the oblique projection: - https://forum.gamemaker.io/index.php?threads/projection-matrix-with-oblique-near-clip-plane.60537/ - http://www.terathon.com/code/oblique.html - https://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=255FB6BD9252A50A1A7166319C8A5CE0?doi=10.1.1.367.1894&rep=rep1&type=pdf While this construction looks good, we do need assess if the depth distribution is still good for screen tracing. Otherwise, we should revert to construct the matrix from scratch. EDIT: Experiment showed that the resulting frustum is really not ideal. Maybe I did it wrong, but this is the result I got. ![image](/attachments/83626567-0716-4220-a744-c3faeb74ed51) Instead of using oblique frustum, we can use software clip-plane using discard in the prepass fragment shader. Contrary to the hardware clip distance, this won't have any discrepancy with the shading pass which can stay untouched. Also, since most materials have the same opaque prepass shader, so the compilation time for another prepass variation is not that much. ## Capture Pipeline We want to have different visibility pool for cubemap lightprobes and planar lightprobes. So there need to be another `DeferredProbePipeline` inside `PipelineModule` which is dedicated to this type of capture. To avoid the CPU overhead of having to always populate it, it should only be populated when there is a visible planar capture. This can only be done with a one frame delay in the viewport like for the cubemap lightprobes. Render mode might want to always populate it for now. Note that for now, we should only capture opaque deferred with diffuse lighting only. This is to limit the complexity of this feature and the performance impact. This can be revisited later. ## Integration with tracing pipeline The tracing shader need to be specialized to trace these. We actually do not want to recreate a HiZ for each of these so we have to trace the depth buffers directly. We can leverage the tiled tracing to have an indirect dispatch to trace only where there is pixels that use the planar lightprobe. One indirect dispatch per lightprobe should allow for spliting resources access between dispatches. This will make different resolution per planar capture possible. ## Tasks - [x] 1b1b1a19bffcade8cd367bac8a3b242dee2bc3d6 Add support for software clip plane. - [x] #113203 Create `draw::View` from planar lightprobe and render `draw::View`. - [x] #113203 Add a dedicated pipeline and add drawcalls to it. - [x] #113203 Add a `PlanarProbeView` - [x] #113203 Add an object visibility option. - [x] #113453 Integration to tracing pipeline - [x] Port viewport display # Extended targets - Capture resolution scaling
396 KiB
Clément Foucault added the
Type
To Do
label 2023-09-27 18:43:55 +02:00
Clément Foucault added this to the EEVEE & Viewport project 2023-09-27 18:43:57 +02:00
Clément Foucault added the
Interest
EEVEE
label 2023-10-02 12:54:31 +02:00
Clément Foucault added this to the 4.1 milestone 2023-10-02 12:58:24 +02:00
Jeroen Bakker was assigned by Clément Foucault 2023-10-02 15:44:25 +02:00
Clément Foucault self-assigned this 2023-10-02 15:44:26 +02:00
Blender Bot added the
Status
Archived
label 2023-11-22 00:44:20 +01:00
Sign in to join this conversation.
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
1 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#112966
No description provided.