EEVEE-Next: Irradiance Bake: Virtual Offset #110355

Merged
Clément Foucault merged 8 commits from fclem/blender:eevee-next-irradiance-bake-virtual-offset into main 2023-08-03 16:47:12 +02:00

Implement capture point bias. This offsets the capture
points to reduce the amount bad capture locations (i.e.:
inside objects, near walls etc...).

Two new parameters are added:

  • Capture Surface Bias: Ensure a minimum distance between
    capture points and surrounding geometry. This is expressed as the
    relative distance between two capture point. Requires re-bake
    to take effect.
  • Capture Escape Bias: Moves capture points enclosed inside
    objects above the nearest surface. This bias defines how far a
    capture point can be moved for escaping the object. This is
    expressed as the relative distance between two capture point.
    Requires re-bake to take effect.

This is called virtual offset in the reference material.

A quick prepass runs before the baking to offset the samples away
from any surface that could potentially make bad samples.

In order to speedup the process, we create cluster list of surfels
near each irradiance grid point. This allow access to neighboring
surfels that can contribute to the virtual offset which should
never be more than half a cell wide.

Implement capture point bias. This offsets the capture points to reduce the amount bad capture locations (i.e.: inside objects, near walls etc...). Two new parameters are added: - Capture Surface Bias: Ensure a minimum distance between capture points and surrounding geometry. This is expressed as the relative distance between two capture point. Requires re-bake to take effect. - Capture Escape Bias: Moves capture points enclosed inside objects above the nearest surface. This bias defines how far a capture point can be moved for escaping the object. This is expressed as the relative distance between two capture point. Requires re-bake to take effect. This is called virtual offset in the reference material. A quick prepass runs before the baking to offset the samples away from any surface that could potentially make bad samples. In order to speedup the process, we create cluster list of surfels near each irradiance grid point. This allow access to neighboring surfels that can contribute to the virtual offset which should never be more than half a cell wide.
Clément Foucault added 5 commits 2023-07-21 20:05:20 +02:00
29b0e74c92 EEVEE-Next: Irradiance Bake: Virtual Offset
This implement virtual offset as described in the reference material.

A quick prepass runs before the baking to offset the samples away
from any surface that could potentially make bad samples.

In order to speedup the process, we create cluster list of surfels
near each irradiance grid point. This allow access to neighboring
surfels that can contribute to the virtual offset which should
never be more than half a cell wide.
2b1feebd10 Merge branch 'main' into eevee-next-irradiance-bake-virtual-offset
# Conflicts:
#	source/blender/draw/engines/eevee_next/eevee_irradiance_cache.cc
#	source/blender/makesdna/DNA_lightprobe_defaults.h
#	source/blender/makesdna/DNA_lightprobe_types.h
buildbot/vexp-code-patch-coordinator Build done. Details
40f3279e60
Improve properties name and description
Author
Member

@blender-bot build

@blender-bot build
Clément Foucault requested review from Miguel Pozo 2023-07-21 20:11:16 +02:00
Clément Foucault added this to the 4.0 milestone 2023-07-21 20:11:23 +02:00
Clément Foucault added this to the EEVEE & Viewport project 2023-07-21 20:11:28 +02:00
Clément Foucault added 1 commit 2023-07-22 10:44:24 +02:00
Miguel Pozo reviewed 2023-07-24 18:55:43 +02:00
Miguel Pozo left a comment
Member

Looks good!
Just adding the bias fixes some issues but introduces others.
imagen
imagen
But I guess that will change once used together with the dilation PR.

I found the user settings quite confusing, though.
I tested the patch first and I didn't understand them until I looked at the code.
I would just leave the "Capture Surface Bias".
Or at least rename "Capture Escape Bias" to something like "Max Capture Offset", and the description to something like "The max distance the Capture Surface Bias can move the capture point".

Looks good! Just adding the bias fixes some issues but introduces others. ![imagen](/attachments/711aaf01-47a3-468c-a7fc-63f7a1e0889b) ![imagen](/attachments/f07784e4-6959-4481-9462-cef0abd42e7d) But I guess that will change once used together with the dilation PR. I found the user settings quite confusing, though. I tested the patch first and I didn't understand them until I looked at the code. I would just leave the "Capture Surface Bias". Or at least rename "Capture Escape Bias" to something like "Max Capture Offset", and the description to something like "The max distance the Capture Surface Bias can move the capture point".
@ -99,0 +111,4 @@
*/
float min_distance_to_surface_ = 0.05f;
/**
* Maximum distance from the grid sample point a recording location.
Member

"to a recording location"?

"to a recording location"?
Author
Member

Would "Baking" location be better?

Would "Baking" location be better?
Member

I think either "baking" or "recording" is ok. My point it's that is missing the "to".

I think either "baking" or "recording" is ok. My point it's that is missing the "to".
fclem marked this conversation as resolved
@ -0,0 +1,5 @@
Member

I would include offset or offset_lines in the name of the file. The same for the vertex shader.

I would include `offset` or `offset_lines` in the name of the file. The same for the vertex shader.
Author
Member

The plan was to make it generic so it could display several type of overlays (validity, offset) just like the other debug shaders. That's why it has DEBUG_IRRADIANCE_CACHE_VIRTUAL_OFFSET mode.

The plan was to make it generic so it could display several type of overlays (validity, offset) just like the other debug shaders. That's why it has `DEBUG_IRRADIANCE_CACHE_VIRTUAL_OFFSET` mode.
Member

I guess it's ok then.
My issue is that the name makes it easy to think this is doing what eevee_display_probe_grid does.

I guess it's ok then. My issue is that the name makes it easy to think this is doing what `eevee_display_probe_grid` does.
pragma37 marked this conversation as resolved
@ -0,0 +22,4 @@
Surfel surfel = surfel_buf[surfel_id];
vec3 probe_to_surfel = surfel.position - P;
float surfel_dist = length(probe_to_surfel);
Member

Any reason to not compute squared length instead?

Any reason to not compute squared length instead?
Author
Member

Code clarity. This step is really inexpensive.

Code clarity. This step is really inexpensive.
pragma37 marked this conversation as resolved
@ -0,0 +75,4 @@
vec3 probe_to_surfel = surfel.position - P;
float surf_dist = dot(offset_direction, probe_to_surfel);
/* Do not consider surfels that are outside of search radius. */
if (surf_dist > search_radius) {
Member

I think this should be abs(surf_dist) > search_radius.

I think this should be `abs(surf_dist) > search_radius`.
fclem marked this conversation as resolved
@ -19,1 +20,4 @@
}
/**
* Return the coresponding cluster index in the `cluster_list_tx` for a given world position.
Member

"corresponding".

"corresponding".
fclem marked this conversation as resolved
Clément Foucault added 2 commits 2023-08-03 16:30:00 +02:00
0ed38d3284 Merge branch 'main' into eevee-next-irradiance-bake-virtual-offset
# Conflicts:
#	scripts/startup/bl_ui/properties_data_lightprobe.py
#	source/blender/blenkernel/intern/lightprobe.cc
#	source/blender/draw/engines/eevee_next/eevee_irradiance_cache.cc
#	source/blender/draw/engines/eevee_next/eevee_irradiance_cache.hh
#	source/blender/draw/engines/eevee_next/eevee_lightprobe.hh
#	source/blender/draw/engines/eevee_next/shaders/infos/eevee_irradiance_cache_info.hh
#	source/blender/makesdna/DNA_lightprobe_types.h
Author
Member

The UI will be reviewed once it lands.

The UI will be reviewed once it lands.
Clément Foucault merged commit 0dc3318ffd into main 2023-08-03 16:47:12 +02:00
Clément Foucault deleted branch eevee-next-irradiance-bake-virtual-offset 2023-08-03 16:47:13 +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 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#110355
No description provided.