After surprisingly finding nothing on this in many Google searches and spending several days trying to do it on my own, I’m going to ask here:
I need a cheaper method than Perlin Noise to produce small color variations in my procedural shaders - which I thought would be easy, but getting smooth transitions from one point to the next requires either A) the usual averaging of at least 8 nearby points, which is expensive; or B) some other method, which I haven’t been able to work out yet.
Surely this problem has come up repeatedly for other people, and I would think there would be a cheaper method than averaging 8 points.
Can you elaborate on what you’re after? How does color variation relate to sampling neighboring points? Why don’t you just lerp between two different colors based on some random factor?
In any case, you indeed do need 9 samples to get an average of 3x3 area… but you can average a 2x2 area in 1 sample or a 4x4 area in 4 samples by exploiting hardware interpolation like this:
The patches of color need to be based on the 3D coordinates (I’m not using UVs) and the color needs to transition smoothly from one point to the next, hence I need to generate a number from each neighboring point and then take a weighted average.
The usual method is to use 3D Perlin Noise, but that requires a lot of math.
Well… The only other way I’m seeing is to compute the 3d grid beforehand and then sample it in your actual shader using 3d hardware interpolation. If it doesn’t change very often, you can do it on CPU, or if it does and you don’t mind dx11, with a compute shader.