I am building a volumetric ray marching shader in HLSL in Unreal Engine, based on Ryan Brucks’ work: https://shaderbits.com/blog/creating-volumetric-ray-marcher
I am trying to add some additional noise to the shader using a tiling 3D noise texture, and I’ve noticed something which I don’t understand, and can’t find an explanation for - probably because I’m not exactly sure what I should be searching for to get to the bottom of the problem.
The position inside the ray marched volume is normalized, so I can just use that value to read into the 3D texture. When using this value directly, I get decent performance. But as soon as I start multiplying the value in order to increase the UV tiling (and frequency of the noise) the performance drops seemingly linearly with the amount of tiling. The thing that confuses me about this is that I’m not changing the number of ray march steps or any other value, each step is simply taking a read of the 3D texture at different points.
The only thing I can imagine is that this is something fundamental to do with how texture reads work, or something to do with GPU caching, and that reading from the texture in this way does so in a manner that is somehow less efficient.
So I would like to understand the nature of the problem, but also understand if there is some way around it.