[Bf-blender-cvs] [34d8ef8fa47] master: Fix: closest image texture interpolation inconsistent in geometry nodes

Ethan-Hall noreply at git.blender.org
Thu Mar 10 11:38:21 CET 2022


Commit: 34d8ef8fa47f38e44088f34338d9dc7b126bce1c
Author: Ethan-Hall
Date:   Thu Mar 10 11:36:16 2022 +0100
Branches: master
https://developer.blender.org/rB34d8ef8fa47f38e44088f34338d9dc7b126bce1c

Fix: closest image texture interpolation inconsistent in geometry nodes

The `-0.5f` offset is inconsistent with shader nodes.
See D14235 for an example file.

Differential Revision: https://developer.blender.org/D14235

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

M	source/blender/nodes/geometry/nodes/node_geo_image_texture.cc

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc
index a87aef358e1..33802d00d2b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc
@@ -257,8 +257,8 @@ class ImageFieldsFunction : public fn::MultiFunction {
     const int width = ibuf->x;
     const int height = ibuf->y;
     int ix, iy;
-    const float tx = frac(px * (float)width - 0.5f, &ix);
-    const float ty = frac(py * (float)height - 0.5f, &iy);
+    const float tx = frac(px * (float)width, &ix);
+    const float ty = frac(py * (float)height, &iy);
 
     switch (extension) {
       case SHD_IMAGE_EXTENSION_REPEAT: {



More information about the Bf-blender-cvs mailing list