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
This commit is contained in:
Ethan-Hall 2022-03-10 11:36:16 +01:00 committed by Jacques Lucke
parent 7b62203fc7
commit 34d8ef8fa4
1 changed files with 2 additions and 2 deletions

View File

@ -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: {