pouët.net

Go to bottom

Costas Array utility ((almost) pattern free noise)

category: general [glöplog]
 
A Costas Array of length [n] is a permuted List of every Integer from 1 to n (exactly once)
permuted in a way, that every differential.xy VECTOR between 2 of its points in 2d (x=positionIndex y=positionValue) is unique (within the tile, OR even within a single torodial tile neighborhood repetition).

You get a PATTERN FREE sequence:
https://www.youtube.com/watch?v=RENk9PK06AQ

generators:
finding a NEW one is computationally complex (being a constrained permutation)
so you end up with a small LUT, or you actually compute a few
https://en.wikipedia.org/wiki/Primitive_root_modulo_n
, known to be a valid CostasArray (may need a lot of bits to buffer large numbers)
or you dare to brute force test some sequential permutations (bad idea):
In C++ you can druteForce a costasArray of N=22 in roughly 10 hours, if you insist on long compile times.

besides echolocation, i suspect a PATTERN FREE sequence to be useful to generate great noise, or at least a nice basis for a music sequencer.
Because only with a pattern free basis, , all wrapper code around it has 100% control over ANY emergent pattern, 100% control over any (lack of) repetition.

Sadly, for truly pattern free 2d noise, i would need a 3d costas array.
they exist, but they are small, and some (1 or 2?) of its values are always NaNs, by the definition of a 3d costas array and its inherent modulo arithmetic, you and up with mod(a,0) for 2 tiles.
so that is a no go.

to make a 2d costas array into a noisy 2d thing, i shift it, and apply it to its shifted self (recursively)
this looks BAD for 1/3rd of them, not good for 1/3, and good/passable for the best 1/3rd.
sadly, 1 recursion of a patternFree sequeence is no longer truly pattern free, but pretty close to it (and it is pattern free, if you only care for 1 of N hues)

so I collect the better ones (that animate better (less jittery) by cycling the palette of the resulting "noise"):
https://www.shadertoy.com/results?query=costas&sort=newest&filter=

because palette cycling over time makes this a 3d noise. (albeit a bad one over the 3d domain, but by compositing multiple of those together, its more useful again)

It seems, I have a LOT of control over how BLUE a composite noise of multiple of these CostasArrayNoises is, by weighting a composite of multiple of them of different tile sizes (larger weighting factors on shorter costasArrays makes bluer noises), and if they share no (co)primes of size, the whole array is pretty large and fast, while its LUT can be relatively small.
https://www.shadertoy.com/view/3stBz7

i think, this can be turned into a 2d (or 4d over time] [permuted condruential generator], and it may even have LookAhead functionality.
with the advantage, that the all derivatives, down to the Nth derivative are unique/unpredictable. (unless you memorize all previous states of the loop)
www.pcg-random.org

one caveat; none of these SQUARE CostasArrays ever have a .x differential of 0, which results in a black cross in its 2d fourierTransform.
Most costasArrays are "square", but rectangular ones do exist, that can have a differential of 0. They are just not famously found in large collections, and they would share more coprimes along one of their domains, for being of EVEN length along one domain.
added on the 2020-12-06 09:30:56 by ollj ollj
I give a shit and sample into a random texture. Good enough. Case closed.
added on the 2020-12-14 18:56:02 by EvilOne EvilOne

login

Go to top