I have found the reason for the CPU/GPU discrepancy. The discrepancy occurs because the CPU code for cubic interpolation with clip texture extension only performs texture interpolation inside the range of [0,1]. As a result, even though the volume's color is sampled using cubic interpolation, the boundary is not being interpolated. The GPU appears to be interpolating samples that span the clip boundary softening the edge.
This patch resolves the CPU/GPU discrepancy. I compared performance and render results using the smoke_color.blend test file. Cubic interpolation is used for interpolating the volume's color information for all examples below.
Tests were performed on smoke_color.blend Resolution: 1024x1024 Samples: 64
| Method | Render Time - Average of 5 Runs | How it looks in the viewport |
| Original Code - 3D Texture is not interpolated across the clip border | 24.9 seconds | |
| Patch - 3D Texture is interpolated across the clip border | 25.1 seconds | |
| Original Code (GPU) - 3D Texture is interpolated across the clip border | 1.8 seconds | |
I was working on D14237, and I realized I had to break it up into smaller self contained patches.
This patch is meant to help make future development of the Cycles texture sampling code easier.
The future features that I want to implement are:
- Independent axis extensions for X/U and Y/V
- Mirrored repeat texture extension
I made these changes with those goals in mind.
With this patch, Cycles passes all but one test. The Cycles CPU volume smoke_color test now technically fails. However, the new CPU result for this test is now very similar to the GPU result. This patch could resolve the "uninvestigated discrepancy" that put this test on the blacklist for the Cycles GPU tests.
I'm happy to hear any feedback on how to improve this patch.





