1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
#version 430
layout(local_size_x = 8, local_size_y = 8) in;
precision highp float;
#include <complex>
#include <sdf>
#include <utils>
#include <noise>
uniform float seconds = 0;
layout(rgba8) uniform writeonly image2D output_image;
uniform float antialiasing = 0.28;
uniform bool enable_antialiasing = false;
const int MAX_ITERATIONS = 2000;
const float INF_GAP = 10000.0;
vec3 col_pink1 = srgb(0.98, 0.27, 0.47);
vec3 col_pink2 = srgb(0.88, 0.22, 0.32);
vec3 col_yellow1 = srgb(0.90, 0.69, 0.18);
vec3 col_violet1 = srgb(0.26, 0.11, 0.52);
vec3 col_green1 = srgb(0.19, 0.29, 0.16);
vec3 col_green2 = srgb(0.05, 0.15, 0.02);
vec3 col_wingpat = vec3(0.01);
vec3 col_mothbody = col_wingpat;
vec3 col_bg = vec3(0);
vec3 image(vec2 uv) {
vec3 color = col_bg;
vec2 c = (uv - vec2(0, 0.20)) * 6;
c = vec2(c.y, c.x);
vec2 z = vec2(0);
vec2 last_z;
int iter;
float last_dist;
for (iter = 0; iter <= MAX_ITERATIONS; iter++) {
last_z = z;
z = csin(ccos(z)) - ctan(z) + c;
last_dist = length(z - last_z);
if (last_dist >= INF_GAP) break;
}
float f = float(iter) / float(MAX_ITERATIONS);
// Pat
vec2 p = (uv - vec2(0, -0.012)) * vec2(23, 72);
float buttpat = sin(-abs(p.x) - 5) * sin(abs(p.y)) - sin((abs(p.x) - 6) * p.y);
color = mix(color, col_wingpat, (smoothstep(-1.0, 1.0, buttpat - 0.05)) * step(last_dist, 0.0000002));
color = mix(color, col_mothbody, (1 - step(last_dist, 0.0000016)) * step(last_dist, 0.05));
float headcut = sdf_circle(uv - vec2(0, 0.146), 0.092);
float band = last_dist - round(last_dist / 0.4) * 0.4 + 0.22 * fbm(vec2(abs(uv.x), uv.y) * 100) + 0.15 * fbm(vec2(abs(uv.x), uv.y) * 400) - 0.12;
color = mix(color, mix(col_wingpat, vec3(0), 0.4), step(headcut, 0) * (1 - step(band, 0.1)) * smoothstep(-0.38, 0.38, band));
float gap = 0.504;
vec2 eyesp = uv - vec2(gap / 2., 0.093);
eyesp.x -= round(eyesp.x / gap) * gap;
float eyes = sdf_circle(eyesp, 0.0072);
color = mix(color, mix(col_wingpat, col_bg, 0.2), step(abs(eyes) - 0.004, 0) * step(last_dist, 0.0000002));
// Floral
color = mix(color, col_green2, (1 - step(last_dist, INF_GAP)));
color = mix(color, col_yellow1, step(f, 1.0));
color = mix(color, col_pink2, step(f, 0.2));
color = mix(color, col_yellow1, step(f, 0.016));
color = mix(color, col_violet1, step(f, 0.0059999));
color = mix(color, col_pink2, step(f, 0.0024));
color = mix(color, col_green1, step(f, 0.0018));
return color;
}
vec3 antialiased_image(vec2 uv) {
vec2 resolution = vec2(imageSize(output_image).xy);
float s = antialiasing / max(resolution.x, resolution.y);
vec3 sum = vec3(0);
int count = 0;
for (int i = -2; i < 2; i++)
for (int j = -2; j < 2; j++, count++)
sum += image(uv + vec2(i, j) * s);
return sum / count;
}
void main() {
vec2 resolution = vec2(imageSize(output_image).xy);
if (gl_GlobalInvocationID.x >= resolution.x || gl_GlobalInvocationID.y >= resolution.y) return;
float aspect_ratio = resolution.y / resolution.x;
vec2 uv = (gl_GlobalInvocationID.xy - resolution / 2) * vec2(1.0, aspect_ratio) / resolution;
vec3 color = enable_antialiasing ? antialiased_image(uv) : image(uv);
color = color_warmth(color, 1);
imageStore(output_image, ivec2(gl_GlobalInvocationID.xy), vec4(color, 1));
}
|