Compositor: Unify Variable Size Bokeh Blur node #117947
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#117947
Loading…
Reference in New Issue
No description provided.
Delete Branch "OmarEmaraDev/blender:unify-variable-size-bokeh"
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 patch adjusts the Variable Size Bokeh Blur node such that it
matches between CPU and GPU. The GPU implementation is mostly followed
for the reasons stated below.
The first difference is a bug in the CPU implementation, where the upper
limit of the blur window is not considered, but the lower limit is.
The second difference is due to CPU ignoring outside pixels instead of
clamping them to border, which is done until an option is added to the
node to control the boundary condition.
The third difference is due to CPU ignoring the bounding box input.
The fourth difference is that CPU doesn't allow zero maximum blur
radius, which is a valid option.
The fifth difference is that the threshold option, which is only used
for the Defocus node, was considered in a greater than manner, while it
should be greater than or equal. Since the default threshold of one
should allow a blur size of one.
The GPU implementation now considers the maximum size of its input,
following the CPU implementation.
@Sergey This is still WIP, because the bounding box input doesn't work for the tiled compositor yet. I spent too much time investigating it and yet to figure it out, but the rest of the patch should be ready.
@OmarEmaraDev Unfortunately, it does not compile here:
I guess you'd expect a per-component
safe_divide
. Not sure if we have utility for it already.As for the tiled compositor, if this fix is is not essential for 4.1, we can delay it for after the Tiled compositor is removed.
@Sergey Where is that error is coming from exactly? Because we do have component-wise safe division, as far as I can see. I added missing includes, maybe that fixes it.
It is indeed not essential, so delaying it will be great.
@OmarEmaraDev The include seems have fixed the issue, thanks!
WIP: Compositor: Unify Variable Size Bokeh Blur nodeto Compositor: Unify Variable Size Bokeh Blur nodeIn the current patch the
VariableSizeBokehBlurOperation::determine_depending_area_of_interest
needs adjustment for theCOM_DEFOCUS_SEARCH
code path of it: the defocus input node index changed from 3 to 4, anddetermine_depending_area_of_interest
does not use the mnemonic and use hard-coded values instead.It also seems that the
determine_depending_area_of_interest
is what causes the uninitialized values of the mask input in theexecute_pixel
. Can't say i fully understand the logic there, but it feels a bit weird to mix AoI of bokeh image with the actual image. Not sure if this is more correct, but this seems to be more clear, and solves the issue:What i still don't understand is why the
operation = get_input_operation(BOUNDING_BOX_INPUT_INDEX);
block is needed in cases where theImage
input in plugged to an image. One would expect it to define the AoT and return true. Maybe you can have a second pair of quick looking eyes. Maybe it is correct/acceptable. But we should not spend too much time on it now.If we can't make sense of this
determine_depending_area_of_interest
, then just ignore the tiled compositor as the Bounds input was never supported there, do the index tweaks in thedetermine_depending_area_of_interest
, and move on with the patch.@Sergey I am not sure why the image input doesn't define the area of interest to be honest.
Anyway, I am a fool for only updating
get_area_of_interest
but notdetermine_depending_area_of_interest
. I updated the code now.The code now allows sizes other than
COM_BLUR_BOKEH_PIXELS
, so we can remove it as well, but maybe in a separate patch.@OmarEmaraDev Thanks for the update. On the quality of the result side it seems to be very well aligned, at least on simple setups.
In a bit more complicated setup something unexpected happens. With the attached file the Tiled compositor takes almost no time, GPU takes a long time, and Full-Frame I hasn't been able to wait for the comp to finish.
Is the Tiled compositor missing something that makes it fast, or something suboptimal happens in GPU/full-frame?
@ -395,0 +289,4 @@
const float max_dim = std::max(get_width(), get_height());
const float base_size = do_size_scale_ ? (max_dim / 100.0f) : 1.0f;
const float maximum_size = size_buffer->get_max_value();
const int search_radius = math::clamp(0, int(maximum_size * base_size), max_blur_);
const int search_radius = math::clamp(int(maximum_size * base_size), 0, max_blur_);
@ -153,0 +159,4 @@
const float maximum_size = maximum_float(context(), input_size.texture());
const float base_size = compute_blur_radius();
return math::clamp(0, int(maximum_size * base_size), get_max_size());
return math::clamp(int(maximum_size * base_size), 0, get_max_size());