From 4a58155193ccec4ff54821f69f2018b9df558f03 Mon Sep 17 00:00:00 2001 From: LionZXY Date: Sun, 16 Oct 2022 23:11:37 +0400 Subject: [PATCH] Update cosmic.frag --- .../resources/assets/avaritia/shader/cosmic.frag | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/resources/assets/avaritia/shader/cosmic.frag b/src/main/resources/assets/avaritia/shader/cosmic.frag index fcbef89..313f0d6 100644 --- a/src/main/resources/assets/avaritia/shader/cosmic.frag +++ b/src/main/resources/assets/avaritia/shader/cosmic.frag @@ -1,4 +1,4 @@ -#version 130 +#version 120 #define M_PI 3.1415926535897932384626433832795 @@ -21,6 +21,10 @@ uniform mat2 cosmicuvs[cosmiccount]; varying vec3 position; +float rand2d(vec2 x) { + return fract(sin(mod(dot(x, vec2(12.9898, 78.233)), 3.14)) * 43758.5453); +} + mat4 rotationMatrix(vec3 axis, float angle) { @@ -73,9 +77,9 @@ void main (void) // get semi-random stuff int j = i + 7; - float rand1 = (j * j * 4321 + j * 8) * 2.0F; + float rand1 = (j * j * 4321 + j * 8) * 2.0; int k = j + 1; - float rand2 = (k * k * k * 239 + k * 37) * 3.6F; + float rand2 = (k * k * k * 239 + k * 37) * 3.6; float rand3 = rand1 * 347.4 + rand2 * 63.4; // random rotation matrix by random rotation around random axis @@ -101,8 +105,7 @@ void main (void) int tv = int(mod(floor(v*uvtiles),uvtiles)); // get pseudorandom variants - int position = ((1777541 * tu) + (7649689 * tv) + (3612703 * (i+31)) + 1723609 ) ^ 50943779; - int symbol = int(mod(position, cosmicoutof)); + int symbol = int(rand2d(vec2(tu, tv + i * 10.0)) * cosmicoutof); int rotation = int(mod(pow(tu,float(tv)) + tu + 3 + tv*i, 8)); bool flip = false; if (rotation >= 4) { @@ -175,4 +178,4 @@ void main (void) col = clamp(col,0.0,1.0); gl_FragColor = col; -} \ No newline at end of file +}