Generating Coherent Noise Using Fourier Transforms
farazzshaikh.medium.com
farazzshaikh.medium.com
Perlin and Simplex are also easily tileable too. Just make your hash function periodic and the resulting noise while tile at the same period.
This is a neat article and a neat technique, but probably not super practical. If you know how synthesizers (like the musical instruments) work, then you can think of Perlin noise as additive synthesize and the article here as subtractive synthesis.
Taking the FFT, modifying frequency amplitudes, and then taking the IFFT is one way to implement a filter. A more direct way is to filter in the time (well, space here) domain using something like a FIR or IIR. In spatial terms, that means applying a convolution filter, which is exactly how most blurring algorithms in programs like Photoshop work.
So, another way to look at this, is that you can generate pretty terrains by taking white noise and blurring it with the right convolution kernel.
>> Taking the FFT, modifying frequency amplitudes
Modifying amplitude and phase. In the time domain you can't modify frequency amplitude without modifying the phase. If you modify just the FFT amplitude, you can end up with non-causal impulse responses. 1. Generate some White Noise.
2. Perform a Fourier transform on the White Noise.
Are the two separate steps necessary? It should be possible to directly generate the Fourier Transform of the white noise, rather than applying FFT to the waveform, right? 3. apply filter
4. apply inverse FT
It is equivalent to replace 1, 2 and 3 with a proper stochastic but direct sampling of the 1/f function to get the Fourier amplitudes and a uniform sampling for Fourier phase.This would save processing time by avoiding the calculation of one 2D FFT and the application of the filter (a 2D array multiplication).
Randomise the phases. (i)FFT. Done.
For generating artistic images, the artist may ignore this fact and generate only the random phases. Image to image, humans probably won't know the shortcut. But in fact, each image will have exactly the same amplitude spectra and that's not physical for real stochastic processes. Depending on the usage of the images, the shortcut could be fatal.
Eg, if we train a neural net on these generated images we should not expect that NN to perform well on the real data which our generated images were meant to represent.
It's important to keep in mind when speaking of noise that we are referring to average values (or statistical values), e.g. although the power spectrum of white noise is on average flat, as we discussed it's really random (the expected amplitude spectrum in fact has average 0 anywhere, since it's also white noise!).
I don't think the same neat result holds when you use uniform white noise, but I haven't done the math.
Generate a bunch of sine waves at various frequencies ("octaves") and add them together.
1. I am a noob at math and the original paper really did surprise me because I find it weird and interesting that you can morph white noise to be coherent. I am sure to the people who know what they’re doing it seems obvious but it wasn’t to me.
2. The article is simply an explanation of what I think is the reason behind the mechanism as explained in the paper. Of course now I know with the help of all of you that there are better ways of doing things and most of the steps are redundant.
I’ll make a revised post with the improvements sometime in the future. Thank you again :)
I'm used to "coherency" being a property between two different "channels" or sources of signal.
Here, I guess it is being used to mean coherency between the X and Y dimensions. Is that right?
If so, I think this is not truly coherent noise but rather mimicry. We see large "patches" in X-Y because the 1/f increases the relative power in lower frequency. It is thus a "natural accident" to have low frequency in X and Y form some patches somewhere. But, it's not a coherent effect.
I'd be curious to learn if I'm misunderstanding the use of the term.
I dunno if Gardner's earlier paper from 1979, "Computer-generated texturing to model real-world features", contains the idea already because I could never find a digital version of that one.
[1] https://www.cs.drexel.edu/~david/Classes/Papers/p297-gardner...
I suspect perhaps the author is surprised because squinting/defocussing your eyes at the original noise doesn't much look like the final result.
Thats because as well as removing the high frequency components (like squinting), this algorithm also is rescaling the amplitude.
Can you explain this? I don’t see the connection. I can see how the zero-frequency value would be equal to the integral (well, the average).
Edit: figured it out. Derivative operator multiplies each basis function by its index. D exp(inx) = inexp(inx). Apply the inverse operation (divide by index) to get the integral.
A similar kind of noise known as blue noise can be generated by taking the Fourier transform and not applying a 1/f filter but a high-pass filter instead. You end up with noise that only has high frequencies in it, and not low frequencies. Thus the noise does not have large-scale features, which is ideal for use in dithering.
Blue noise (and its DFT) look like this: https://demofox2.files.wordpress.com/2018/08/vc.png
And an example of dithering with white and blue noise: https://demofox2.files.wordpress.com/2019/06/randomvsblue.jp...
I guess it depends a lot on the input though, a bit like how nearest-neighbor is a much better algorithm than bi-cubic to scale up pixel art while the result is horrible if you use it on a real-world picture.
For example, in ground-based experiments that measure the cosmic microwave background radiation, there is a substantial foreground noise from the atmosphere that can be modeled as a 1/f distribution. And actually the observations themselves are subject to a random variance (see cosmic variance) due to the fact that we get to observe the early universe from only one point in space. So you can use a similar trick to sample many random realizations of the CMB for given physical constants, and decide if our one-off observation is compatible with the theory.