Eevee-next: Reflective Light Baking #109909
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#109909
Loading…
Reference in New Issue
No description provided.
Delete Branch "Jeroen-Bakker/blender:eevee-next/reflection-probe-baking-pipeline"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR introduces baking reflective light from light probes. Light probes
are baked on the fly when the light probe data has changed. It doesn't update
directly when other scene data is changed in the viewport.
When doing image rendering the light probes are updated on each frame.
Currently the world probe and closest reflection probe are composited
together in shader. This allows different resolutions. We expect that we
eventually composite it before usage. This would improve the performance.
Unclear if we would support both compositing options eventually.
WIP: Eevee-next: Reflective Light Bakingto Eevee-next: Reflective Light BakingDid not yet review the update tagging / request system. But this is a first pass.
@ -300,2 +300,3 @@
capture_view.render();
capture_view.render_world();
main_view.render();
/* Rendering of probes depends on main view resources. The rendered probes will be applied to the
Could you elaborate on this? This seems quite a poor technical limitation. If the capture pipeline / view shares resources with the main one it should acquire them.
This is mentioned in the description of the PR that this should be investigated as I haven't looked into it yet
@ -301,1 +301,4 @@
main_view.render();
/* Rendering of probes depends on main view resources. The rendered probes will be applied to the
* next sample. */
// TODO: Not sure how to incorporate this during image rendering.
Have a loop in
Instance::render_frame
that update all probes before the sampling loop (while (!sampling.finished()) {
).@ -254,3 +259,4 @@
mat.prepass = material_pass_get(ob, blender_mat, prepass_pipe, geometry_type);
mat.shading = material_pass_get(ob, blender_mat, surface_pipe, geometry_type);
mat.capture = MaterialPass();
mat.probe_prepass = material_pass_get(
This should only be created if needed. So if object is visible in reflections and capture is enabled.
Need to look into this. I assumed (due to unexperience of the material pipeline) that this was persistent. If not this could be made more flexible. Ah I see shader_map_ is cleared at the beginning when syncing.
@ -558,0 +569,4 @@
/* Textures. */
prepass_ps_.bind_texture(RBUFS_UTILITY_TEX_SLOT, inst_.pipelines.utility_tx);
/* Uniform Buffer. */
// TODO: should not be camera...
? visible confusion
@ -558,0 +646,4 @@
eval_light_ps_.bind_texture("gbuffer_closure_tx", &inst_.gbuffer.closure_tx);
eval_light_ps_.bind_texture("gbuffer_color_tx", &inst_.gbuffer.color_tx);
eval_light_ps_.push_constant("is_last_eval_pass", is_last_eval_pass);
// TODO bind dummy texture so they don't influence any render pass accumulation.
To be verified, but they won't because none of these results are then accumulated into the film buffers.
Yes was also my understanding and yes it should be tested.
@ -558,0 +659,4 @@
inst_.sampling.bind_resources(&eval_light_ps_);
inst_.hiz_buffer.bind_resources(&eval_light_ps_);
inst_.ambient_occlusion.bind_resources(&eval_light_ps_);
// TODO: only allow the world light to be evaluated
Don't understand how this comment is related to its surrounding.
During probe rendering I would only use the world reflection probe during shading and ignore all reflection probes that are created by light probes. as the data might not be up to date and therefore can lead to artifacts because the render order cannot be controlled by the artist.
My idea would be to assign an ubo only containing the world inside the
inst_.reflection_probes.bind_resources(..., REFLECTION_PROBE_WORLD_ONLY)
or something similar. Could be an ubo or push constant.Do not use any reflection in the baking process. Using only the world probe will only create light leaks. Only evaluate diffuse surfaces for now.
@ -558,0 +723,4 @@
void DeferredProbePipeline::begin_sync()
{
opaque_layer_.begin_sync();
refraction_layer_.begin_sync();
No refraction layer needed during probe capture. You can remove the option. All specular energy should be converted to diffuse, or use irradiance grid as indirect lighting. But you should really only have one deferred layer since no screen space effect is supported in capture mode.
@ -213,0 +219,4 @@
PassMain prepass_ps_ = {"Prepass"};
PassMain::Sub *prepass_single_sided_static_ps_ = nullptr;
// PassMain::Sub *prepass_single_sided_moving_ps_ = nullptr;
Remove and remove
static
from name.@ -213,0 +252,4 @@
* a hardcoded number of them. */
DeferredProbeLayer opaque_layer_;
DeferredProbeLayer refraction_layer_;
DeferredProbeLayer volumetric_layer_;
Remove that too. No need to make the pipeline complex for this implementation.
@ -96,0 +106,4 @@
* Is set and reset during `remap_to_octahedral_projection`. All other occasions should contain
* nullptr.
*/
GPUTexture *cubemap_tx_ = nullptr;
I think you can promote it to
Texture
and acquire it on the fly. This removes a bit of ugly code where you have to setup the reference.Also don't forget to add comment saying that this should be a
TextureFromPool
and explaining why it isn't.@ -162,6 +162,19 @@ void Sampling::step()
reset_ = false;
}
bool Sampling::do_probe_sync() const
Move to
Instance
@ -223,0 +230,4 @@
{
GPU_debug_capture_begin();
Texture cubemap_tx;
TextureFromPool depth_tx;
Never used!
@ -223,0 +244,4 @@
int2 extent = int2(update_info->resolution);
if (cubemap_tx.ensure_cube(GPU_RGBA16F, update_info->resolution, GPU_TEXTURE_USAGE_ATTACHMENT))
I assume that if you enter
render_probes
, either there is a early out at the top of the functino when no probes are to be rendered, or there is a check in the caller code.So put all the setup code for the frambuffer outside the loop.
Every reflection probe could be rendered in a different resolution, extent can then be different, framebuffer can use different textures etc. The early exit is the while loop. If nothing needs to be rerendered it returns a nullopt and won't enter the while loop.
Perhaps check IRL how to make this better.
I missed this changing resolution for each probe. Then it is fine.
Tested on Mac M1 and it now works great with the latest fixes. Good to go.