Skip to content

Instantly share code, notes, and snippets.

@jwise
Created July 21, 2023 18:36
Show Gist options
  • Save jwise/2efdd7f6350d2e9395c418bf389b69f4 to your computer and use it in GitHub Desktop.
Save jwise/2efdd7f6350d2e9395c418bf389b69f4 to your computer and use it in GitHub Desktop.
/* ported from humanshader.com; paste into shadertoy */
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
float x = fragCoord.x / iResolution.x * 70.0;
float y = (iResolution.y - fragCoord.y) / iResolution.y * 39.0;
float u = x - 36.0;
float v = 18.0 - y;
float h = u*u+v*v;
float R, G, B;
if (h < 200.0) {
R = 420.0;
B = 520.0;
float t = 5000.0 + 8.0 * h;
float p = (t * u) / 100.0;
float q = (t * v) / 100.0;
float s = 2.0 * q;
float w = (1000.0 + p - s) / 100.0 + 8.0;
if (w > 0.0) R = R + w*w;
float o = s + 2200.0;
R = R * o / 10000.0;
B = B * o / 10000.0;
if (p > -q) {
w = (p + q) / 10.0;
R = R + w;
B = B + w;
}
} else if (v < 0.0) {
R = 150.0 + 2.0 * v;
B = 50.0;
float p = h + 8.0 * v * v;
float c = 240.0 * (-v) - p;
if (c > 1200.0) {
float o = (6.0 * c) / 10.0;
o = c * (1500.0 - o);
o = o / 100.0 - 8360.0;
R = R * o / 1000.0;
B = B * o / 1000.0;
}
float r = c + u * v;
float d = 3200.0 - h - 2.0 * r;
if (d > 0.0) R = R + d;
} else {
float c = x + 4.0 * y;
R = 132.0 + c;
B = 192.0 + c;
}
if (R > 255.0) R = 255.0;
if (B > 255.0) B = 255.0;
G = (7.0 * R + 3.0 * B) / 10.0;
// Output to screen
fragColor = vec4(R/255.0, G/255.0, B/255.0, 1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment