Eevee-next: Octahedral mapping #109559

Merged
Jeroen Bakker merged 9 commits from Jeroen-Bakker/blender:eevee-next-octahedral-mapping into main 2023-07-03 15:14:41 +02:00
Member

Use octahedral mapping to store probe textures. Octahedral textures are easier to sample
and will increase performance. When extracting the world probe it will first be rendered into
a cubemap. This cubemap will then be remapped using octahedral texture coordinates.

  • CaptureView captures the world light into a cubemap.
  • CaptureView triggers the reflection probe module to update the octahedral texture using
    the cubemap.
  • When sampling reflection probes it will convert the (cubemap) direction to octahedral
    coordinate and read from the octahedral texture.

image

Our goal is to pack multiple probes with different resolutions into a single texture. This
is out of scope of this change, except that the target texture is already an 2d float array.

Use octahedral mapping to store probe textures. Octahedral textures are easier to sample and will increase performance. When extracting the world probe it will first be rendered into a cubemap. This cubemap will then be remapped using octahedral texture coordinates. * `CaptureView` captures the world light into a cubemap. * `CaptureView` triggers the reflection probe module to update the octahedral texture using the cubemap. * When sampling reflection probes it will convert the (cubemap) direction to octahedral coordinate and read from the octahedral texture. ![image](/attachments/d3331660-f893-41b7-8c17-ae12ddf2ad11) Our goal is to pack multiple probes with different resolutions into a single texture. This is out of scope of this change, except that the target texture is already an 2d float array.
1.5 MiB
Jeroen Bakker added 1 commit 2023-06-30 16:07:49 +02:00
Jeroen Bakker added the
Module
EEVEE & Viewport
label 2023-06-30 16:21:24 +02:00
Jeroen Bakker added this to the 4.0 milestone 2023-06-30 16:21:28 +02:00
Jeroen Bakker added this to the EEVEE & Viewport project 2023-06-30 16:21:32 +02:00
Jeroen Bakker self-assigned this 2023-06-30 16:21:37 +02:00
Jeroen Bakker added 2 commits 2023-07-03 11:07:52 +02:00
Jeroen Bakker added 1 commit 2023-07-03 11:12:28 +02:00
Jeroen Bakker added 1 commit 2023-07-03 12:15:48 +02:00
Jeroen Bakker requested review from Clément Foucault 2023-07-03 12:51:01 +02:00
Jeroen Bakker changed title from WIP: Eevee-next: Octahedral mapping to Eevee-next: Octahedral mapping 2023-07-03 12:51:10 +02:00
Jeroen Bakker added 1 commit 2023-07-03 13:04:20 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
0f28cc9077
Remove mipmaps from cubemap
Author
Member

@blender-bot build

@blender-bot build
Clément Foucault requested changes 2023-07-03 14:35:28 +02:00
@ -123,2 +126,4 @@
#define GBUF_COLOR_SLOT 4
/* Reflection Probe slot when updating the octahedral texture.*/
#define REFLECTION_PROBE_OCTAHEDRAL_SLOT 0

If this is used by only one shader/pass, do not assign a global slot.

If this is used by only one shader/pass, do not assign a global slot.
Jeroen-Bakker marked this conversation as resolved
@ -21,0 +15,4 @@
probes_tx_.ensure_2d_array(GPU_RGBA16F,
int2(max_resolution_),
max_probes_,
GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT,

Remove GPU_TEXTURE_USAGE_ATTACHMENT and add GPU_TEXTURE_USAGE_SHADER_WRITE

Remove GPU_TEXTURE_USAGE_ATTACHMENT and add GPU_TEXTURE_USAGE_SHADER_WRITE
Jeroen-Bakker marked this conversation as resolved
@ -0,0 +3,4 @@
*/
vec2 octahedral_uv_from_direction(vec3 co)
{
/* projection onto octahedron */

Comment style

Comment style
Jeroen-Bakker marked this conversation as resolved
@ -0,0 +16,4 @@
vec2 uvs = co.xy * (0.5) + 0.5;
/* edge filtering fix */
// uvs = (1.0 - 2.0 * texel_size) * uvs + texel_size;

Remove it or comment why you commented it.

Remove it or comment why you commented it.
Jeroen-Bakker marked this conversation as resolved
@ -0,0 +21,4 @@
return uvs;
}
vec3 octahedral_to_direction(vec2 co)

octahedral_uv_to_direction

octahedral_uv_to_direction
Jeroen-Bakker marked this conversation as resolved
Jeroen Bakker added 2 commits 2023-07-03 14:53:49 +02:00
Clément Foucault requested changes 2023-07-03 14:56:29 +02:00
@ -22,0 +30,4 @@
PassSimple &pass = remap_ps_;
pass.init();
pass.shader_set(instance_.shaders.static_shader_get(REFLECTION_PROBE_REMAP));
pass.bind_texture(0, cubemap_tx_);

Never use unamed static bindpoints. Use their resource name, here cubemap_tx and tahedral_img.

Never use unamed static bindpoints. Use their resource name, here `cubemap_tx` and `tahedral_img`.
Jeroen-Bakker marked this conversation as resolved
Jeroen Bakker added 1 commit 2023-07-03 15:00:07 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
f610ea2e12
Use named bind points.
Clément Foucault approved these changes 2023-07-03 15:00:36 +02:00
Author
Member

@blender-bot build

@blender-bot build
Jeroen Bakker merged commit c6c69c0656 into main 2023-07-03 15:14:41 +02:00
Jeroen Bakker deleted branch eevee-next-octahedral-mapping 2023-07-03 15:14:42 +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#109559
No description provided.