Incorrect Image Textures interpolation!

Component:YafaRay Core
Category:bug report
Assigned:David Bluecame


While trying to implement MipMaps (as of, I've been having difficulties with strange seams that appear sometimes at the edge of textures when they are repeated over a surface.

Obviously my first thought was to suspect my own additions to the code for MipMapping. However, after a long struggle, I've found that the original YafaRay texture interpolation was incorrect. Therefore, if I'm not mistaken, this is a problem that has been happening for a very long time in all YafaRay versions.

The problem is subtle, just a fine seam in the edge of the textures, but it's there. To replicate it and compare it with Blender Internal, I've created a small 4x4 texture and these are the results:

Blender Internal render (correct)

texels1 - blender internal (good).pngtexels1 - blender internal (good).png


YafaRay render (wrong, see strange colored stripes at top and left of each repeated texture).

texels1 - yafaray (incorrect, weird bands top left each texture).pngtexels1 - yafaray (incorrect, weird bands top left each texture).png


This problem is not trivial. To solve this, I have not only to correct the bug but also to implement an extension to the current interpolation code. For example if we have textures repeated, to determine the color to be calculated to the pixels near the texture edges, the interpolation should also take into account the colors of the texels in the next repetition of the texture. This also involves taking into account any "mirrorX, mirrorY" effect in the interpolation, so it takes into account the correct texel from the next texture "repetition".

As this is a major problem in my opinion, I'll try to fix it and integrate the texture interpolation with the Texture Clip Mode and MirrorX/Y parameters to make YafaRay texture interpolation behavior more similar to Blender.




I've attached here a zip file with the .blend and texture I used for the example above.

AttachmentSize 129.92 KB


Status:active» ready to commit


After a long struggle I believe I've fixed this in the commit:

Also, the changes implement extra code to take into account texture edge interpolation differently when:
* Texture is alone (clip), extended or checkered. In this case, the edges are interpolated against themselves
* Texture is repeated. In this case the way the edges are interpolated depends on the MirrorX/MirrorY parameters. Depending on these params, the edges are interpolated against the opposite edge (normal) or the same edge (mirrored).

I hope this change works fine and does not cause problems. We will have to test it thoroughly. In any case, I've tested it with similar small textures combining different colors in the edges, etc, with different modes (clip, extend, checker, repeat), including MirrorX/MirrorY and now I'm getting similar results to Blender Internal, which I believe is a good sign.

For example, the scene described above now gives me the correct result:

texels1 - yafaray (fixed texture interpolation).pngtexels1 - yafaray (fixed texture interpolation).png


This change will be available in the next YafaRay version.


Hello David,

thanks for the report and for having brilliantly solved the problem.



ACCA Software


Version:» <none>
Component:Code» YafaRay Core
Status:ready to commit» fixed

Solved in the new version v3.2.0. See:


Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.