diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-08-23 16:30:31 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-08-23 18:08:45 +0300 |
commit | daa7c59e38c8fe464004b3becd6956b880c38c92 (patch) | |
tree | c579e1eb7908bc24429fad527b9ae58fda4c67d7 /source/blender/compositor/intern | |
parent | 344aca3b1bf2718904455ea6cef1ffd8bedf51a6 (diff) |
Compositor: Full frame Bokeh Blur and Blur nodes
Adds full frame implementation to these nodes operations.
When enabling "extend bounds" node option, tiled implementation
result is slightly different because it's using `TranslateOperation`
with bilinear sampling for centering.
Full frame always uses nearest to don't lose image quality.
It has the disadvantage of causing image jiggling on backdrop
when switching size values as it's not pixel perfect.
This is fixed by rounding to even.
No functional changes.
Part of T88150.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D12167
Diffstat (limited to 'source/blender/compositor/intern')
-rw-r--r-- | source/blender/compositor/intern/COM_NodeOperation.cc | 6 | ||||
-rw-r--r-- | source/blender/compositor/intern/COM_NodeOperation.h | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/compositor/intern/COM_NodeOperation.cc b/source/blender/compositor/intern/COM_NodeOperation.cc index 575e8446abe..1b87cdf72fb 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cc +++ b/source/blender/compositor/intern/COM_NodeOperation.cc @@ -82,8 +82,12 @@ void NodeOperation::determineResolution(unsigned int resolution[2], input.determineResolution(resolution, preferredResolution); used_resolution_index = m_resolutionInputSocketIndex; } - unsigned int temp2[2] = {resolution[0], resolution[1]}; + if (modify_determined_resolution_fn_) { + modify_determined_resolution_fn_(resolution); + } + + unsigned int temp2[2] = {resolution[0], resolution[1]}; unsigned int temp[2]; for (unsigned int index = 0; index < m_inputs.size(); index++) { if (index == used_resolution_index) { diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h index 934007d25ce..b402dc7f174 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.h +++ b/source/blender/compositor/intern/COM_NodeOperation.h @@ -287,6 +287,8 @@ class NodeOperation { */ unsigned int m_resolutionInputSocketIndex; + std::function<void(unsigned int resolution[2])> modify_determined_resolution_fn_; + /** * \brief mutex reference for very special node initializations * \note only use when you really know what you are doing. @@ -518,6 +520,15 @@ class NodeOperation { void setResolutionInputSocketIndex(unsigned int index); /** + * Set a custom function to modify determined resolution from main input just before setting it + * as preferred resolution for the other inputs. + */ + void set_determined_resolution_modifier(std::function<void(unsigned int resolution[2])> fn) + { + modify_determined_resolution_fn_ = fn; + } + + /** * \brief get the render priority of this node. * \note only applicable for output operations like ViewerOperation * \return eCompositorPriority |