Closed haasn closed 6 years ago
Judging by the kernel visualizations, it make some sense to perform linear interpolation over angle and strength key (with a 3d texture), and use kernel mixed from four pre-calculated kernels. There are quite some downsides though,
Is it possible that, due to the linear interpolation of weights, we would be better off with a different sampling order? As far as I can tell, you use the x coordinate to store multiple weights and the y coordinate to store a projected offset based on the entire key, using a 2D texture overall. But this is not a requirement - you could instead use a 3D texture, or even a “4D” texture (texture array / multiple textures) in theory.
Then you can use one “linear” coefficient for each coordinate, allowing possibly better linear interpolation of the values. Basically use vec3(angle, strength, coherence) as your base coordinate. To deal with the fact that you need to sample multiple times (for many weights), you can pick one coordinate (ideally the “smallest”) as your “offset” coordinate, and just repeat the entire texture a few times in that dimension - for the different rows of the weights.
Perhaps with this organization you can get a better result with a smaller weights texture, which benefits from better caching and therefore typically better performance.