3 ms·
No time to play with this at the moment but I suspect the problem is that the author didn't try generating the real and imaginary parts. You can't treat the mag
by cozzyd 5y ago
No time to play with this at the moment but I suspect the problem is that the author didn't try generating the real and imaginary parts. You can't treat the magnitude the same way you treat amplitudes.
Also I don't see if the DC and Nyquist terms are forced to be real (otherwise the IFT won't be real)?
- madengr 5y ago
- mistercow 5y ago> First we make N complex values from polar coordinates that have a random angle 0 to 2pi and a random radius from 0 to 1. This is what jumped out to me as suspicious. This looks just like a naive (and wrong) algorithm for generating random points in a circle. The simplest correct way to do this in the circle case is rejection sampling. In this context, that would mean: generate a random real and imaginary part to get z, and retry until |z| ≤ 1.
- midjji 5y agoThen simplest way to do so is to sample a normal distribution twice and normalize the length. Its significantly faster too.
- ssfrr 5y agoThe goal is not well-defined here. If the goal is to generate uniformly-distributed points in a circle then this algorithm is wrong, but it’s not clear that’s actually what they want. Generating a spectrum with a given magnitude distribution and uniform phase distribution is pretty common (at least in audio).
- cozzyd 5y agoYes, though e.g. if you want white nose you'd use a Rayleigh distribution for magnitude rather than a Gaussian as you would use for real and imaginary parts.
- dahart 5y ago> I suspect the problem is that the author didn’t try generating the real and imaginary parts. I’m not sure I understand what you mean. He definitely does describe generating a complex number, and ensuring the imaginary parts are designed to produce an output image with real-only values after the FT. Can you elaborate on how magnitudes and amplitudes are being conflated? The problem, as I understand it, is the output is Gaussian distributed rather than uniform, not a simple bug or misuse of the DFT like you assume. Perhaps this implies that a using white noise source in the frequency domain is the issue, maybe the forward transform of blue noise is not white along the outside of frequency space, and so generating a frequency space image using white noise might not be expected to work? Maybe worth playing with it when you have time?
- cozzyd 5y agoAll I mean is that the statistics of the magnitude are different than the author expects, probably. You can certainly generate complex numbers with the magnitude, but picking from a uniform distribution is unlikely to generate what you want. Also, it will certainly be a problem if the DC/Nyquist terms aren't pure real, though maybe that is actually being done and I missed it.
- dahart 5y ago> picking from a uniform distribution is unlikely to generate what you want. I see now, and I think this is a good point. Maybe I just said almost the same thing. Without looking at frequency plots, if I just think about what I expect to get with a DFT of high-pass filtered white noise, I’d assume it’s blue-ish in the sense of having less low frequency, but I don’t think I would expect it to produce the same perfectly even spread that the void-and-cluster algorithm produces. It seems like this implies that a forward DFT of a void-and-cluster blue noise texture has some structure that might be hard to see in frequency space, we can’t assume frequency noise that looks white really is white, and maybe there is a relationship between the frequency and phase components that just aren’t met by picking a random angle & radius.
- deleted 5y ago