[Bf-blender-cvs] [1a9480cf25d] master: Realtime Compositor: Keep interpolation in Scale node

Omar Emara noreply at git.blender.org
Thu Oct 13 12:57:01 CEST 2022


Commit: 1a9480cf25d18f15f154d4ac3ec9720ca9dfb2f7
Author: Omar Emara
Date:   Thu Oct 13 12:42:43 2022 +0200
Branches: master
https://developer.blender.org/rB1a9480cf25d18f15f154d4ac3ec9720ca9dfb2f7

Realtime Compositor: Keep interpolation in Scale node

Currently, the scale node always changes the interpolation of its result
to bilinear. This was done because the scale node does not have an
interpolation option, unlike the Transform node, so a default of
bilinear was assumed. This turned out to be problematic, because in the
pixelation use cases, a nearest interpolation is typically preferred by
the user.

This patch changes the default interpolation of input nodes to bilinear,
makes the scale node keep the interpolation of the input it receives,
and makes the pixelate node changes the interpolation to nearest. In
effect, for non-pixelation use cases, the default bilinear interpolation
will be used, and for pixelation use cases, the nearest interpolation
will be used unless explicitly specified using a node that sets the
interpolation.

===================================================================

M	source/blender/compositor/realtime_compositor/COM_domain.hh
M	source/blender/nodes/composite/nodes/node_composite_pixelate.cc
M	source/blender/nodes/composite/nodes/node_composite_scale.cc

===================================================================

diff --git a/source/blender/compositor/realtime_compositor/COM_domain.hh b/source/blender/compositor/realtime_compositor/COM_domain.hh
index 54d712f7578..99b40ae61cf 100644
--- a/source/blender/compositor/realtime_compositor/COM_domain.hh
+++ b/source/blender/compositor/realtime_compositor/COM_domain.hh
@@ -28,7 +28,7 @@ struct RealizationOptions {
    * result involves projecting it on a different domain, which in turn, involves sampling the
    * result at arbitrary locations, the interpolation identifies the method used for computing the
    * value at those arbitrary locations. */
-  Interpolation interpolation = Interpolation::Nearest;
+  Interpolation interpolation = Interpolation::Bilinear;
   /* If true, the result will be repeated infinitely along the horizontal axis when realizing the
    * result. If false, regions outside of bounds of the result along the horizontal axis will be
    * filled with zeros. */
diff --git a/source/blender/nodes/composite/nodes/node_composite_pixelate.cc b/source/blender/nodes/composite/nodes/node_composite_pixelate.cc
index c4e42f8247d..c65bb7bb747 100644
--- a/source/blender/nodes/composite/nodes/node_composite_pixelate.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_pixelate.cc
@@ -36,7 +36,10 @@ class PixelateOperation : public NodeOperation {
      * matches its apparent size, that is, its size after the domain transformation. The pixelate
      * node has no effect if the input is scaled-up. See the compute_domain method for more
      * information. */
-    get_input("Color").pass_through(get_result("Color"));
+    Result &result = get_result("Color");
+    get_input("Color").pass_through(result);
+
+    result.get_realization_options().interpolation = Interpolation::Nearest;
   }
 
   /* Compute a smaller-sized domain that matches the apparent size of the input while having a unit
diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.cc b/source/blender/nodes/composite/nodes/node_composite_scale.cc
index b9f1f2da6a8..c524d7b8da9 100644
--- a/source/blender/nodes/composite/nodes/node_composite_scale.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_scale.cc
@@ -88,7 +88,6 @@ class ScaleOperation : public NodeOperation {
         get_translation(), 0.0f, get_scale());
 
     result.transform(transformation);
-    result.get_realization_options().interpolation = Interpolation::Bilinear;
   }
 
   float2 get_scale()



More information about the Bf-blender-cvs mailing list