Page MenuHome

Cycles texture interpolation issues
Closed, ResolvedPublic

Description

System Information
OS: Ubuntu Linux 14.04 64 bit
Graphics: nVidia GeForce GTX 560 Ti

Blender Version
Broken: 2.73a bbf09d9
(Tested with same result on 2.67 and 2.70)

Short description of error
With a transparent shader and a PNG image the first or top row and the first or left most column seems to pick the color and transparency of the row or column on the other side of the image (i.e. bottom row and right most column, respectively). An off-by-one error?

Exact steps for others to reproduce the error
See attached .blend file:

(the test image should be packed in it).

  • Create a plane.
  • Connect a mix shader with transparent BSDF (top) and diffuse BSDF (bottom) to surface.
  • Add a PNG image texture with transparency.
  • Connect image color output into diffuse shader and alpha into fac of mix shader.
  • UV map plane to the image - note: use complete image till border.
  • Look at rendered viewport or render an output image.

Note: workaround
When you do not use the top most row and the left most column of the image the transparency will work as expected.

Event Timeline

Hilbert Jonker (hilbert) raised the priority of this task from to 90.
Hilbert Jonker (hilbert) updated the task description. (Show Details)
Hilbert Jonker (hilbert) edited a custom field.
Julian Eisel (Severin) lowered the priority of this task from 90 to 50.Feb 23 2015, 7:54 PM

Can confirm that. Using viewport texture mode, everything looks fine, so maybe it's a cycles texture mapping issue? Assigning to sergey in case he gets bored with dependency graph ;)

I see it on both final render and in rendered viewport.

I think this may be a fundamental issue with texture interpolation. I've seen it in other 3D applications (such as Second Life), where if you have 1x1 repeats on a cube, you'll see some edges interpolated against the opposite side of the texture. What I usually do in those cases is set the repeats to 0.995 x 0.995. I tried that workaround on the example .blend file using the Vector->Mapping node, but it didn't work unfortunately.

Anyways, there are a couple workarounds you can use.

  1. On the Image Texture node, go to the 2nd dropdown, and change it from Linear to Closest. Doing so will turn off smooth interpolation, so if you zoom in the pixels won't be smoothed, they'll be hard-edged. If you're only using this for big solid colors and aren't using any curved or angled shapes (much like the example image), this won't hurt anything.
  2. Another possible workaround would be to use a higher-resolution texture, and perhaps putting a 1px thick alpha border around all sides of the image, so that there is no bleed-through.

At least one person with an nVidia card is unable to reproduce (https://developer.blender.org/T43795).

Cannot produce error either. Both render show the 1pixel border. GPU is a GTX970 running 347.09 Driver on Win7.

I experience texture offset using OpenCL on AMD hardware.

After playing with the transparency example and comparing the same result in the internal render, I'm inclined to say that this issue is more a lack of feature.
Exactly the same artifact appears in BI When using an Image or Movie type Texture, however under the Image Mapping section is the option Extension.
The setting Extend specifically repeats the edge pixels of the texture instead of wrapping around.
The setting Clip simply makes all pixels beyond the texture transparent.
The default setting Repeat wraps the texture, this seems the be the default behavior in cycles for any given image texture.
Using either the Extend or Clip settings immediately resolves the artifact.

Right now there is no way to change it, it seems. Having the option for Cycles Image Textures would solve this without work around's.
An interesting side note re: CPU / GPU texture offset, this example shows that the offset I am experiencing is down and left 1~ pixel, as the top line is slightly thicker and the left line is gone.

(OpenCL GPU render on r7 260x, catalyst omega 14.12)
Although these topics are merged due to visual similarity, I feel that the CPU / GPU issue might be different?

I was able to repro the issue on both CPU and GPU/CUDA.

System Information
64bit Manjaro Linux, kernel 3.14.33
CPU: AMD Phenom II 970 Deneb quad-core
GPU: nVidia GTX 650 Ti, driver 346.35

I'm not sure why you consider T43795 unrelated. The root of the issue is exactly the same -- wrapping coordinates on the image boundary when doing interpolation. The fact that some devices does expected interpolation in this case doesn't make any difference in the root of the issue.