id stringlengths 6 6 | author stringclasses 55
values | date timestamp[ns] | image_code stringlengths 746 52.3k | license stringclasses 7
values | func_bytes listlengths 5 5 | functions listlengths 1 32 | comment stringlengths 7 1.29k | header stringlengths 18 169 | body stringlengths 18 2.14k | model_inp stringlengths 30 1.35k | function_frequency int64 1 176 | header_frequency int64 1 16.3k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
sl3XRn | iq | 2021-12-04T00:18:43 | // The MIT License
// Copyright © 2021 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
2083,
2158,
2208,
2208,
2236
] | [
[
1114,
1114,
1149,
1149,
1177
],
[
1179,
1179,
1249,
1249,
1462
],
[
1844,
1919,
1967,
1967,
2081
],
[
2083,
2158,
2208,
2208,
2236
],
[
2238,
2238,
2295,
2310,
3645
]
] | // https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
| float sdDisk( in vec2 p, in vec2 c, in float r )
{ |
return length(p-c)-r;
} | // https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
float sdDisk( in vec2 p, in vec2 c, in float r )
{ | 2 | 2 |
fslyWN | iq | 2022-01-13T20:22:00 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1321,
1401,
1451,
1463,
1819
] | [
[
1321,
1401,
1451,
1463,
1819
],
[
1821,
1821,
1878,
1914,
2798
]
] | // w is the width / distance from center to tip
// k is the number of rotations
| float sdSpiral( in vec2 p, float w, in float k )
{ |
const float kTau = 6.283185307;
float r = length(p);
float a = atan(p.y,p.x);
float n = floor( 0.5/w + (log2(r/w)*k-a)/kTau );
float ra = w*exp2((a+kTau*(min(n+0.0,0.0)-0.5))/k);
float rb = w*exp2((a+kTau*(min(n+1.0,0.0)-0.5))/k);
float d = min( abs(r-ra), abs(r-rb) );
// tip
retur... | // w is the width / distance from center to tip
// k is the number of rotations
float sdSpiral( in vec2 p, float w, in float k )
{ | 1 | 1 |
fsXcRN | ForestCSharp | 2022-01-09T21:20:20 | // Copyright (c) 2021 Felix Westin
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
... | mit | [
4459,
4524,
4556,
4643,
4769
] | [
[
1840,
1889,
1981,
1981,
2291
],
[
2292,
2292,
2345,
2345,
2423
],
[
2424,
2424,
2481,
2481,
2579
],
[
2581,
2641,
2675,
2675,
2726
],
[
2728,
2728,
2766,
2766,
2912
],
[
2914,
2969,
... | // Calculate a luminance transmittance value from optical depth.
| vec3 Absorb(vec3 opticalDepth)
{ |
return exp(-(opticalDepth.x * C_RAYLEIGH + opticalDepth.y * C_MIE * 1.1 + opticalDepth.z * C_OZONE) * ATMOSPHERE_DENSITY);
} | // Calculate a luminance transmittance value from optical depth.
vec3 Absorb(vec3 opticalDepth)
{ | 1 | 2 |
fsXcRN | ForestCSharp | 2022-01-09T21:20:20 | // Copyright (c) 2021 Felix Westin
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
... | mit | [
4771,
4951,
5078,
5331,
7210
] | [
[
1840,
1889,
1981,
1981,
2291
],
[
2292,
2292,
2345,
2345,
2423
],
[
2424,
2424,
2481,
2481,
2579
],
[
2581,
2641,
2675,
2675,
2726
],
[
2728,
2728,
2766,
2766,
2912
],
[
2914,
2969,
... | // Integrate scattering over a ray for a single directional light source.
// Also return the transmittance for the same ray as we are already calculating the optical depth anyway.
| vec3 IntegrateScattering(vec3 rayStart, vec3 rayDir, float rayLength, vec3 lightDir, vec3 lightColor, out vec3 transmittance)
{ |
float rayHeight = AtmosphereHeight(rayStart);
float sampleDistributionExponent = 1.0 + clamp(1.0 - rayHeight / ATMOSPHERE_HEIGHT, 0.0, 1.0) * 8.0; // Slightly arbitrary max exponent of 9
vec2 intersection = AtmosphereIntersection(rayStart, rayDir);
rayLength = min(rayLength, intersection.y);
if (intersection.x... | // Integrate scattering over a ray for a single directional light source.
// Also return the transmittance for the same ray as we are already calculating the optical depth anyway.
vec3 IntegrateScattering(vec3 rayStart, vec3 rayDir, float rayLength, vec3 lightDir, vec3 lightColor, out vec3 transmittance)
{ | 1 | 2 |
fsXcz4 | bjornornorn | 2022-01-09T19:43:30 | // Copyright(c) 2022 Björn Ottosson
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this softwareand associated documentation files(the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, d... | mit | [
1927,
2105,
2127,
2127,
2308
] | [
[
1927,
2105,
2127,
2127,
2308
],
[
2310,
2335,
2359,
2359,
2578
],
[
2580,
2580,
2614,
2614,
2639
],
[
2641,
2641,
2675,
2816,
3409
],
[
3411,
3411,
3431,
3431,
3692
],
[
3694,
3694,
... | // Origin: https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
// Using this since it was easy to differentiate, same technique would work for any curve
| vec3 s_curve(vec3 x)
{ |
float a = 2.51f;
float b = 0.03f;
float c = 2.43f;
float d = 0.59f;
float e = 0.14f;
x = max(x, 0.0);
return clamp((x*(a*x+b))/(x*(c*x+d)+e),0.0,1.0);
} | // Origin: https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
// Using this since it was easy to differentiate, same technique would work for any curve
vec3 s_curve(vec3 x)
{ | 2 | 2 |
fsXcz4 | bjornornorn | 2022-01-09T19:43:30 | // Copyright(c) 2022 Björn Ottosson
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this softwareand associated documentation files(the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, d... | mit | [
2310,
2335,
2359,
2359,
2578
] | [
[
1927,
2105,
2127,
2127,
2308
],
[
2310,
2335,
2359,
2359,
2578
],
[
2580,
2580,
2614,
2614,
2639
],
[
2641,
2641,
2675,
2816,
3409
],
[
3411,
3411,
3431,
3431,
3692
],
[
3694,
3694,
... | // derivative of s-curve
| vec3 d_s_curve(vec3 x)
{ |
float a = 2.51f;
float b = 0.03f;
float c = 2.43f;
float d = 0.59f;
float e = 0.14f;
x = max(x, 0.0);
vec3 r = (x*(c*x + d) + e);
return (a*x*(d*x + 2.0*e) + b*(e - c*x*x))/(r*r);
} | // derivative of s-curve
vec3 d_s_curve(vec3 x)
{ | 2 | 2 |
7lVXRt | iq | 2022-01-03T19:29:58 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1574,
1669,
1737,
1737,
2070
] | [
[
1574,
1669,
1737,
1737,
2070
],
[
2072,
2072,
2098,
2098,
2248
],
[
2250,
2295,
2382,
2382,
2641
],
[
2643,
2689,
2721,
2721,
2960
]
] | // ra = sphere's radius
// rb = small sphere's radius
// d = distance between the two spheres
| float sdDeathStar( in vec3 p2, in float ra, float rb, in float d )
{ |
vec2 p = vec2( p2.x, length(p2.yz) );
float a = (ra*ra - rb*rb + d*d)/(2.0*d);
float b = sqrt(max(ra*ra-a*a,0.0));
if( p.x*b-p.y*a > d*max(b-p.y,0.0) )
{
return length(p-vec2(a,b));
}
else
{
return max( (length(p )-ra),
-(length(p-vec2(d,0))-... | // ra = sphere's radius
// rb = small sphere's radius
// d = distance between the two spheres
float sdDeathStar( in vec3 p2, in float ra, float rb, in float d )
{ | 1 | 1 |
7tVXRt | iq | 2022-01-03T19:29:53 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1396,
1470,
1532,
1532,
1716
] | [
[
1396,
1470,
1532,
1532,
1716
],
[
1718,
1718,
1744,
1744,
1912
],
[
1914,
1959,
2046,
2046,
2304
],
[
2306,
2352,
2384,
2384,
2623
]
] | // r = sphere's radius
// h = cutting's plane's position
// t = thickness
| float sdCutHollowSphere( vec3 p, float r, float h, float t )
{ |
vec2 q = vec2( length(p.xz), p.y );
float w = sqrt(r*r-h*h);
return ((h*q.x<w*q.y) ? length(q-vec2(w,h)) :
abs(length(q)-r) ) - t;
} | // r = sphere's radius
// h = cutting's plane's position
// t = thickness
float sdCutHollowSphere( vec3 p, float r, float h, float t )
{ | 2 | 6 |
7tVXRt | iq | 2022-01-03T19:29:53 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1914,
1959,
2046,
2046,
2304
] | [
[
1396,
1470,
1532,
1532,
1716
],
[
1718,
1718,
1744,
1744,
1912
],
[
1914,
1959,
2046,
2046,
2304
],
[
2306,
2352,
2384,
2384,
2623
]
] | // https://iquilezles.org/articles/rmshadows
| float calcSoftshadow( in vec3 ro, in vec3 rd, float tmin, float tmax, const float k )
{ |
float res = 1.0;
float t = tmin;
for( int i=0; i<64; i++ )
{
float h = map( ro + rd*t );
res = min( res, k*h/t );
t += clamp( h, 0.01, 0.10 );
if( res<0.002 || t>tmax ) break;
}
return clamp( res, 0.0, 1.0 );
} | // https://iquilezles.org/articles/rmshadows
float calcSoftshadow( in vec3 ro, in vec3 rd, float tmin, float tmax, const float k )
{ | 1 | 10 |
stKSzc | iq | 2022-01-03T03:36:24 | // The MIT License
// Copyright © 2021 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1588,
1643,
1699,
1699,
1990
] | [
[
1588,
1643,
1699,
1699,
1990
],
[
1992,
1992,
2018,
2018,
2292
],
[
2294,
2340,
2372,
2372,
2611
]
] | // r is the sphere's radius, h is the plane's position
| float sdCutSphere( in vec3 p, in float r, in float h )
{ |
float w = sqrt(r*r-h*h); // constant for a given shape
vec2 q = vec2( length(p.xz), p.y );
float s = max( (h-r)*q.x*q.x+w*w*(h+r-2.0*q.y), h*q.x-w*q.y );
return (s<0.0) ? length(q)-r :
(q.x<w) ? h - q.y :
length(q-vec2(w,h));
} | // r is the sphere's radius, h is the plane's position
float sdCutSphere( in vec3 p, in float r, in float h )
{ | 1 | 2 |
stKSzc | iq | 2022-01-03T03:36:24 | // The MIT License
// Copyright © 2021 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
2294,
2340,
2372,
2372,
2611
] | [
[
1588,
1643,
1699,
1699,
1990
],
[
1992,
1992,
2018,
2018,
2292
],
[
2294,
2340,
2372,
2372,
2611
]
] | // https://iquilezles.org/articles/normalsSDF
| vec3 calcNormal( in vec3 pos )
{ |
vec2 e = vec2(1.0,-1.0)*0.5773;
const float eps = 0.0005;
return normalize( e.xyy*map( pos + e.xyy*eps ) +
e.yyx*map( pos + e.yyx*eps ) +
e.yxy*map( pos + e.yxy*eps ) +
e.xxx*map( pos + e.xxx*eps ) );
} | // https://iquilezles.org/articles/normalsSDF
vec3 calcNormal( in vec3 pos )
{ | 23 | 360 |
ftVXRc | iq | 2022-01-02T22:49:00 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1272,
1294,
1348,
1348,
1709
] | [
[
1272,
1294,
1348,
1348,
1709
],
[
1713,
1713,
1770,
1806,
2611
]
] | // r=radius, h=height
| float sdCutDisk( in vec2 p, in float r, in float h )
{ |
float w = sqrt(r*r-h*h); // constant for a given shape
p.x = abs(p.x);
// select circle or segment
float s = max( (h-r)*p.x*p.x+w*w*(h+r-2.0*p.y), h*p.x-w*p.y );
return (s<0.0) ? length(p)-r : // circle
(p.x<w) ? h - p.y : // segment line
... | // r=radius, h=height
float sdCutDisk( in vec2 p, in float r, in float h )
{ | 2 | 2 |
fdsBzs | spqr | 2022-02-26T10:52:06 | //CC0 1.0 Universal https://creativecommons.org/publicdomain/zero/1.0/
//To the extent possible under law, Blackle Mori has waived all copyright and related or neighboring rights to this work.
//returns a vector pointing in the direction of the closest neighbouring cell
#define saturate(a) (clamp((a),0.,1.))
mat2 ro... | cc0-1.0 | [
581,
602,
628,
628,
1030
] | [
[
313,
313,
331,
331,
404
],
[
514,
514,
537,
537,
579
],
[
581,
602,
628,
628,
1030
],
[
1032,
1091,
1112,
1112,
1312
],
[
1313,
1313,
1339,
1339,
1388
],
[
1392,
1392,
1422,
1422... | // 3d noise function
| float noise( in vec3 x )
{ |
vec3 p = floor(x);
vec3 f = fract(x);
f = f*f*(3.0-2.0*f);
float n = p.x + p.y*57.0 + 113.0*p.z;
float res = mix(mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x),
mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y),
mix(mix( hash(n+113.0), hash(n+114.0),f.x),
... | // 3d noise function
float noise( in vec3 x )
{ | 5 | 193 |
fdsBzs | spqr | 2022-02-26T10:52:06 | //CC0 1.0 Universal https://creativecommons.org/publicdomain/zero/1.0/
//To the extent possible under law, Blackle Mori has waived all copyright and related or neighboring rights to this work.
//returns a vector pointing in the direction of the closest neighbouring cell
#define saturate(a) (clamp((a),0.,1.))
mat2 ro... | cc0-1.0 | [
1032,
1091,
1112,
1112,
1312
] | [
[
313,
313,
331,
331,
404
],
[
514,
514,
537,
537,
579
],
[
581,
602,
628,
628,
1030
],
[
1032,
1091,
1112,
1112,
1312
],
[
1313,
1313,
1339,
1339,
1388
],
[
1392,
1392,
1422,
1422... | // fbm noise for 2-4 octaves including rotation per octave
| float fbm( vec3 p )
{ |
float f = 0.0;
f += 0.5000*noise( p );
p = m*p*2.02;
f += 0.2500*noise( p );
p = m*p*2.03;
f += 0.1250*noise( p );
p = m*p*2.01;
f += 0.0625*noise( p );
return f/0.9375;
} | // fbm noise for 2-4 octaves including rotation per octave
float fbm( vec3 p )
{ | 3 | 54 |
fdsBzs | spqr | 2022-02-26T10:52:06 | //CC0 1.0 Universal https://creativecommons.org/publicdomain/zero/1.0/
//To the extent possible under law, Blackle Mori has waived all copyright and related or neighboring rights to this work.
//returns a vector pointing in the direction of the closest neighbouring cell
#define saturate(a) (clamp((a),0.,1.))
mat2 ro... | cc0-1.0 | [
1887,
1906,
1929,
1929,
2044
] | [
[
313,
313,
331,
331,
404
],
[
514,
514,
537,
537,
579
],
[
581,
602,
628,
628,
1030
],
[
1032,
1091,
1112,
1112,
1312
],
[
1313,
1313,
1339,
1339,
1388
],
[
1392,
1392,
1422,
1422... | //value noise hash
| float hash31(vec3 p3)
{ |
p3 = fract(p3 * MOD3);
p3 += dot(p3, p3.yzx + 19.19);
return -1.0 + 2.0 * fract((p3.x + p3.y) * p3.z);
} | //value noise hash
float hash31(vec3 p3)
{ | 21 | 43 |
NdfBDl | jackakers13 | 2022-02-22T10:11:58 | // Created by Jack Akers on February 22, 2022.
// Made available under the CC0 license - https://creativecommons.org/publicdomain/zero/1.0/
void mainImage(out vec4 fragColor, in vec2 fragCoord)
{
// Spiral
vec2 center = vec2(iResolution.x/2.0, iResolution.y/2.0);
float dist = distance(center, fragCoord... | cc0-1.0 | [
0,
140,
195,
214,
746
] | [
[
0,
140,
195,
214,
746
]
] | // Created by Jack Akers on February 22, 2022.
// Made available under the CC0 license - https://creativecommons.org/publicdomain/zero/1.0/
| void mainImage(out vec4 fragColor, in vec2 fragCoord)
{ |
vec2 center = vec2(iResolution.x/2.0, iResolution.y/2.0);
float dist = distance(center, fragCoord);
float angle = atan(fragCoord.y - iResolution.y/2.0, fragCoord.x - iResolution.x/2.0);
float col = cos(0.25 * dist + angle + 4.0 * iTime);
// Fade
float distToEdge = distance(center, vec2(iRe... | // Created by Jack Akers on February 22, 2022.
// Made available under the CC0 license - https://creativecommons.org/publicdomain/zero/1.0/
void mainImage(out vec4 fragColor, in vec2 fragCoord)
{ | 1 | 901 |
NdsfW4 | mrange | 2022-02-14T20:37:08 | // License CC0: Into the techno dome
// A simple extension of "Follow the Light" I made earlier.
// The tunnel forks and the fork is picked randomly.
// Thought it turned out nice.
// Based on: https://www.shadertoy.com/view/XsBXWt
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME ... | cc0-1.0 | [
1282,
1342,
1364,
1364,
1412
] | [
[
1096,
1156,
1184,
1204,
1280
],
[
1282,
1342,
1364,
1364,
1412
],
[
1414,
1497,
1536,
1536,
1625
],
[
1627,
1627,
1657,
1657,
1685
],
[
1687,
1781,
1839,
1839,
2320
],
[
2322,
2392,
... | // License: Unknown, author: Unknown, found: don't remember
| float hash(float co) { |
return fract(sin(co*12.9898) * 13758.5453);
} | // License: Unknown, author: Unknown, found: don't remember
float hash(float co) { | 48 | 58 |
7sXfDH | mrange | 2022-02-13T22:28:54 | // License CC0: Follow the light
// Result after messing around on sunday night
// Based on an old favorite: https://www.shadertoy.com/view/XsBXWt
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), ... | cc0-1.0 | [
968,
1068,
1089,
1089,
1162
] | [
[
968,
1068,
1089,
1089,
1162
],
[
1163,
1263,
1285,
1285,
1334
],
[
1336,
1396,
1424,
1444,
1520
],
[
1522,
1605,
1644,
1644,
1733
],
[
1735,
1735,
1765,
1765,
1793
],
[
1795,
1889,
1... | // License: Unknown, author: nmz (twitter: @stormoid), found: https://www.shadertoy.com/view/NdfyRM
| float sRGB(float t) { | return mix(1.055*pow(t, 1./2.4) - 0.055, 12.92*t, step(t, 0.0031308)); } | // License: Unknown, author: nmz (twitter: @stormoid), found: https://www.shadertoy.com/view/NdfyRM
float sRGB(float t) { | 21 | 21 |
7sXfDH | mrange | 2022-02-13T22:28:54 | // License CC0: Follow the light
// Result after messing around on sunday night
// Based on an old favorite: https://www.shadertoy.com/view/XsBXWt
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), ... | cc0-1.0 | [
1163,
1263,
1285,
1285,
1334
] | [
[
968,
1068,
1089,
1089,
1162
],
[
1163,
1263,
1285,
1285,
1334
],
[
1336,
1396,
1424,
1444,
1520
],
[
1522,
1605,
1644,
1644,
1733
],
[
1735,
1735,
1765,
1765,
1793
],
[
1795,
1889,
1... | // License: Unknown, author: nmz (twitter: @stormoid), found: https://www.shadertoy.com/view/NdfyRM
| vec3 sRGB(in vec3 c) { | return vec3 (sRGB(c.x), sRGB(c.y), sRGB(c.z)); } | // License: Unknown, author: nmz (twitter: @stormoid), found: https://www.shadertoy.com/view/NdfyRM
vec3 sRGB(in vec3 c) { | 23 | 24 |
7sXfDH | mrange | 2022-02-13T22:28:54 | // License CC0: Follow the light
// Result after messing around on sunday night
// Based on an old favorite: https://www.shadertoy.com/view/XsBXWt
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), ... | cc0-1.0 | [
1522,
1605,
1644,
1644,
1733
] | [
[
968,
1068,
1089,
1089,
1162
],
[
1163,
1263,
1285,
1285,
1334
],
[
1336,
1396,
1424,
1444,
1520
],
[
1522,
1605,
1644,
1644,
1733
],
[
1735,
1735,
1765,
1765,
1793
],
[
1795,
1889,
1... | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/articles/smin
| float pmin(float a, float b, float k) { |
float h = clamp( 0.5+0.5*(b-a)/k, 0.0, 1.0 );
return mix( b, a, h ) - k*h*(1.0-h);
} | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/articles/smin
float pmin(float a, float b, float k) { | 22 | 107 |
7sXfDH | mrange | 2022-02-13T22:28:54 | // License CC0: Follow the light
// Result after messing around on sunday night
// Based on an old favorite: https://www.shadertoy.com/view/XsBXWt
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), ... | cc0-1.0 | [
1795,
1889,
1947,
1947,
2428
] | [
[
968,
1068,
1089,
1089,
1162
],
[
1163,
1263,
1285,
1285,
1334
],
[
1336,
1396,
1424,
1444,
1520
],
[
1522,
1605,
1644,
1644,
1733
],
[
1735,
1735,
1765,
1765,
1793
],
[
1795,
1889,
1... | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/articles/spherefunctions
| float sphered(vec3 ro, vec3 rd, vec4 sph, float dbuffer) { |
float ndbuffer = dbuffer/sph.w;
vec3 rc = (ro - sph.xyz)/sph.w;
float b = dot(rd,rc);
float c = dot(rc,rc) - 1.0;
float h = b*b - c;
if( h<0.0 ) return 0.0;
h = sqrt( h );
float t1 = -b - h;
float t2 = -b + h;
if( t2<0.0 || t1>ndbuffer ) return 0.0;
t1 = max( t1, 0.0 );... | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/articles/spherefunctions
float sphered(vec3 ro, vec3 rd, vec4 sph, float dbuffer) { | 8 | 11 |
7sXfDH | mrange | 2022-02-13T22:28:54 | // License CC0: Follow the light
// Result after messing around on sunday night
// Based on an old favorite: https://www.shadertoy.com/view/XsBXWt
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), ... | cc0-1.0 | [
2430,
2500,
2522,
2522,
2661
] | [
[
968,
1068,
1089,
1089,
1162
],
[
1163,
1263,
1285,
1285,
1334
],
[
1336,
1396,
1424,
1444,
1520
],
[
1522,
1605,
1644,
1644,
1733
],
[
1735,
1735,
1765,
1765,
1793
],
[
1795,
1889,
1... | // "Amazing Surface" fractal
// https://www.shadertoy.com/view/XsBXWt
| vec4 formula(vec4 p) { |
p.xz = abs(p.xz+1.)-abs(p.xz-1.)-p.xz;
p.y-=.25;
p.xy*=ROT(radians(30.0));
p=p*2.0/clamp(dot(p.xyz,p.xyz),0.24,1.0);
return p;
} | // "Amazing Surface" fractal
// https://www.shadertoy.com/view/XsBXWt
vec4 formula(vec4 p) { | 2 | 9 |
flXyRS | iq | 2022-03-24T18:04:15 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1614,
1731,
1768,
1768,
1903
] | [
[
1614,
1731,
1768,
1768,
1903
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .w = ∂f(p)/∂z
// .yzw = ∇f(p) with ‖∇f(p)‖ = 1
| vec4 sdgEllipsoid( vec3 p, vec3 r )
{ |
p /= r; float k0 = sqrt(dot(p,p));
p /= r; float k1 = inversesqrt(dot(p,p));
return vec4( k0*(k0-1.0)*k1, p*k1 );
} | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .w = ∂f(p)/∂z
// .yzw = ∇f(p) with ‖∇f(p)‖ = 1
vec4 sdgEllipsoid( vec3 p, vec3 r )
{ | 1 | 1 |
7sSfRG | mrange | 2022-03-05T20:35:21 | // License CC0: Voronoi Glass Panes
// Tinkering with the voronoi pattern from a Shane shader on saturday evening
// Kind of hackish overall but that never stopped me from sharing a shader before
// Shane shader, it's worth a look: https://www.shadertoy.com/view/Mld3Rn
#define RESOLUTION iResolution
#define TIME ... | cc0-1.0 | [
1743,
1803,
1843,
1843,
2002
] | [
[
575,
675,
696,
696,
769
],
[
770,
870,
892,
892,
941
],
[
1095,
1095,
1117,
1117,
1263
],
[
1617,
1617,
1645,
1665,
1741
],
[
1743,
1803,
1843,
1843,
2002
],
[
2004,
2064,
2104,
... | // License: Unknown, author: Unknown, found: don't remember
| vec4 alphaBlend(vec4 back, vec4 front) { |
float w = front.w + back.w*(1.0-front.w);
vec3 xyz = (front.xyz*front.w + back.xyz*back.w*(1.0-front.w))/w;
return w > 0.0 ? vec4(xyz, w) : vec4(0.0);
} | // License: Unknown, author: Unknown, found: don't remember
vec4 alphaBlend(vec4 back, vec4 front) { | 16 | 18 |
7sSfRG | mrange | 2022-03-05T20:35:21 | // License CC0: Voronoi Glass Panes
// Tinkering with the voronoi pattern from a Shane shader on saturday evening
// Kind of hackish overall but that never stopped me from sharing a shader before
// Shane shader, it's worth a look: https://www.shadertoy.com/view/Mld3Rn
#define RESOLUTION iResolution
#define TIME ... | cc0-1.0 | [
2004,
2064,
2104,
2104,
2146
] | [
[
575,
675,
696,
696,
769
],
[
770,
870,
892,
892,
941
],
[
1095,
1095,
1117,
1117,
1263
],
[
1617,
1617,
1645,
1665,
1741
],
[
1743,
1803,
1843,
1843,
2002
],
[
2004,
2064,
2104,
... | // License: Unknown, author: Unknown, found: don't remember
| vec3 alphaBlend(vec3 back, vec4 front) { |
return mix(back, front.xyz, front.w);
} | // License: Unknown, author: Unknown, found: don't remember
vec3 alphaBlend(vec3 back, vec4 front) { | 20 | 22 |
7sSfRG | mrange | 2022-03-05T20:35:21 | // License CC0: Voronoi Glass Panes
// Tinkering with the voronoi pattern from a Shane shader on saturday evening
// Kind of hackish overall but that never stopped me from sharing a shader before
// Shane shader, it's worth a look: https://www.shadertoy.com/view/Mld3Rn
#define RESOLUTION iResolution
#define TIME ... | cc0-1.0 | [
2416,
2510,
2539,
2539,
2726
] | [
[
575,
675,
696,
696,
769
],
[
770,
870,
892,
892,
941
],
[
1095,
1095,
1117,
1117,
1263
],
[
1617,
1617,
1645,
1665,
1741
],
[
1743,
1803,
1843,
1843,
2002
],
[
2004,
2064,
2104,
... | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/articles/distfunctions2d
| float hex(vec2 p, float r ) { |
const vec3 k = 0.5*vec3(-sqrt(3.0), 1.0, sqrt(4.0/3.0));
p = abs(p);
p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;
p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);
return length(p)*sign(p.y);
} | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/articles/distfunctions2d
float hex(vec2 p, float r ) { | 1 | 2 |
flXBzB | blackle | 2022-04-27T02:22:16 | //excluding the function cubicRoot:
//CC0 1.0 Universal https://creativecommons.org/publicdomain/zero/1.0/
//To the extent possible under law, Blackle Mori has waived all copyright and related or neighboring rights to this work.
//this works by exploiting the fact that there exist polynomials T_n
//such that T_n(cos(x... | cc0-1.0 | [
1568,
1780,
1817,
1817,
2078
] | [
[
1568,
1780,
1817,
1817,
2078
],
[
2080,
2080,
2111,
2142,
2399
],
[
2401,
2401,
2436,
2436,
3701
],
[
3703,
3703,
3732,
3732,
4057
],
[
4059,
4059,
4116,
4116,
4877
]
] | // of equation x^3+c1*x+c2=0
/* Stolen from http://perso.ens-lyon.fr/christophe.winisdoerffer/INTRO_NUM/NumericalRecipesinF77.pdf,
page 179 */
// subsequently stolen from https://www.shadertoy.com/view/MdfSDn
| float cubicRoot(float c1, float c2) { |
float q = -c1/3.;
float r = c2/2.;
float q3_r2 = q*q*q - r*r;
if(q3_r2 < 0.) {
float a = -sign(r)*pow(abs(r)+sqrt(-q3_r2),.333333);
float b = a == 0. ? 0. : q/a;
return a+b;
}
float theta = acos(r/pow(q,1.5));
return -2.*pow(q,.5)*cos(theta/3.);
} | // of equation x^3+c1*x+c2=0
/* Stolen from http://perso.ens-lyon.fr/christophe.winisdoerffer/INTRO_NUM/NumericalRecipesinF77.pdf,
page 179 */
// subsequently stolen from https://www.shadertoy.com/view/MdfSDn
float cubicRoot(float c1, float c2) { | 1 | 3 |
stBcW1 | mrange | 2022-04-10T14:31:46 | // License CC0: Stars and galaxy
// Bit of sunday tinkering lead to stars and a galaxy
// Didn't turn out as I envisioned but it turned out to something
// that I liked so sharing it.
// Controls how many layers of stars
#define LAYERS 5.0
#define PI 3.141592654
#define TAU (2.... | cc0-1.0 | [
877,
984,
1010,
1010,
1194
] | [
[
509,
609,
630,
630,
703
],
[
704,
804,
826,
826,
875
],
[
877,
984,
1010,
1010,
1194
],
[
1196,
1256,
1284,
1350,
1426
],
[
1581,
1581,
1603,
1603,
1749
],
[
1751,
1837,
1873,
18... | // License: Unknown, author: Matt Taylor (https://github.com/64), found: https://64.github.io/tonemapping/
| vec3 aces_approx(vec3 v) { |
v = max(v, 0.0);
v *= 0.6f;
float a = 2.51f;
float b = 0.03f;
float c = 2.43f;
float d = 0.59f;
float e = 0.14f;
return clamp((v*(a*v+b))/(v*(c*v+d)+e), 0.0f, 1.0f);
} | // License: Unknown, author: Matt Taylor (https://github.com/64), found: https://64.github.io/tonemapping/
vec3 aces_approx(vec3 v) { | 72 | 77 |
stBcW1 | mrange | 2022-04-10T14:31:46 | // License CC0: Stars and galaxy
// Bit of sunday tinkering lead to stars and a galaxy
// Didn't turn out as I envisioned but it turned out to something
// that I liked so sharing it.
// Controls how many layers of stars
#define LAYERS 5.0
#define PI 3.141592654
#define TAU (2.... | cc0-1.0 | [
1969,
2029,
2049,
2049,
2161
] | [
[
509,
609,
630,
630,
703
],
[
704,
804,
826,
826,
875
],
[
877,
984,
1010,
1010,
1194
],
[
1196,
1256,
1284,
1350,
1426
],
[
1581,
1581,
1603,
1603,
1749
],
[
1751,
1837,
1873,
18... | // License: Unknown, author: Unknown, found: don't remember
| vec2 hash2(vec2 p) { |
p = vec2(dot (p, vec2 (127.1, 311.7)), dot (p, vec2 (269.5, 183.3)));
return fract(sin(p)*43758.5453123);
} | // License: Unknown, author: Unknown, found: don't remember
vec2 hash2(vec2 p) { | 6 | 24 |
stBcW1 | mrange | 2022-04-10T14:31:46 | // License CC0: Stars and galaxy
// Bit of sunday tinkering lead to stars and a galaxy
// Didn't turn out as I envisioned but it turned out to something
// that I liked so sharing it.
// Controls how many layers of stars
#define LAYERS 5.0
#define PI 3.141592654
#define TAU (2.... | cc0-1.0 | [
2354,
2492,
2520,
2520,
2832
] | [
[
509,
609,
630,
630,
703
],
[
704,
804,
826,
826,
875
],
[
877,
984,
1010,
1010,
1194
],
[
1196,
1256,
1284,
1350,
1426
],
[
1581,
1581,
1603,
1603,
1749
],
[
1751,
1837,
1873,
18... | // License: CC BY-NC-SA 3.0, author: Stephane Cuillerdier - Aiekick/2015 (twitter:@aiekick), found: https://www.shadertoy.com/view/Mt3GW2
| vec3 blackbody(float Temp) { |
vec3 col = vec3(255.);
col.x = 56100000. * pow(Temp,(-3. / 2.)) + 148.;
col.y = 100.04 * log(Temp) - 623.6;
if (Temp > 6500.) col.y = 35200000. * pow(Temp,(-3. / 2.)) + 184.;
col.z = 194.18 * log(Temp) - 1448.6;
col = clamp(col, 0., 255.)/255.;
if (Temp < 1000.) col *= Temp/1000.;
return col;
} | // License: CC BY-NC-SA 3.0, author: Stephane Cuillerdier - Aiekick/2015 (twitter:@aiekick), found: https://www.shadertoy.com/view/Mt3GW2
vec3 blackbody(float Temp) { | 2 | 3 |
stBcW1 | mrange | 2022-04-10T14:31:46 | // License CC0: Stars and galaxy
// Bit of sunday tinkering lead to stars and a galaxy
// Didn't turn out as I envisioned but it turned out to something
// that I liked so sharing it.
// Controls how many layers of stars
#define LAYERS 5.0
#define PI 3.141592654
#define TAU (2.... | cc0-1.0 | [
2835,
2919,
2940,
3032,
3436
] | [
[
509,
609,
630,
630,
703
],
[
704,
804,
826,
826,
875
],
[
877,
984,
1010,
1010,
1194
],
[
1196,
1256,
1284,
1350,
1426
],
[
1581,
1581,
1603,
1603,
1749
],
[
1751,
1837,
1873,
18... | // License: MIT, author: Inigo Quilez, found: https://www.shadertoy.com/view/XslGRr
| float noise(vec2 p) { |
vec2 i = floor(p);
vec2 f = fract(p);
vec2 u = f*f*(3.-2.*f);
float n =
mix( mix( dot(shash2(i + vec2(0.,0.) ), f - vec2(0.,0.)),
dot(shash2(i + vec2(1.,0.) ), f - vec2(1.,0.)), u.x),
mix( dot(shash2(i + vec2(0.,1.) ), f - vec2(0.,1.)),
dot(shas... | // License: MIT, author: Inigo Quilez, found: https://www.shadertoy.com/view/XslGRr
float noise(vec2 p) { | 1 | 66 |
stBcW1 | mrange | 2022-04-10T14:31:46 | // License CC0: Stars and galaxy
// Bit of sunday tinkering lead to stars and a galaxy
// Didn't turn out as I envisioned but it turned out to something
// that I liked so sharing it.
// Controls how many layers of stars
#define LAYERS 5.0
#define PI 3.141592654
#define TAU (2.... | cc0-1.0 | [
4645,
4739,
4783,
4783,
4981
] | [
[
509,
609,
630,
630,
703
],
[
704,
804,
826,
826,
875
],
[
877,
984,
1010,
1010,
1194
],
[
1196,
1256,
1284,
1350,
1426
],
[
1581,
1581,
1603,
1603,
1749
],
[
1751,
1837,
1873,
18... | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/articles/spherefunctions
| vec2 raySphere(vec3 ro, vec3 rd, vec4 sph) { |
vec3 oc = ro - sph.xyz;
float b = dot( oc, rd );
float c = dot( oc, oc ) - sph.w*sph.w;
float h = b*b - c;
if( h<0.0 ) return vec2(-1.0);
h = sqrt( h );
return vec2(-b - h, -b + h);
} | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/articles/spherefunctions
vec2 raySphere(vec3 ro, vec3 rd, vec4 sph) { | 2 | 11 |
fs3yDM | iq | 2022-05-25T18:16:32 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1454,
1549,
1583,
1601,
2412
] | [
[
1454,
1549,
1583,
1601,
2412
],
[
2414,
2414,
2459,
2459,
2524
],
[
2526,
2526,
2583,
2619,
3613
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdSquircle(vec2 p, float n)
{ |
vec2 k = sign(p); p = abs(p);
bool m = p.y>p.x; if( m ) p=p.yx;
const int num = 16; // tesselate into 8x16=128 segments, more denselly at the corners
float s = 1.0;
float d = 1e20;
vec2 oq = vec2(1.0,0.0);
vec2 g = vec2(0.0,0.0);
for( int i=1; i<=num; i++ )
{
float h = ... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdSquircle(vec2 p, float n)
{ | 1 | 1 |
7tBfD3 | iq | 2022-05-17T20:22:30 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1819,
1858,
1892,
1892,
2519
] | [
[
1261,
1261,
1296,
1296,
1339
],
[
1340,
1340,
1375,
1375,
1402
],
[
1403,
1403,
1438,
1438,
1457
],
[
1458,
1458,
1493,
1493,
1520
],
[
1522,
1522,
1558,
1558,
1665
],
[
1666,
1666,
... | // generalization of Devil's Staircase
| float cantor( float x, float t )
{ |
float y = 0.0;
float sc = 0.5;
float bi = 0.0;
float xa = 0.0;
float xb = 1.0;
for( int i=0; i<9; i++ )
{
// choose subdivision intervals
float ya = function(xa,t);
float yb = function(xb,t);
float wa = inverse_function(ya+(yb-ya)/3.0,t);
float wb = i... | // generalization of Devil's Staircase
float cantor( float x, float t )
{ | 1 | 1 |
7tBfD3 | iq | 2022-05-17T20:22:30 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
2521,
2573,
2622,
2622,
2710
] | [
[
1261,
1261,
1296,
1296,
1339
],
[
1340,
1340,
1375,
1375,
1402
],
[
1403,
1403,
1438,
1438,
1457
],
[
1458,
1458,
1493,
1493,
1520
],
[
1522,
1522,
1558,
1558,
1665
],
[
1666,
1666,
... | // https://iquilezles.org/articles/distfunctions2d/
| float sdLine( in vec2 p, in vec2 a, in vec2 b )
{ |
vec2 pa = p-a, ba = b-a;
return length(pa-ba*clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0));
} | // https://iquilezles.org/articles/distfunctions2d/
float sdLine( in vec2 p, in vec2 a, in vec2 b )
{ | 1 | 23 |
NljfzV | morimea | 2022-05-13T15:35:20 |
// Created by Danil (2022+) https://github.com/danilw
// License - CC0 or use as you wish
// main point of this shader is - fractal that generate different image depends of parameters
// look map function
// to play with parameters and use Mouse control, 5 is index in arrays below that size of psz
//#define use_f... | cc0-1.0 | [
929,
950,
981,
981,
1259
] | [
[
929,
950,
981,
981,
1259
],
[
1300,
1300,
1365,
1365,
1992
],
[
1994,
1994,
2032,
2032,
2425
],
[
2478,
2478,
2540,
2540,
3740
],
[
4033,
4033,
4089,
4089,
7984
],
[
7987,
7987,
8021... | // main fractal func
| float map(in vec3 p, int idx) { |
float res = 0.;
vec3 c = p;
for (int i = 0; i < clamp(p5[idx],1,30); ++i) {
p =p0[idx]*abs(p)/max(dot(p,p+p2[idx]*p/(p+0.0001*(1.-abs(sign(p))))),0.0001) + p1[idx];
p=p.zxy;
res += exp(-33. * abs(dot(p,p3[idx]*c)));
}
return res;
} | // main fractal func
float map(in vec3 p, int idx) { | 1 | 1 |
sstfzM | mrange | 2022-06-26T19:12:30 | // License CC0 - Complex atanh - darkmode edition
// More work tinkering based on mlas shader Complex atanh - https://www.shadertoy.com/view/tsBXRW
#define DARKMODE
#define FASTATAN
#define RESOLUTION iResolution
#define TIME iTime
#define PI 3.141592654
#define PI_2 (0.5*PI)
#define TAU ... | cc0-1.0 | [
1534,
1620,
1657,
1657,
1764
] | [
[
621,
621,
643,
643,
789
],
[
1084,
1170,
1206,
1206,
1300
],
[
1302,
1362,
1390,
1456,
1532
],
[
1534,
1620,
1657,
1657,
1764
],
[
1766,
1879,
1906,
1906,
1958
],
[
1960,
1960,
1979,... | // License: MIT, author: Pascal Gilcher, found: https://www.shadertoy.com/view/flSXRV
| float atan_approx(float y, float x) { |
float cosatan2 = x / (abs(x) + abs(y));
float t = PI_2 - cosatan2 * PI_2;
return y < 0.0 ? -t : t;
} | // License: MIT, author: Pascal Gilcher, found: https://www.shadertoy.com/view/flSXRV
float atan_approx(float y, float x) { | 14 | 14 |
sstfzM | mrange | 2022-06-26T19:12:30 | // License CC0 - Complex atanh - darkmode edition
// More work tinkering based on mlas shader Complex atanh - https://www.shadertoy.com/view/tsBXRW
#define DARKMODE
#define FASTATAN
#define RESOLUTION iResolution
#define TIME iTime
#define PI 3.141592654
#define PI_2 (0.5*PI)
#define TAU ... | cc0-1.0 | [
1766,
1879,
1906,
1906,
1958
] | [
[
621,
621,
643,
643,
789
],
[
1084,
1170,
1206,
1206,
1300
],
[
1302,
1362,
1390,
1456,
1532
],
[
1534,
1620,
1657,
1657,
1764
],
[
1766,
1879,
1906,
1906,
1958
],
[
1960,
1960,
1979,... | // Complex trig functions found at: Complex Atanh - https://www.shadertoy.com/view/tsBXRW
// A very cool shader
| vec2 cmul(vec2 z, vec2 w) { |
return vec2 (z.x*w.x-z.y*w.y, z.x*w.y+z.y*w.x);
} | // Complex trig functions found at: Complex Atanh - https://www.shadertoy.com/view/tsBXRW
// A very cool shader
vec2 cmul(vec2 z, vec2 w) { | 1 | 12 |
sstfzM | mrange | 2022-06-26T19:12:30 | // License CC0 - Complex atanh - darkmode edition
// More work tinkering based on mlas shader Complex atanh - https://www.shadertoy.com/view/tsBXRW
#define DARKMODE
#define FASTATAN
#define RESOLUTION iResolution
#define TIME iTime
#define PI 3.141592654
#define PI_2 (0.5*PI)
#define TAU ... | cc0-1.0 | [
2172,
2203,
2224,
2224,
2276
] | [
[
621,
621,
643,
643,
789
],
[
1084,
1170,
1206,
1206,
1300
],
[
1302,
1362,
1390,
1456,
1532
],
[
1534,
1620,
1657,
1657,
1764
],
[
1766,
1879,
1906,
1906,
1958
],
[
1960,
1960,
1979,... | // Inverse hyperbolic tangent
| vec2 catanh(vec2 z) { |
return 0.5*clog(cdiv(vec2(1,0)+z,vec2(1,0)-z));
} | // Inverse hyperbolic tangent
vec2 catanh(vec2 z) { | 4 | 4 |
sstfzM | mrange | 2022-06-26T19:12:30 | // License CC0 - Complex atanh - darkmode edition
// More work tinkering based on mlas shader Complex atanh - https://www.shadertoy.com/view/tsBXRW
#define DARKMODE
#define FASTATAN
#define RESOLUTION iResolution
#define TIME iTime
#define PI 3.141592654
#define PI_2 (0.5*PI)
#define TAU ... | cc0-1.0 | [
2278,
2308,
2327,
2327,
2388
] | [
[
621,
621,
643,
643,
789
],
[
1084,
1170,
1206,
1206,
1300
],
[
1302,
1362,
1390,
1456,
1532
],
[
1534,
1620,
1657,
1657,
1764
],
[
1766,
1879,
1906,
1906,
1958
],
[
1960,
1960,
1979,... | // My own attempt at an ctanh
| vec2 cexp(vec2 z) { |
float r = exp(z.x);
return r*vec2(cos(z.y), sin(z.y));
} | // My own attempt at an ctanh
vec2 cexp(vec2 z) { | 2 | 6 |
sddfR4 | mrange | 2022-06-25T12:12:31 | // License CC0: More Complex Atanh
// Inspired by: Complex Atanh - https://www.shadertoy.com/view/tsBXRW
// I always thought Complex Atanh by mla was very cool
// I tinkered a bit with it on saturday morning and got something
// I think is different enough to share
#define RESOLUTION iResolution
#define TIME ... | cc0-1.0 | [
1607,
1721,
1748,
1748,
1779
] | [
[
603,
603,
625,
625,
771
],
[
1066,
1152,
1188,
1188,
1282
],
[
1284,
1284,
1316,
1316,
1373
],
[
1375,
1435,
1463,
1529,
1605
],
[
1607,
1721,
1748,
1748,
1779
],
[
1781,
1781,
1800,... | // Complex trig functions found at: Complex Atanh - https://www.shadertoy.com/view/sl3XW7
// A very cool shader
| vec2 cmul(vec2 z, vec2 w) { |
return mat2(z,-z.y,z.x)*w;
} | // Complex trig functions found at: Complex Atanh - https://www.shadertoy.com/view/sl3XW7
// A very cool shader
vec2 cmul(vec2 z, vec2 w) { | 3 | 12 |
sddfR4 | mrange | 2022-06-25T12:12:31 | // License CC0: More Complex Atanh
// Inspired by: Complex Atanh - https://www.shadertoy.com/view/tsBXRW
// I always thought Complex Atanh by mla was very cool
// I tinkered a bit with it on saturday morning and got something
// I think is different enough to share
#define RESOLUTION iResolution
#define TIME ... | cc0-1.0 | [
2068,
2097,
2116,
2116,
2177
] | [
[
603,
603,
625,
625,
771
],
[
1066,
1152,
1188,
1188,
1282
],
[
1284,
1284,
1316,
1316,
1373
],
[
1375,
1435,
1463,
1529,
1605
],
[
1607,
1721,
1748,
1748,
1779
],
[
1781,
1781,
1800,... | // My own attempt at a ctanh
| vec2 cexp(vec2 z) { |
float r = exp(z.x);
return r*vec2(cos(z.y), sin(z.y));
} | // My own attempt at a ctanh
vec2 cexp(vec2 z) { | 2 | 6 |
fddfRn | gehtsiegarnixan | 2022-06-23T09:30:54 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
2236,
2379,
2428,
2466,
2635
] | [
[
2236,
2379,
2428,
2466,
2635
],
[
2637,
2686,
2710,
2710,
2957
],
[
3237,
3267,
3299,
3299,
3707
],
[
3709,
3759,
3819,
3819,
4023
],
[
4025,
4104,
4160,
4160,
5106
],
[
5108,
5183,
... | // Increases the steepness of Alpha while preserving 0-1 range and 1 sum
// See 2 value example (https://www.desmos.com/calculator/dpxa6mytnv)
| vec4 smoothContrast(vec4 alpha, float contrast) { |
vec4 powAlpha = pow(alpha, vec4(contrast));
// normalize back to precentage of 1
return powAlpha/(powAlpha.x + powAlpha.y + powAlpha.z + powAlpha.w);
} | // Increases the steepness of Alpha while preserving 0-1 range and 1 sum
// See 2 value example (https://www.desmos.com/calculator/dpxa6mytnv)
vec4 smoothContrast(vec4 alpha, float contrast) { | 2 | 2 |
fddfRn | gehtsiegarnixan | 2022-06-23T09:30:54 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
2637,
2686,
2710,
2710,
2957
] | [
[
2236,
2379,
2428,
2466,
2635
],
[
2637,
2686,
2710,
2710,
2957
],
[
3237,
3267,
3299,
3299,
3707
],
[
3709,
3759,
3819,
3819,
4023
],
[
4025,
4104,
4160,
4160,
5106
],
[
5108,
5183,
... | //Distance from the Edge of Rhombic Dodecahedron
| float rhomDist(vec3 p) { |
vec3 hra = vec3(0.5, 0.5, half_sqrt2); //vector to Diagonal Edge
p = abs(p);
float pBC = max(p.x,p.y); //rigt and top edge
float pABC = max(dot(p, hra),pBC); //diagonal edge
//optional 0-1 range
return (.5-pABC)*2.;
} | //Distance from the Edge of Rhombic Dodecahedron
float rhomDist(vec3 p) { | 2 | 2 |
fddfRn | gehtsiegarnixan | 2022-06-23T09:30:54 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
3237,
3267,
3299,
3299,
3707
] | [
[
2236,
2379,
2428,
2466,
2635
],
[
2637,
2686,
2710,
2710,
2957
],
[
3237,
3267,
3299,
3299,
3707
],
[
3709,
3759,
3819,
3819,
4023
],
[
4025,
4104,
4160,
4160,
5106
],
[
5108,
5183,
... | //Rhombic Dodecahedron Tiling
| tilingVal3D rohmTile(vec3 uvw) { |
vec3 r = vec3(1.0,1.0,sqrt2);
vec3 h = r*.5;
vec3 a = mod(uvw, r)-h;
vec3 b = mod(uvw-h,r)-h;
vec3 gvw = dot(a, a) < dot(b,b) ? a : b; //center rhom uvw
float edist = rhomDist(gvw); //Edge distance with range 0-1
//float cdist = dot(gvw, gvw); // squared distance with range 0-1
ve... | //Rhombic Dodecahedron Tiling
tilingVal3D rohmTile(vec3 uvw) { | 2 | 2 |
fddfRn | gehtsiegarnixan | 2022-06-23T09:30:54 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
3709,
3759,
3819,
3819,
4023
] | [
[
2236,
2379,
2428,
2466,
2635
],
[
2637,
2686,
2710,
2710,
2957
],
[
3237,
3267,
3299,
3299,
3707
],
[
3709,
3759,
3819,
3819,
4023
],
[
4025,
4104,
4160,
4160,
5106
],
[
5108,
5183,
... | // scaled with offset Rhombic Dodecahedron tiling
| tilingVal3D rohmCell(vec3 uvw, vec3 offset, float gridRes) { |
tilingVal3D rohmTiling = rohmTile(uvw*gridRes + offset);
vec3 tiledUV = (rohmTiling.id - offset)/gridRes; //rohm pixaltion
return tilingVal3D(rohmTiling.grid, tiledUV,rohmTiling.alpha);
} | // scaled with offset Rhombic Dodecahedron tiling
tilingVal3D rohmCell(vec3 uvw, vec3 offset, float gridRes) { | 2 | 2 |
fddfRn | gehtsiegarnixan | 2022-06-23T09:30:54 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
4025,
4104,
4160,
4160,
5106
] | [
[
2236,
2379,
2428,
2466,
2635
],
[
2637,
2686,
2710,
2710,
2957
],
[
3237,
3267,
3299,
3299,
3707
],
[
3709,
3759,
3819,
3819,
4023
],
[
4025,
4104,
4160,
4160,
5106
],
[
5108,
5183,
... | // 4 Rhombic Dodecahedron tiles offset so their edges get hidden by each other
| vec3 quadGrid(vec3 uvw, float gridRes, float contrast) { |
tilingVal3D a = rohmCell(uvw, vec3( .0, .0, .0), gridRes);
tilingVal3D b = rohmCell(uvw, vec3( .5, .0, qurt_sqrt2), gridRes);
tilingVal3D c = rohmCell(uvw, vec3( .0, .5, qurt_sqrt2), gridRes);
tilingVal3D d = rohmCell(uvw, vec3( .0, .0, half_sqrt2), gridRes);
// increase contrast
vec4 alpha... | // 4 Rhombic Dodecahedron tiles offset so their edges get hidden by each other
vec3 quadGrid(vec3 uvw, float gridRes, float contrast) { | 1 | 1 |
sdKcWt | gehtsiegarnixan | 2022-06-22T15:20:36 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
1880,
1915,
1938,
1938,
2168
] | [
[
1880,
1915,
1938,
1938,
2168
],
[
2170,
2210,
2230,
2230,
2675
],
[
2677,
2752,
2781,
2918,
3339
],
[
3341,
3341,
3398,
3398,
4035
]
] | //Icosahedron Distance from Center
| float IcoDist(vec3 p) { |
p = abs(p);
float pAB = max(dot(p, hrA),dot(p, hrB));
float pCD = max(dot(p, hrC),dot(p, hrD));
float dist = max(pAB,pCD);
// optional makes it 0-1 inside, and negative outside
return (.5-dist)*2.;
} | //Icosahedron Distance from Center
float IcoDist(vec3 p) { | 1 | 1 |
sdKcWt | gehtsiegarnixan | 2022-06-22T15:20:36 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
2170,
2210,
2230,
2230,
2675
] | [
[
1880,
1915,
1938,
1938,
2168
],
[
2170,
2210,
2230,
2230,
2675
],
[
2677,
2752,
2781,
2918,
3339
],
[
3341,
3341,
3398,
3398,
4035
]
] | // makes Cool colormap with polynimal 6
| vec3 Cool(float t) { |
const vec3 c0 = vec3(-0.000941,1.000941,1.000000);
const vec3 c1 = vec3(1.001170,-1.001170,-0.000000);
const vec3 c2 = vec3(0.004744,-0.004748,0.000001);
const vec3 c3 = vec3(-0.011841,0.011841,-0.000005);
const vec3 c4 = vec3(0.012964,-0.012943,0.000009);
const vec3 c5 = vec3(-0.005110,0.00507... | // makes Cool colormap with polynimal 6
vec3 Cool(float t) { | 1 | 1 |
sdKcWt | gehtsiegarnixan | 2022-06-22T15:20:36 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
2677,
2752,
2781,
2918,
3339
] | [
[
1880,
1915,
1938,
1938,
2168
],
[
2170,
2210,
2230,
2230,
2675
],
[
2677,
2752,
2781,
2918,
3339
],
[
3341,
3341,
3398,
3398,
4035
]
] | // rotates a vetor from SirBelfer4 (https://www.shadertoy.com/view/ssc3z4)
| vec3 rotate(vec3 v, vec3 a)
{ |
vec4 q;
vec3 c = cos(a * 0.5), s = sin(a * 0.5);
q.x = s.x * c.y * c.z - c.x * s.y * s.z;
q.y = c.x * s.y * c.z + s.x * c.y * s.z;
q.z = c.x * c.y * s.z - s.x * s.y * c.z;
q.w = c.x * c.y * c.z + s.x * s.y * s.z;
// https://blog.molecular-matters.com/2013/05/24/a-faster-quaternion-vect... | // rotates a vetor from SirBelfer4 (https://www.shadertoy.com/view/ssc3z4)
vec3 rotate(vec3 v, vec3 a)
{ | 4 | 4 |
sdVyWt | mrange | 2022-06-21T21:32:43 | // License CC0: Mandelbrot variation
// Tinkered with julia mapping. Not amazing but different enough to share.
#define RESOLUTION iResolution
#define TIME iTime
// License: Unknown, author: Unknown, found: don't remember
float hash(vec2 co) {
return fract(sin(dot(co.xy ,vec2(12.9898,58.233))) * 13758.5453)... | cc0-1.0 | [
172,
232,
253,
253,
323
] | [
[
172,
232,
253,
253,
323
],
[
325,
325,
368,
368,
814
],
[
816,
816,
842,
842,
1099
],
[
1101,
1101,
1139,
1139,
1247
],
[
1249,
1249,
1273,
1273,
1390
],
[
1392,
1392,
1434,
1434... | // License: Unknown, author: Unknown, found: don't remember
| float hash(vec2 co) { |
return fract(sin(dot(co.xy ,vec2(12.9898,58.233))) * 13758.5453);
} | // License: Unknown, author: Unknown, found: don't remember
float hash(vec2 co) { | 37 | 45 |
7dycDV | gehtsiegarnixan | 2022-06-21T17:26:17 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
3438,
3484,
3507,
3507,
3557
] | [
[
3438,
3484,
3507,
3507,
3557
],
[
3667,
3741,
3769,
3769,
4301
],
[
4303,
4384,
4407,
4407,
4855
],
[
4857,
4895,
4920,
4920,
4950
],
[
4952,
4990,
5014,
5014,
5044
],
[
5046,
5085,
... | // Hexagonal Distanstance from the 0,0 coords
| float hexDist(vec2 p) { |
p = abs(p);
return max(dot(p, h), p.x);
} | // Hexagonal Distanstance from the 0,0 coords
float hexDist(vec2 p) { | 3 | 10 |
7dycDV | gehtsiegarnixan | 2022-06-21T17:26:17 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
3667,
3741,
3769,
3769,
4301
] | [
[
3438,
3484,
3507,
3507,
3557
],
[
3667,
3741,
3769,
3769,
4301
],
[
4303,
4384,
4407,
4407,
4855
],
[
4857,
4895,
4920,
4920,
4950
],
[
4952,
4990,
5014,
5014,
5044
],
[
5046,
5085,
... | // From BigWIngs "Hexagonal Tiling" https://www.shadertoy.com/view/3sSGWt
| hexParams hexTile(vec2 uv) { |
vec2 a = mod(uv, r)-h;
vec2 b = mod(uv-h, r)-h;
vec2 gv = dot(a, a) < dot(b,b) ? a : b; //center hex UV coords
// float edist = .5-hexDist(gv); // Edge distance.
float edist = (.5-hexDist(gv))*2.; // Edge distance with range 0-1
// float cdist = dot(gv, gv); // squared distance fr... | // From BigWIngs "Hexagonal Tiling" https://www.shadertoy.com/view/3sSGWt
hexParams hexTile(vec2 uv) { | 1 | 1 |
7dycDV | gehtsiegarnixan | 2022-06-21T17:26:17 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
4303,
4384,
4407,
4407,
4855
] | [
[
3438,
3484,
3507,
3507,
3557
],
[
3667,
3741,
3769,
3769,
4301
],
[
4303,
4384,
4407,
4407,
4855
],
[
4857,
4895,
4920,
4920,
4950
],
[
4952,
4990,
5014,
5014,
5044
],
[
5046,
5085,
... | // makes viridis colormap with polynimal 6 https://www.shadertoy.com/view/Nd3fR2
| vec3 viridis(float t) { |
const vec3 c0 = vec3(0.274344,0.004462,0.331359);
const vec3 c1 = vec3(0.108915,1.397291,1.388110);
const vec3 c2 = vec3(-0.319631,0.243490,0.156419);
const vec3 c3 = vec3(-4.629188,-5.882803,-19.646115);
const vec3 c4 = vec3(6.181719,14.388598,57.442181);
const vec3 c5 = vec3(4.876952,-13.9551... | // makes viridis colormap with polynimal 6 https://www.shadertoy.com/view/Nd3fR2
vec3 viridis(float t) { | 3 | 8 |
7dycDV | gehtsiegarnixan | 2022-06-21T17:26:17 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
4857,
4895,
4920,
4920,
4950
] | [
[
3438,
3484,
3507,
3507,
3557
],
[
3667,
3741,
3769,
3769,
4301
],
[
4303,
4384,
4407,
4407,
4855
],
[
4857,
4895,
4920,
4920,
4950
],
[
4952,
4990,
5014,
5014,
5044
],
[
5046,
5085,
... | //shifts value range from -1-1 to 0-1
| float make0to1(float x) { |
return (1.0 + x) / 2.0;
} | //shifts value range from -1-1 to 0-1
float make0to1(float x) { | 2 | 2 |
7dycDV | gehtsiegarnixan | 2022-06-21T17:26:17 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
6333,
6374,
6453,
6453,
7631
] | [
[
3438,
3484,
3507,
3507,
3557
],
[
3667,
3741,
3769,
3769,
4301
],
[
4303,
4384,
4407,
4407,
4855
],
[
4857,
4895,
4920,
4920,
4950
],
[
4952,
4990,
5014,
5014,
5044
],
[
5046,
5085,
... | // generates pixelated directional waves
| float flowHexCell(vec2 uv, vec2 offset, float gridRes, float time, float len) { |
hexParams hexValues = hexTile(uv * gridRes + offset);
hexValues.gv = hexValues.gv / gridRes;
hexValues.id = (hexValues.id - offset)/ gridRes;
float radius = 0.3; // of the first spiral
//cyclone like flowmap
vec2 flowMap = cycloneFlow(hexValues.id - vec2(0.885, 0.5), radius, tim... | // generates pixelated directional waves
float flowHexCell(vec2 uv, vec2 offset, float gridRes, float time, float len) { | 1 | 1 |
7dycDV | gehtsiegarnixan | 2022-06-21T17:26:17 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
7633,
7699,
7772,
7772,
8009
] | [
[
3438,
3484,
3507,
3507,
3557
],
[
3667,
3741,
3769,
3769,
4301
],
[
4303,
4384,
4407,
4407,
4855
],
[
4857,
4895,
4920,
4920,
4950
],
[
4952,
4990,
5014,
5014,
5044
],
[
5046,
5085,
... | // 3 hex pixaled flowing sin thier edges get hidden by each other
| float triDirectionalFlow(vec2 uv, float gridRes, float time, float len) { |
float a = flowHexCell(uv, vec2(0.,0.), gridRes, time, len);
float b = flowHexCell(uv, vec2(0,inv_sqrt3), gridRes, time, len);
float c = flowHexCell(uv, vec2(0.5,inv_twice_sqrt3), gridRes, time, len);
return a + b + c;
} | // 3 hex pixaled flowing sin thier edges get hidden by each other
float triDirectionalFlow(vec2 uv, float gridRes, float time, float len) { | 1 | 2 |
fdKcWd | gehtsiegarnixan | 2022-06-21T17:26:10 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
3237,
3276,
3332,
3332,
4561
] | [
[
1598,
1660,
1697,
1697,
1763
],
[
1765,
1817,
1855,
1855,
2101
],
[
2103,
2249,
2278,
2346,
3048
],
[
3050,
3088,
3112,
3112,
3142
],
[
3144,
3182,
3205,
3205,
3235
],
[
3237,
3276,
... | // makes a simple flowmap of a cyclone
| vec2 cycloneFlow(vec2 point, float radius, float time) { |
float size = 1./(1.4 * sqrt(radius)); // of the entire cyclone
float curl = 2.5; // kind of arbitrary but between 1-3.5 looks good
float hole = 1./(4.*size); // also kind of arbitrary
//point += vec2(cos(time),sin(time))*0.1*hole; //rotating center
float angle = atan(point.y, point.x); ... | // makes a simple flowmap of a cyclone
vec2 cycloneFlow(vec2 point, float radius, float time) { | 1 | 3 |
NdyyWy | gehtsiegarnixan | 2022-06-21T17:26:05 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
1239,
1301,
1338,
1338,
1404
] | [
[
1239,
1301,
1338,
1338,
1404
],
[
1406,
1458,
1496,
1496,
1742
],
[
1744,
1890,
1919,
1987,
2689
],
[
2691,
2729,
2752,
2752,
2782
],
[
2784,
2855,
2911,
2911,
3438
],
[
3440,
3440,
... | // Computes the center pixel of the tile containing pixel pos
| vec2 arrowTileCenterCoord(vec2 pos) { |
return (floor(pos / ARROW_TILE_SIZE) + 0.5) * ARROW_TILE_SIZE;
} | // Computes the center pixel of the tile containing pixel pos
vec2 arrowTileCenterCoord(vec2 pos) { | 4 | 4 |
NdyyWy | gehtsiegarnixan | 2022-06-21T17:26:05 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
1406,
1458,
1496,
1496,
1742
] | [
[
1239,
1301,
1338,
1338,
1404
],
[
1406,
1458,
1496,
1496,
1742
],
[
1744,
1890,
1919,
1987,
2689
],
[
2691,
2729,
2752,
2752,
2782
],
[
2784,
2855,
2911,
2911,
3438
],
[
3440,
3440,
... | // Computes the signed distance from a line segment
| float line(vec2 p, vec2 p1, vec2 p2) { |
vec2 center = (p1 + p2) * 0.5;
float len = length(p2 - p1);
vec2 dir = (p2 - p1) / len;
vec2 rel_p = p - center;
float dist1 = abs(dot(rel_p, vec2(dir.y, -dir.x)));
float dist2 = abs(dot(rel_p, dir)) - 0.5*len;
return max(dist1, dist2);
} | // Computes the signed distance from a line segment
float line(vec2 p, vec2 p1, vec2 p2) { | 3 | 3 |
NdyyWy | gehtsiegarnixan | 2022-06-21T17:26:05 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
1744,
1890,
1919,
1987,
2689
] | [
[
1239,
1301,
1338,
1338,
1404
],
[
1406,
1458,
1496,
1496,
1742
],
[
1744,
1890,
1919,
1987,
2689
],
[
2691,
2729,
2752,
2752,
2782
],
[
2784,
2855,
2911,
2911,
3438
],
[
3440,
3440,
... | // v = field sampled at arrowTileCenterCoord(p), scaled by the length
// desired in pixels for arrows
// Returns a signed distance from the arrow
| float arrow(vec2 p, vec2 v) { |
p -= arrowTileCenterCoord(p);
float mag_v = length(v), mag_p = length(p);
if (mag_v > 0.0) {
// Non-zero velocity case
vec2 dir_v = v / mag_v;
// We can't draw arrows larger than the tile radius, so clamp magnitude.
// Enforce a minimum length to help see direction
mag_v = clamp(mag_v, 5.0, ARROW_... | // v = field sampled at arrowTileCenterCoord(p), scaled by the length
// desired in pixels for arrows
// Returns a signed distance from the arrow
float arrow(vec2 p, vec2 v) { | 3 | 4 |
NdyyWy | gehtsiegarnixan | 2022-06-21T17:26:05 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
2691,
2729,
2752,
2752,
2782
] | [
[
1239,
1301,
1338,
1338,
1404
],
[
1406,
1458,
1496,
1496,
1742
],
[
1744,
1890,
1919,
1987,
2689
],
[
2691,
2729,
2752,
2752,
2782
],
[
2784,
2855,
2911,
2911,
3438
],
[
3440,
3440,
... | //shifts value range from -1-1 to 0-1
| vec2 make0to1(vec2 x) { |
return (1.0 + x) / 2.0;
} | //shifts value range from -1-1 to 0-1
vec2 make0to1(vec2 x) { | 2 | 2 |
NdyyWy | gehtsiegarnixan | 2022-06-21T17:26:05 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
2784,
2855,
2911,
2911,
3438
] | [
[
1239,
1301,
1338,
1338,
1404
],
[
1406,
1458,
1496,
1496,
1742
],
[
1744,
1890,
1919,
1987,
2689
],
[
2691,
2729,
2752,
2752,
2782
],
[
2784,
2855,
2911,
2911,
3438
],
[
3440,
3440,
... | // makes a simple flowmap in the shape a donut swirl centered on point
| vec2 donutFlow(vec2 point, float spread, float offset)
{ |
float cenderDistance = length(point); // distance to center
// simple inverted x^2 https://www.desmos.com/calculator/ibidozowyh
float donut = 1.0-pow(2.0*(cenderDistance-offset)/spread, 2.0);
donut = clamp(donut, 0.0, 1.0); // saturate
vec2 flow = normalize(vec2(-point.y, point.... | // makes a simple flowmap in the shape a donut swirl centered on point
vec2 donutFlow(vec2 point, float spread, float offset)
{ | 2 | 2 |
fdVBDw | iq | 2022-07-20T11:43:48 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1721,
1770,
1808,
1808,
1890
] | [
[
1721,
1770,
1808,
1808,
1890
],
[
1892,
1921,
1982,
1982,
2267
],
[
2269,
2297,
2370,
2387,
2862
],
[
2864,
2864,
2921,
2921,
3811
]
] | // https://iquilezles.org/articles/distfunctions
| float sdBox( in vec2 p, in vec2 b )
{ |
vec2 q = abs(p) - b;
return min(max(q.x,q.y),0.0) + length(max(q,0.0));
} | // https://iquilezles.org/articles/distfunctions
float sdBox( in vec2 p, in vec2 b )
{ | 5 | 10 |
fdVBDw | iq | 2022-07-20T11:43:48 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1892,
1921,
1982,
1982,
2267
] | [
[
1721,
1770,
1808,
1808,
1890
],
[
1892,
1921,
1982,
1982,
2267
],
[
2269,
2297,
2370,
2387,
2862
],
[
2864,
2864,
2921,
2921,
3811
]
] | // the SDF we want to repeat
| float sdBase( in vec2 p, vec2 id, float sp, in float time )
{ |
float d;
if( sin(time/2.0)>0.0 )
{
d = sdBox( p, vec2(0.1,0.1)*sp ) - 0.2*sp;
}
else
{
if( mod(id.x+id.y,2.0)>0.5 )
d = sdBox( p, vec2(0.2*sp) );
else
d = sdBox( p, vec2(0.2,0.02)*sp ) - 0.3*sp;
}
return d;
} | // the SDF we want to repeat
float sdBase( in vec2 p, vec2 id, float sp, in float time )
{ | 1 | 1 |
fdVBDw | iq | 2022-07-20T11:43:48 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
2269,
2297,
2370,
2387,
2862
] | [
[
1721,
1770,
1808,
1808,
1890
],
[
1892,
1921,
1982,
1982,
2267
],
[
2269,
2297,
2370,
2387,
2862
],
[
2864,
2864,
2921,
2921,
3811
]
] | // the point of this shader
| float sdCircularRepetition( in vec2 p, float ra, float sp, float time )
{ |
vec2 id0 = round(p/sp);
// snap to circle
if( dot(id0,id0)>ra*ra ) id0 = round(normalize(id0)*ra);
// scan neighbors
float d = 1e20;
for( int j=-2; j<=2; j++ ) // increase this search window
for( int i=-2; i<=2; i++ ) // for large values of ra
{
vec2 id = id0 + vec2(i,... | // the point of this shader
float sdCircularRepetition( in vec2 p, float ra, float sp, float time )
{ | 1 | 1 |
7sGBzw | gehtsiegarnixan | 2022-07-16T16:10:01 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
1629,
1655,
1681,
1681,
1788
] | [
[
1629,
1655,
1681,
1681,
1788
],
[
1790,
1805,
1830,
1830,
2072
],
[
2074,
2108,
2161,
2161,
2332
],
[
2334,
2409,
2438,
2575,
2996
],
[
2998,
3080,
3104,
3104,
3560
],
[
3562,
3562,
... | //edge distance of a Cube
| float cubeDist(vec3 uvw) { |
vec3 d = abs(uvw); //mirroring along axis
return max(d.x, max(d.y, d.z))*2.; //*2. for 0-1 range
} | //edge distance of a Cube
float cubeDist(vec3 uvw) { | 1 | 1 |
7sGBzw | gehtsiegarnixan | 2022-07-16T16:10:01 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
1790,
1805,
1830,
1830,
2072
] | [
[
1629,
1655,
1681,
1681,
1788
],
[
1790,
1805,
1830,
1830,
2072
],
[
2074,
2108,
2161,
2161,
2332
],
[
2334,
2409,
2438,
2575,
2996
],
[
2998,
3080,
3104,
3104,
3560
],
[
3562,
3562,
... | // Cube Tiling
| vec4 cubeTile(vec3 uvw) { |
vec3 grid = fract(uvw)-.5; // centered UVW coords
float edist = 1.-cubeDist(grid); // edge distance
//float cdist = dot(grid,grid); //squared center distance
//vec3 id = uvw-grid; // Cells IDs
return vec4(grid, edist);
} | // Cube Tiling
vec4 cubeTile(vec3 uvw) { | 1 | 1 |
7sGBzw | gehtsiegarnixan | 2022-07-16T16:10:01 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
2074,
2108,
2161,
2161,
2332
] | [
[
1629,
1655,
1681,
1681,
1788
],
[
1790,
1805,
1830,
1830,
2072
],
[
2074,
2108,
2161,
2161,
2332
],
[
2334,
2409,
2438,
2575,
2996
],
[
2998,
3080,
3104,
3104,
3560
],
[
3562,
3562,
... | // scaled with offset cube tiling
| vec4 cubeCell(vec3 uvw, vec3 offset, float gridRes) { |
vec4 cubeTiling = cubeTile(uvw*gridRes + offset);
vec3 tiledUV = (cubeTiling.xyz - offset)/gridRes; //cube pixaltion
return vec4(tiledUV,cubeTiling.w);
} | // scaled with offset cube tiling
vec4 cubeCell(vec3 uvw, vec3 offset, float gridRes) { | 1 | 1 |
7sGBzw | gehtsiegarnixan | 2022-07-16T16:10:01 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
2998,
3080,
3104,
3104,
3560
] | [
[
1629,
1655,
1681,
1681,
1788
],
[
1790,
1805,
1830,
1830,
2072
],
[
2074,
2108,
2161,
2161,
2332
],
[
2334,
2409,
2438,
2575,
2996
],
[
2998,
3080,
3104,
3104,
3560
],
[
3562,
3562,
... | // makes RdYlBu_r colormap with polynimal 6 https://www.shadertoy.com/view/Nd3fR2
| vec3 RdYlBu_r(float t) { |
const vec3 c0 = vec3(0.207621,0.196195,0.618832);
const vec3 c1 = vec3(-0.088125,3.196170,-0.353302);
const vec3 c2 = vec3(8.261232,-8.366855,14.368787);
const vec3 c3 = vec3(-2.922476,33.244294,-43.419173);
const vec3 c4 = vec3(-34.085327,-74.476041,37.159352);
const vec3 c5 = vec3(50.429790,6... | // makes RdYlBu_r colormap with polynimal 6 https://www.shadertoy.com/view/Nd3fR2
vec3 RdYlBu_r(float t) { | 2 | 2 |
ssKfRw | gehtsiegarnixan | 2022-07-15T14:57:00 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
1445,
1487,
1512,
1512,
1796
] | [
[
1445,
1487,
1512,
1512,
1796
],
[
1798,
1840,
1862,
1862,
2308
],
[
2310,
2385,
2414,
2551,
2972
],
[
2974,
2974,
3031,
3031,
3675
]
] | //Distance from the Edge of Cuboctahedron
| float cubocDist(vec3 p) { |
vec3 hra = vec3(0.5); //vector to Diagonal Edge
p = abs(p);
float pAB = max(p.x,p.y); //rigt and left edge
float pCD = max(dot(p, hra),p.z); //diagonal and top edge
float pABCD = max(pAB, pCD);
//optional 0-1 range
return (.5-pABCD)*2.;
} | //Distance from the Edge of Cuboctahedron
float cubocDist(vec3 p) { | 1 | 1 |
ssKfRw | gehtsiegarnixan | 2022-07-15T14:57:00 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
1798,
1840,
1862,
1862,
2308
] | [
[
1445,
1487,
1512,
1512,
1796
],
[
1798,
1840,
1862,
1862,
2308
],
[
2310,
2385,
2414,
2551,
2972
],
[
2974,
2974,
3031,
3031,
3675
]
] | // makes winter colormap with polynimal 6
| vec3 winter(float t) { |
const vec3 c0 = vec3(-0.000000,-0.000941,1.000471);
const vec3 c1 = vec3(0.000000,1.001170,-0.500585);
const vec3 c2 = vec3(-0.000000,0.004744,-0.002369);
const vec3 c3 = vec3(0.000000,-0.011841,0.005901);
const vec3 c4 = vec3(-0.000000,0.012964,-0.006433);
const vec3 c5 = vec3(0.000000,-0.0051... | // makes winter colormap with polynimal 6
vec3 winter(float t) { | 1 | 1 |
7ddBWl | gehtsiegarnixan | 2022-07-10T18:45:29 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
4782,
4806,
4832,
4832,
5052
] | [
[
2752,
2833,
2856,
2856,
3304
],
[
3306,
3344,
3369,
3369,
3399
],
[
3401,
3439,
3463,
3463,
3493
],
[
3495,
3534,
3590,
3590,
4780
],
[
4782,
4806,
4832,
4832,
5052
],
[
5054,
5094,
... | // simple square Tiling
| vec3 squareTile(vec2 uv) { |
vec2 grid = fract(uv)-.5; //UV centered on cell
vec2 d = abs(grid);
float eDist = (0.5-max(d.x, d.y))*2.; //Edge Distance
vec2 id = uv - grid; //ID values
return vec3(id, eDist);
} | // simple square Tiling
vec3 squareTile(vec2 uv) { | 1 | 1 |
7ddBWl | gehtsiegarnixan | 2022-07-10T18:45:29 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
5054,
5094,
5118,
5118,
5446
] | [
[
2752,
2833,
2856,
2856,
3304
],
[
3306,
3344,
3369,
3369,
3399
],
[
3401,
3439,
3463,
3463,
3493
],
[
3495,
3534,
3590,
3590,
4780
],
[
4782,
4806,
4832,
4832,
5052
],
[
5054,
5094,
... | //rhombic shape form Manhattan distance
| vec3 rhomTile(vec2 uv) { |
vec2 a = fract(uv- vec2(.0, .5))-.5;
vec2 b = fract(uv- vec2(.5, .0))-.5;
vec2 aa = abs(a);
float mDist = (aa.x + aa.y -.5);
vec2 grid = mDist < 0. ? a : b; //UV coords
float eDist = abs(mDist)*2.; //Edge Distance
vec2 id = uv - grid; //ID values
return vec3(id, e... | //rhombic shape form Manhattan distance
vec3 rhomTile(vec2 uv) { | 1 | 1 |
7ddBWl | gehtsiegarnixan | 2022-07-10T18:45:29 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
5448,
5484,
5543,
5543,
5700
] | [
[
2752,
2833,
2856,
2856,
3304
],
[
3306,
3344,
3369,
3369,
3399
],
[
3401,
3439,
3463,
3463,
3493
],
[
3495,
3534,
3590,
3590,
4780
],
[
4782,
4806,
4832,
4832,
5052
],
[
5054,
5094,
... | // nakes a square pixelized pattern
| vec3 squarePixelizor(vec2 uv, float gridRes, vec2 offset) { |
vec3 sTiling = squareTile(uv*gridRes + offset);
vec2 tiledUV = (sTiling.xy - offset)/gridRes; //pixaltion
return vec3(tiledUV, sTiling.z);
} | // nakes a square pixelized pattern
vec3 squarePixelizor(vec2 uv, float gridRes, vec2 offset) { | 1 | 1 |
7ddBWl | gehtsiegarnixan | 2022-07-10T18:45:29 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
5702,
5739,
5783,
5783,
5920
] | [
[
2752,
2833,
2856,
2856,
3304
],
[
3306,
3344,
3369,
3369,
3399
],
[
3401,
3439,
3463,
3463,
3493
],
[
3495,
3534,
3590,
3590,
4780
],
[
4782,
4806,
4832,
4832,
5052
],
[
5054,
5094,
... | // nakes a rhombic pixelized pattern
| vec3 rhomPixelizor(vec2 uv, float gridRes) { |
vec3 rTiling = rhomTile(uv*gridRes);
vec2 tiledUV = (rTiling.xy)/gridRes; //pixaltion
return vec3(tiledUV, rTiling.z);
} | // nakes a rhombic pixelized pattern
vec3 rhomPixelizor(vec2 uv, float gridRes) { | 1 | 1 |
7ddBWl | gehtsiegarnixan | 2022-07-10T18:45:29 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
6911,
6952,
7034,
7034,
7147
] | [
[
2752,
2833,
2856,
2856,
3304
],
[
3306,
3344,
3369,
3369,
3399
],
[
3401,
3439,
3463,
3463,
3493
],
[
3495,
3534,
3590,
3590,
4780
],
[
4782,
4806,
4832,
4832,
5052
],
[
5054,
5094,
... | // generates pixelated directional waves
| float flowSquareCell(vec2 uv, vec2 offset, float gridRes, float time, float len) { |
vec3 pix = squarePixelizor(uv, gridRes, offset);
return sinWave(uv, pix.xy, time, pix.z, len);
} | // generates pixelated directional waves
float flowSquareCell(vec2 uv, vec2 offset, float gridRes, float time, float len) { | 1 | 1 |
7ddBWl | gehtsiegarnixan | 2022-07-10T18:45:29 | // The MIT License
// Copyright © 2022 Gehtsiegarnixan
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p... | mit | [
7149,
7190,
7257,
7257,
7360
] | [
[
2752,
2833,
2856,
2856,
3304
],
[
3306,
3344,
3369,
3369,
3399
],
[
3401,
3439,
3463,
3463,
3493
],
[
3495,
3534,
3590,
3590,
4780
],
[
4782,
4806,
4832,
4832,
5052
],
[
5054,
5094,
... | // generates pixelated directional waves
| float flowRhomCell(vec2 uv, float gridRes, float time, float len) { |
vec3 pix = rhomPixelizor(uv, gridRes);
return sinWave(uv, pix.xy, time, pix.z, len);
} | // generates pixelated directional waves
float flowRhomCell(vec2 uv, float gridRes, float time, float len) { | 1 | 1 |
fddBD2 | iq | 2022-07-07T22:16:10 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
4334,
4392,
4457,
4475,
4820
] | [
[
2473,
2473,
2893,
2893,
3577
],
[
3579,
3579,
3626,
3626,
3669
],
[
4334,
4392,
4457,
4475,
4820
],
[
4822,
4822,
4859,
4859,
4973
],
[
4975,
4975,
5037,
5037,
5089
]
] | // https://iquilezles.org/articles/filterableprocedurals/
| float gridTextureGradBox( in vec2 p, in vec2 ddx, in vec2 ddy )
{ |
vec2 w = max(abs(ddx), abs(ddy)) + 0.01;
// analytic (box) filtering
vec2 a = p + 0.5*w;
vec2 b = p - 0.5*w;
const float N = 18.0; // grid thickness
vec2 i = (floor(a)+min(fract(a)*N,1.0)-
floor(b)-min(fract(b)*N,1.0))/(N*w);
//pattern
retu... | // https://iquilezles.org/articles/filterableprocedurals/
float gridTextureGradBox( in vec2 p, in vec2 ddx, in vec2 ddy )
{ | 2 | 6 |
ssdBWS | mrange | 2022-07-06T19:50:42 | // License CC0: Rainbow boxes
// Wednesday hack to reproduce a commonly seen effect
#define TIME iTime
#define RESOLUTION iResolution
// License: WTFPL, author: sam hocevar, found: https://stackoverflow.com/a/17897228/418488
const vec4 hsv2rgb_K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 hsv2rgb(vec3 c) {
... | cc0-1.0 | [
761,
879,
911,
966,
1150
] | [
[
297,
297,
319,
319,
465
],
[
761,
879,
911,
966,
1150
],
[
1152,
1253,
1281,
1380,
1707
],
[
1709,
1709,
1738,
1738,
1798
],
[
1800,
1800,
1845,
1845,
2134
],
[
2136,
2196,
2217,
... | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
| float hexagon(vec2 p, float r) { |
const vec3 k = 0.5*vec3(-sqrt(3.0),1.0,sqrt(4.0/3.0));
p = abs(p);
p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;
p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);
return length(p)*sign(p.y);
} | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
float hexagon(vec2 p, float r) { | 2 | 11 |
ssdBWS | mrange | 2022-07-06T19:50:42 | // License CC0: Rainbow boxes
// Wednesday hack to reproduce a commonly seen effect
#define TIME iTime
#define RESOLUTION iResolution
// License: WTFPL, author: sam hocevar, found: https://stackoverflow.com/a/17897228/418488
const vec4 hsv2rgb_K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 hsv2rgb(vec3 c) {
... | cc0-1.0 | [
1152,
1253,
1281,
1380,
1707
] | [
[
297,
297,
319,
319,
465
],
[
761,
879,
911,
966,
1150
],
[
1152,
1253,
1281,
1380,
1707
],
[
1709,
1709,
1738,
1738,
1798
],
[
1800,
1800,
1845,
1845,
2134
],
[
2136,
2196,
2217,
... | // License: Unknown, author: Martijn Steinrucken, found: https://www.youtube.com/watch?v=VmrIDyYiJBA
| vec2 hextile(inout vec2 p) { |
const vec2 sz = vec2(1.0, sqrt(3.0));
const vec2 hsz = 0.5*sz;
vec2 p1 = mod(p, sz)-hsz;
vec2 p2 = mod(p - hsz, sz)-hsz;
vec2 p3 = dot(p1, p1) < dot(p2, p2) ? p1 : p2;
vec2 n = ((p3 - p + hsz)/sz);
p = p3;
n -= vec2(0.5);
// Rounding to make hextile 0,0 well behaved
return round(n*2.0)... | // License: Unknown, author: Martijn Steinrucken, found: https://www.youtube.com/watch?v=VmrIDyYiJBA
vec2 hextile(inout vec2 p) { | 21 | 24 |
NstGDM | iq | 2022-07-04T09:11:38 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
2114,
2162,
2187,
2187,
2346
] | [
[
2114,
2162,
2187,
2187,
2346
],
[
2348,
2359,
2414,
2457,
52260
]
] | // noise, https://www.shadertoy.com/view/3sd3Rs
| float fun( in float x )
{ |
float i = floor(x);
float f = fract(x);
float k = fract(i*0.1731)*16.0-4.0;
f *= f-1.0;
f *= k*f-1.0;
f *= sign(fract(x/2.0)-0.5);
return f;
} | // noise, https://www.shadertoy.com/view/3sd3Rs
float fun( in float x )
{ | 1 | 1 |
fddfRj | mrange | 2022-07-02T20:47:13 | // License CC0: 2nd attempt multiscale truchet
// Everyone loves truchet tiles. Shane did an amazing one: https://www.shadertoy.com/view/4t3BW4
// Been tinkering a bit more with multiscale truchet inspired by Shane's.
// Made a height field and applied lighting to it. Kind of neat
#define TIME iTime
#define RES... | cc0-1.0 | [
490,
590,
609,
609,
696
] | [
[
490,
590,
609,
609,
696
],
[
698,
805,
831,
831,
1015
],
[
1169,
1169,
1191,
1191,
1337
],
[
1632,
1692,
1713,
1713,
1783
],
[
1785,
1785,
1813,
1833,
1909
],
[
1911,
1911,
1942,
... | // License: Unknown, author: nmz (twitter: @stormoid), found: https://www.shadertoy.com/view/NdfyRM
| vec3 sRGB(vec3 t) { |
return mix(1.055*pow(t, vec3(1./2.4)) - 0.055, 12.92*t, step(t, vec3(0.0031308)));
} | // License: Unknown, author: nmz (twitter: @stormoid), found: https://www.shadertoy.com/view/NdfyRM
vec3 sRGB(vec3 t) { | 59 | 59 |
sscBRj | mrange | 2022-07-02T12:46:36 | // License CC0: 1st attempt multiscale truchet
// Everyone loves truchet tiles. Shane did an amazing one: https://www.shadertoy.com/view/4t3BW4
// I was trying to understand what was going and my brain hurt.
// Anyway after some tinkering I think I got the gist of it. The idea is brilliant!
// Compared to Shane's this ... | cc0-1.0 | [
718,
745,
764,
764,
1021
] | [
[
506,
566,
587,
587,
657
],
[
659,
659,
690,
690,
716
],
[
718,
745,
764,
764,
1021
],
[
1023,
1045,
1064,
1064,
1699
],
[
1701,
1701,
1719,
1719,
1738
],
[
1740,
1740,
1761,
1761... | // Classic truchet pattern
| float df0(vec2 p) { |
p -= 0.5;
vec2 n = round(p);
p -= n;
float h0 = hash(n+100.0);
if (h0 > 0.5) {
p = vec2(p.y, -p.x);;
}
float d0 = circle(p-0.5, 0.5);
float d1 = circle(p+0.5, 0.5);
float d = d0;
d = min(d, d1);
d = abs(d) - 0.125;
return d;
} | // Classic truchet pattern
float df0(vec2 p) { | 2 | 3 |
sscBRj | mrange | 2022-07-02T12:46:36 | // License CC0: 1st attempt multiscale truchet
// Everyone loves truchet tiles. Shane did an amazing one: https://www.shadertoy.com/view/4t3BW4
// I was trying to understand what was going and my brain hurt.
// Anyway after some tinkering I think I got the gist of it. The idea is brilliant!
// Compared to Shane's this ... | cc0-1.0 | [
1023,
1045,
1064,
1064,
1699
] | [
[
506,
566,
587,
587,
657
],
[
659,
659,
690,
690,
716
],
[
718,
745,
764,
764,
1021
],
[
1023,
1045,
1064,
1064,
1699
],
[
1701,
1701,
1719,
1719,
1738
],
[
1740,
1740,
1761,
1761... | // Multiscale truchet
| float df1(vec2 p) { |
vec2 op = p;
p -= 0.5;
vec2 n = round(p);
p -= n;
float h0 = hash(n+100.0);
float h1 = fract(8667.0*h0);
// Recurse to df0 for 50% of the tiles
if (h1 < 0.5) {
// Invert the distance to make inside into outside
return -(df0(2.0*op))*0.5;
}
if (h0 > 0.5) {
p = vec2(p.y, -p.x);;
}
... | // Multiscale truchet
float df1(vec2 p) { | 1 | 2 |
7lVcDw | Behzod | 2022-08-27T17:48:11 | // The MIT License
// Copyright © 2014 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1612,
1648,
1715,
1715,
2316
] | [
[
1612,
1648,
1715,
1715,
2316
],
[
2318,
2318,
2382,
2382,
2561
],
[
2563,
2563,
2620,
2620,
3299
]
] | // signed distance to a 2D triangle
| float sdTriangle( in vec2 p, in vec2 p0, in vec2 p1, in vec2 p2 )
{ |
vec2 e0 = p1 - p0;
vec2 e1 = p2 - p1;
vec2 e2 = p0 - p2;
vec2 v0 = p - p0;
vec2 v1 = p - p1;
vec2 v2 = p - p2;
vec2 pq0 = v0 - e0*clamp( dot(v0,e0)/dot(e0,e0), 0.0, 1.0 );
vec2 pq1 = v1 - e1*clamp( dot(v1,e1)/dot(e1,e1), 0.0, 1.0 );
vec2 pq2 = v2 + e2*clamp( dot(v2,e2)/dot(e2,e2), 0.0, 1.0 );
float... | // signed distance to a 2D triangle
float sdTriangle( in vec2 p, in vec2 p0, in vec2 p1, in vec2 p2 )
{ | 1 | 14 |
7ttcDj | mrange | 2022-08-15T19:39:08 | // License CC0: Cable nest v2
// Revisited the old Cable nest shader and recoloured + tweaked distance field
// Thought it turned out nice enough to share again
// ---
// Some parameters to play with.
#define BPM 120.0
// Controls camera "fisheye"
//#define RDD0
//#define RDD1
// cable shapes
#define ROUNDEDX
... | cc0-1.0 | [
2379,
2501,
2559,
2559,
3040
] | [
[
1115,
1115,
1137,
1137,
1283
],
[
1666,
1766,
1785,
1785,
1872
],
[
1874,
1981,
2007,
2007,
2191
],
[
2193,
2253,
2281,
2301,
2377
],
[
2379,
2501,
2559,
2559,
3040
],
[
3042,
3102,
... | // License: MIT, author: Inigo Quilez, found: https://www.iquilezles.org/www/articles/spherefunctions/spherefunctions.htm
| float sphered(vec3 ro, vec3 rd, vec4 sph, float dbuffer) { |
float ndbuffer = dbuffer/sph.w;
vec3 rc = (ro - sph.xyz)/sph.w;
float b = dot(rd,rc);
float c = dot(rc,rc) - 1.0;
float h = b*b - c;
if( h<0.0 ) return 0.0;
h = sqrt( h );
float t1 = -b - h;
float t2 = -b + h;
if( t2<0.0 || t1>ndbuffer ) return 0.0;
t1 = max( t1, 0.0 );... | // License: MIT, author: Inigo Quilez, found: https://www.iquilezles.org/www/articles/spherefunctions/spherefunctions.htm
float sphered(vec3 ro, vec3 rd, vec4 sph, float dbuffer) { | 8 | 11 |
7ttcDj | mrange | 2022-08-15T19:39:08 | // License CC0: Cable nest v2
// Revisited the old Cable nest shader and recoloured + tweaked distance field
// Thought it turned out nice enough to share again
// ---
// Some parameters to play with.
#define BPM 120.0
// Controls camera "fisheye"
//#define RDD0
//#define RDD1
// cable shapes
#define ROUNDEDX
... | cc0-1.0 | [
3674,
3792,
3834,
3834,
3893
] | [
[
1115,
1115,
1137,
1137,
1283
],
[
1666,
1766,
1785,
1785,
1872
],
[
1874,
1981,
2007,
2007,
2191
],
[
2193,
2253,
2281,
2301,
2377
],
[
2379,
2501,
2559,
2559,
3040
],
[
3042,
3102,
... | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
| float roundedX(vec2 p, float w, float r) { |
p = abs(p);
return length(p-min(p.x+p.y,w)*0.5) - r;
} | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
float roundedX(vec2 p, float w, float r) { | 5 | 5 |
Nt3yDH | iq | 2022-08-04T22:30:28 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1633,
1653,
1700,
1713,
2529
] | [
[
1633,
1653,
1700,
1713,
2529
],
[
2531,
2531,
2588,
2588,
3435
]
] | // k in (0,1) range
| float sdHyperbolicCross( in vec2 p, float k )
{ |
float s = 1.0/k - k;
p = p*s;
// symmetry
p = abs(p);
p = (p.x>p.y) ? p.yx : p.xy;
// offset
p += k;
// solve quartic (for details see https://www.shadertoy.com/view/ftcyW8)
float x2 = p.x*p.x/16.0;
float y2 = p.y*p.y/16.0;
float r = (p.x*p.y-4.0)/12.0;
float q = y2... | // k in (0,1) range
float sdHyperbolicCross( in vec2 p, float k )
{ | 1 | 1 |
ftcyW8 | iq | 2022-08-04T19:35:57 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1817,
1838,
1864,
1864,
2451
] | [
[
1817,
1838,
1864,
1864,
2451
],
[
2453,
2453,
2508,
2508,
3228
]
] | // distance to y=1/x
| float sdOOX( in vec2 p )
{ |
p = (p.x>p.y) ? p.yx : p.xy;
float x2 = p.x*p.x/16.0;
float y2 = p.y*p.y/16.0;
float r = (4.0-p.x*p.y)/12.0;
float q = x2 - y2;
float h = q*q + r*r*r;
float u;
if( h<0.0 )
{
float m = sqrt(-r);
u = m*cos( acos(q/(r*m))/3.0 );
}
else
{
float m... | // distance to y=1/x
float sdOOX( in vec2 p )
{ | 1 | 1 |
NtKBWh | mrange | 2022-09-29T05:45:01 | // License CC0: Dark chocolate FBM
// Working on a cake related shader and created kind of dark chocolate
// background. Nothing unique but different colors than what I usually
// do so sharing.
#define TIME iTime
#define RESOLUTION iResolution
#define PI 3.141592654
#define TAU (2.0*PI)
... | cc0-1.0 | [
1768,
1868,
1907,
1907,
1992
] | [
[
592,
592,
614,
614,
760
],
[
1055,
1155,
1174,
1174,
1261
],
[
1263,
1370,
1396,
1396,
1580
],
[
1582,
1642,
1670,
1690,
1766
],
[
1768,
1868,
1907,
1907,
1992
],
[
1994,
2082,
2112,... | // License: MIT, author: Inigo Quilez, found: https://www.iquilezles.org/www/articles/smin/smin.htm
| float pmin(float a, float b, float k) { |
float h = clamp(0.5+0.5*(b-a)/k, 0.0, 1.0);
return mix(b, a, h) - k*h*(1.0-h);
} | // License: MIT, author: Inigo Quilez, found: https://www.iquilezles.org/www/articles/smin/smin.htm
float pmin(float a, float b, float k) { | 63 | 107 |
NtKBWh | mrange | 2022-09-29T05:45:01 | // License CC0: Dark chocolate FBM
// Working on a cake related shader and created kind of dark chocolate
// background. Nothing unique but different colors than what I usually
// do so sharing.
#define TIME iTime
#define RESOLUTION iResolution
#define PI 3.141592654
#define TAU (2.0*PI)
... | cc0-1.0 | [
1994,
2082,
2112,
2112,
2140
] | [
[
592,
592,
614,
614,
760
],
[
1055,
1155,
1174,
1174,
1261
],
[
1263,
1370,
1396,
1396,
1580
],
[
1582,
1642,
1670,
1690,
1766
],
[
1768,
1868,
1907,
1907,
1992
],
[
1994,
2082,
2112,... | // License: CC0, author: Mårten Rånge, found: https://github.com/mrange/glsl-snippets
| float pabs(float a, float k) { |
return -pmin(a, -a, k);
} | // License: CC0, author: Mårten Rånge, found: https://github.com/mrange/glsl-snippets
float pabs(float a, float k) { | 24 | 44 |
7tKfzh | IWBTShyGuy | 2022-09-25T06:37:05 | // Copyright © 2022 IWBTShyGuy
// Attribution 4.0 International (CC BY 4.0)
// Hash without Sine https://www.shadertoy.com/view/4djSRW
float hash12(vec2 p) {
vec3 p3 = fract(vec3(p.xyx) * .1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
}
float noise12(vec2 p) {
vec2 t = fract(... | cc-by-4.0 | [
78,
137,
159,
159,
276
] | [
[
78,
137,
159,
159,
276
],
[
278,
278,
301,
301,
534
],
[
536,
536,
575,
575,
1454
]
] | // Hash without Sine https://www.shadertoy.com/view/4djSRW
| float hash12(vec2 p) { |
vec3 p3 = fract(vec3(p.xyx) * .1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
} | // Hash without Sine https://www.shadertoy.com/view/4djSRW
float hash12(vec2 p) { | 2 | 53 |
DdlGD8 | iq | 2022-10-18T02:38:00 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1372,
1470,
1533,
1533,
3367
] | [
[
1372,
1470,
1533,
1533,
3367
],
[
3369,
3369,
3424,
3424,
4507
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ =☺ 1
| vec3 sdBezier( in vec2 pos, in vec2 A, in vec2 B, in vec2 C )
{ |
vec2 a = B - A;
vec2 b = A - 2.0*B + C;
vec2 c = a * 2.0;
vec2 d = A - pos;
float kk = 1.0/dot(b,b);
float kx = kk * dot(a,b);
float ky = kk * (2.0*dot(a,a)+dot(d,b))/3.0;
float kz = kk * dot(d,a);
vec3 res;
float p = ky - kx*kx;
float q = kx*(2.0*kx*kx - 3.0*... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ =☺ 1
vec3 sdBezier( in vec2 pos, in vec2 A, in vec2 B, in vec2 C )
{ | 1 | 1 |
Dss3W8 | iq | 2022-10-18T02:29:22 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1376,
1471,
1529,
1529,
2198
] | [
[
1376,
1471,
1529,
1529,
2198
],
[
2200,
2200,
2255,
2255,
3259
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdParabola( in vec2 pos, in float wi, in float he )
{ |
float s = sign(pos.x);
pos.x = abs(pos.x);
float ik = wi*wi/he;
float p = ik*(he-pos.y-0.5*ik)/3.0;
float q = pos.x*ik*ik*0.25;
float h = q*q - p*p*p;
float x;
if( h>0.0 ) // 1 root
{
float r = sqrt(h);
x = pow(q+r,1.0/3.0) + pow(abs(q-r),1.0/3.0)*sign(p);
... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdParabola( in vec2 pos, in float wi, in float he )
{ | 1 | 1 |
mdX3WH | iq | 2022-10-17T23:16:05 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1375,
1470,
1514,
1514,
2026
] | [
[
1375,
1470,
1514,
1514,
2026
],
[
2028,
2028,
2083,
2083,
3217
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdParabola( in vec2 pos, in float k )
{ |
float s = sign(pos.x);
pos.x = abs(pos.x);
float ik = 1.0/k;
float p = ik*(pos.y - 0.5*ik)/3.0;
float q = 0.25*ik*ik*pos.x;
float h = q*q - p*p*p;
float r = sqrt(abs(h));
float x = (h>0.0) ?
// 1 root
pow(q+r,1.0/3.0) - pow(abs(q-r),1.0/3.0)*sign(r-q) :
... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdParabola( in vec2 pos, in float k )
{ | 1 | 1 |
ddX3WH | iq | 2022-10-17T23:14:56 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1358,
1453,
1504,
1504,
2004
] | [
[
1358,
1453,
1504,
1504,
2004
],
[
2006,
2006,
2061,
2061,
3035
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdMoon(vec2 p, float d, float ra, float rb )
{ |
float s = sign(p.y);
p.y = abs(p.y);
float a = (ra*ra - rb*rb + d*d)/(2.0*d);
float b = sqrt(max(ra*ra-a*a,0.0));
if( d*(p.x*b-p.y*a) > d*d*max(b-p.y,0.0) )
{
vec2 w = p-vec2(a,b); float d = length(w); w.y *= s;
return vec3(d,w/d);
}
vec2 w1 = p; ; float l1 = l... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdMoon(vec2 p, float d, float ra, float rb )
{ | 1 | 1 |
slyfDc | kara0xfb | 2022-10-10T00:32:31 | // The MIT License
// Copyright © 2013 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
2942,
3043,
3064,
3064,
3338
] | [
[
2942,
3043,
3064,
3064,
3338
],
[
3340,
3441,
3462,
3462,
3821
],
[
3823,
3924,
3945,
3945,
4417
],
[
4419,
4419,
4442,
4442,
4705
],
[
4707,
4707,
4729,
4729,
4960
],
[
4962,
4962,
... | // Hash Functions for GPU Rendering - Jarzynski, Olano
// https://www.jcgt.org/published/0009/03/02/
| ivec2 Pcg2(ivec2 v)
{ |
uint x = uint(v.x);
uint y = uint(v.y);
x = x * 1664525u + 1013904223u;
y = y * 1664525u + 1013904223u;
x += y * 1664525u;
y += x * 1664525u;
x ^= x >> 16;
y ^= y >> 16;
x += y * 1664525u;
y += x * 1664525u;
return ivec2(x, y);
} | // Hash Functions for GPU Rendering - Jarzynski, Olano
// https://www.jcgt.org/published/0009/03/02/
ivec2 Pcg2(ivec2 v)
{ | 1 | 1 |
slyfDc | kara0xfb | 2022-10-10T00:32:31 | // The MIT License
// Copyright © 2013 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
3340,
3441,
3462,
3462,
3821
] | [
[
2942,
3043,
3064,
3064,
3338
],
[
3340,
3441,
3462,
3462,
3821
],
[
3823,
3924,
3945,
3945,
4417
],
[
4419,
4419,
4442,
4442,
4705
],
[
4707,
4707,
4729,
4729,
4960
],
[
4962,
4962,
... | // Hash Functions for GPU Rendering - Jarzynski, Olano
// https://www.jcgt.org/published/0009/03/02/
| ivec3 Pcg3(ivec3 v)
{ |
uint x = uint(v.x);
uint y = uint(v.y);
uint z = uint(v.z);
x = x * 1664525u + 1013904223u;
y = y * 1664525u + 1013904223u;
z = z * 1664525u + 1013904223u;
x += y * z;
y += z * x;
z += x * y;
x ^= x >> 16;
y ^= y >> 16;
z ^= z >> 16;
x += y * z;
y += z * x;
z... | // Hash Functions for GPU Rendering - Jarzynski, Olano
// https://www.jcgt.org/published/0009/03/02/
ivec3 Pcg3(ivec3 v)
{ | 1 | 1 |
dls3Wr | mkeeter | 2022-12-21T17:04:32 | // Using distance-to-quadratic and winding number to generate a closed-form
// distance field of a font outline, which is specified as lines + quadratic
// Bézier curves.
//
// Quadratic solver is based on https://www.shadertoy.com/view/MlKcDD, which
// includes the following copyright notice:
//
// Copyright © 20... | mit | [
5586,
5627,
5689,
5689,
7707
] | [
[
5475,
5475,
5498,
5498,
5518
],
[
5519,
5519,
5552,
5552,
5584
],
[
5586,
5627,
5689,
5689,
7707
],
[
7709,
7758,
7811,
7811,
8140
],
[
8142,
8142,
8196,
8196,
8386
],
[
8388,
8388,
... | // signed distance to a quadratic bezier
| float sdBezier(in vec2 pos, in vec2 A, in vec2 B, in vec2 C) { |
vec2 a = B - A;
vec2 b = A - 2.0 * B + C;
vec2 c = a * 2.0;
vec2 d = A - pos;
float kk = 1.0 / dot(b, b);
float kx = kk * dot(a, b);
float ky = kk * (2.0 * dot(a, a) + dot(d, b)) / 3.0;
float kz = kk * dot(d, a);
float res = 0.0;
float sgn = 0.0;
float p = ky - kx * kx;
... | // signed distance to a quadratic bezier
float sdBezier(in vec2 pos, in vec2 A, in vec2 B, in vec2 C) { | 1 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.