pouët.net

Noise Questions

category: code [glöplog]
Your answer rocks =)
added on the 2013-11-15 18:51:34 by Optimus Optimus
haha! didnt await this as an answer! ;)
Was a real offer btw!
Yes, we smoke....shit most likely!
And i am unsocial (asocial) myself, only visiting pouet to annoy the shit out of everyone! ;)
this old forum thread is linked to in context of noises on a gpu, which still ranks high on google as of 2019-03, as it nicely describes bluenoise and bayer matrix, with 3 different applications, so this thread is still relevant, and i have something to add:

the [pqfpm] or [qfpm] = [(prime) quadratic field permuting matrix]

a "type of hash/noise" that is
- fast
- parametric
- optionally not c0 continuous OR has infinite differentials (in terms of Fourier analysis)
- optionally not periodic AT ALL (within all practical purposes of ANY address space limitations)

https://www.shadertoy.com/view/Xt3BDB

asks, what if we sum up many different [quadratic fields, who's components share no prime factors], scaled by [x,time], and take the cos() or fract() of that to get it into range[-1..1]

i think a [[quadratic field] matrix with [no coprimes] as parameters for any of its [quadratic field]s]
is pretty useful for a(n aperiodic) hash:

this proposes a LOOKUPTABLE that buffers [quadratic fields] that have unique primes as parameters.
that LUTjust saves us a sqrt(), may not be worth it, unless you want to permute within a VERY large array of [quadratic Field]s.

for simplicity, lets just do a mat4 buffer or smaller, these can bedefined and calculated with little efford.

//when you want to generate a hash, especially with long period and equidistribution
//you likely want to mox and permute different [quadratic field]s
//most famous is Phi= (sqrt(5)+1)/2
//followed by phi= (sqrt(5)-1)/2
//followed by Skewy = (sqrt(3)+0)/2
//to get perios as long as possible, you want a large [leastCommonMultiple] of these.
//-> the parameters of your quadratic fields better not share any primeFactors, no [coprime quadratic field]s allowed
//so, how do we label this [prime quadratic fields] has a cewrtain ring to it, like [prime ribs of fourier analysis]:

//sonmehow opengl has no piecewise matrix sqrt()
mat4 sq(mat4 a){return mat4(sqrt(a[0]),sqrt(a[1]),sqrt(a[2]),sqrt(a[3]));}
mat3 sq(mat3 a){return mat3(sqrt(a[0]),sqrt(a[1]),sqrt(a[2]));}
mat2 sq(mat2 a){return mat2(sqrt(a[0]),sqrt(a[1]));}
//sonmehow opengl has no piecewise matrix fract()
mat4 sq(mat4 a){return mat4(fract(a[0]),fract(a[1]),fract(a[2]),fract(a[3]));}
mat2 sq(mat3 a){return mat3(fract(a[0]),fract(a[1]),fract(a[2]));}
mat2 sq(mat2 a){return mat2(fract(a[0]),fract(a[1]));}

//we define opop() as [permuting matrix] of 2 outerProduct(s):
//an outerProduct(a,b) where either [a] or [b] has all parameters identical, is just a matrix of identical rows/columns
//we sum 2 of these up, to permute row+column:
#define op outerprodct
mat4 opop(vec4,a,vec4 b){return op(a,vec4(1)))
+op( vec4(1),b);}
mat3 opop(vec3,a,vec3 b){return op(a,vec3(1)))
+op( vec3(1),b);}
mat2 opop(vec2,a,vec2 b){return op(a,vec2(1)))
+op( vec2(1),b);}

//opop(sqrt(a),b) returns a matrix of [qudratic field]s
//, of the form sqrt(a)+b
//and it quickly permutes 16 of them, when [a,b] are vec4(), and it returns a mat4 opop()
//if sqrt() is not your (type int), just think of its squared variant;
//where you square both inputs, may defer the summing up the 2 outerProduct(s), and defer any sqrt() as much as you like:
//- that may result in higher precision, but needs 2x as much memory.

//how to we hash/noise this:

#define cosopop(t,a,b) (t*cos (opop(a,b)))
#define fraopop(t,a,b) (t*fract(opop(a,b)))
//returns very long periods, even when a and b are small primes, because quadraticFields tend to not overlap.
//just remember how phi=(sqrt(5)+1)/2 can be used for hashes/noises

mat4 AperiodicFracturedTime=fraopop(iTimeNow,vec4(7,5,3,2),vec4(21,17,13,11))
//multiply AperiodicFracturedTime with any arbitiary matrix, to mix and match them
//, and take any compnent out of that result.
//the components of AperiodicFracturedTime are nice parameters for bilin() trilin() interpolation over anything, including itself.
//AperiodicFracturedTime is fast, but not Continuous

mat4 AperiodicDifferentialTime=cosopop(iTimeNow,vec4(11,7,5,3),vec4(27,21,17,13))
//disadvantage of including trigonometry (lower precision/speed on mobile hardware)
//bias in favor of extrema, being a cos() circle
//advantage of having infinite and continuous differentials over iTimeNow
//the components of AperiodicDifferentialTime are nice parameters for bilin() trilin() interpolation over anything, including itself.

//note, each component of these mat4 is periodic
//, the aperiodicity just implies that your PERMUTED LeastCommonMultiple period is significtntly longer than your runtime/precision
//so by any implication of any [infinity] many permutations may just appear [aperiodic]
//just by using large enough (co) primes as inputs (that share no prime factor)
//a [library of babel] [library of discord] [permuted linear congruential generator]
//...destroys any concept of infinity, to a LeastCommonMultiple of permutations (of primes)

//the 8 input values can be any numbers, but
//- 0 or 1 (each) only appear once within the same vec4()
//- 0 must not appear at the same position of both vec4
//- - actually, having 0 in the first vec4() is pretty [linear], the wuadraticField of [sqrt(0)+b] is a bit trivial.
//- the parameters of any vec4() share no coprime (for a largest possible leastCommonMultiple)
//- all parameters of any vec4() should be close to each other (else you mix large and small periods, which ends up uncanny)
added on the 2019-03-04 04:02:04 by ollj ollj

login