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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
tsBfRD | iq | 2020-05-16T00:31:58 | // The MIT License
// Copyright © 2017 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 | [
1825,
2097,
2154,
2170,
2587
] | [
[
1825,
2097,
2154,
2170,
2587
],
[
2590,
2618,
2777,
2777,
2979
],
[
2982,
3019,
3083,
3121,
3401
],
[
3403,
3403,
3431,
3431,
3450
],
[
3452,
3452,
3515,
3515,
3906
],
[
3909,
3909,
... | //---------------------------------------------------------------------------------------
// bounding box for a bezier (http://iquilezles.org/www/articles/bezierbbox/bezierbbox.htm)
//---------------------------------------------------------------------------------------
| bound3 BezierAABB( in vec3 p0, in vec3 p1, in vec3 p2 )
{ |
vec3 mi = min(p0,p2);
vec3 ma = max(p0,p2);
// p = (1-t)^2*p0 + 2(1-t)t*p1 + t^2*p2
// dp/dt = 2(t-1)*p0 + 2(1-2t)*p1 + 2t*p2 = t*(2*p0-4*p1+2*p2) + 2*(p1-p0)
// dp/dt = 0 -> t*(p0-2*p1+p2) = (p0-p1);
vec3 t = clamp((p0-p1)/(p0-2.0*p1+p2),0.0,1.0);
vec3 s = 1.0 - t;
vec3 q = s*s*p0 + ... | //---------------------------------------------------------------------------------------
// bounding box for a bezier (http://iquilezles.org/www/articles/bezierbbox/bezierbbox.htm)
//---------------------------------------------------------------------------------------
bound3 BezierAABB( in vec3 p0, in vec3 p1, in ve... | 1 | 1 |
tsjfRw | blackle | 2020-05-17T22:24:19 | //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.
//antialising
#define AA_SAMPLES 1
//percentage of domains filled
#define DENSITY 0.35
//returns a vector pointing in the dir... | cc0-1.0 | [
282,
360,
383,
383,
616
] | [
[
282,
360,
383,
383,
616
],
[
618,
618,
648,
648,
717
],
[
719,
719,
749,
844,
925
],
[
927,
927,
967,
967,
1059
],
[
1073,
1073,
1094,
1094,
1671
],
[
1673,
1673,
1692,
1692,
... | //returns a vector pointing in the direction of the closest neighbouring cell
| vec3 quadrant(vec3 p) { |
vec3 ap = abs(p);
if (ap.x >= max(ap.y, ap.z)) return vec3(sign(p.x),0.,0.);
if (ap.y >= max(ap.x, ap.z)) return vec3(0.,sign(p.y),0.);
if (ap.z >= max(ap.x, ap.y)) return vec3(0.,0.,sign(p.z));
return vec3(0);
} | //returns a vector pointing in the direction of the closest neighbouring cell
vec3 quadrant(vec3 p) { | 2 | 2 |
WsBBRw | blackle | 2020-05-16T20:41:42 | //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 is the technique in https://www.shadertoy.com/view/td2fRD
//but a 3d SDF mapping to a 2d sdf, instead of a 4d to a 3d.
... | cc0-1.0 | [
522,
606,
659,
659,
797
] | [
[
410,
410,
440,
440,
520
],
[
522,
606,
659,
659,
797
],
[
799,
799,
822,
822,
1003
],
[
1005,
1005,
1043,
1043,
1107
],
[
1126,
1126,
1149,
1149,
1763
],
[
1765,
1765,
1784,
1784... | //return the SDF for a sphere, or the SDF for an empty region surrounded by spheres
| float gated_domain(vec3 p, float scale, bool gated) { |
if (!gated) {
p.xy = abs(p.xy);
if (p.x > p.y) p.xy = p.yx;
p.y -= 1./scale;
}
return length(p)-.2;
} | //return the SDF for a sphere, or the SDF for an empty region surrounded by spheres
float gated_domain(vec3 p, float scale, bool gated) { | 1 | 1 |
3lByRK | blackle | 2020-07-14T20:22:45 | //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.
//shitty way to prevent division by zero. if b is zero, add a little bit to it.
vec3 div(vec3 a, vec3 b) {
b += vec3(equal... | cc0-1.0 | [
194,
274,
300,
300,
355
] | [
[
194,
274,
300,
300,
355
],
[
357,
357,
411,
479,
724
],
[
726,
726,
762,
762,
887
],
[
889,
889,
910,
910,
962
],
[
964,
964,
1002,
1002,
1064
],
[
1121,
1121,
1151,
1151,
12... | //shitty way to prevent division by zero. if b is zero, add a little bit to it.
| vec3 div(vec3 a, vec3 b) { |
b += vec3(equal(b,vec3(0)))*.01;
return a/b;
} | //shitty way to prevent division by zero. if b is zero, add a little bit to it.
vec3 div(vec3 a, vec3 b) { | 1 | 1 |
WtScDt | iq | 2020-07-27T06:52:31 | // The MIT License
// Copyright © 2020 Inigo Quilez
// https://www.youtube.com/c/InigoQuilez
// https://iquilezles.org/
// 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, inclu... | mit | [
1932,
1953,
1977,
1977,
2140
] | [
[
1932,
1953,
1977,
1977,
2140
],
[
2205,
2205,
2225,
2225,
2253
],
[
2255,
2364,
2393,
2393,
2893
],
[
2895,
2895,
2951,
2970,
3564
]
] | // box-filted cos(x)
| vec3 fcos( in vec3 x )
{ |
vec3 w = fwidth(x);
#if 1
return cos(x) * sin(0.5*w)/(0.5*w); // exact
#else
return cos(x) * smoothstep(6.2832,0.0,w); // approx
#endif
} | // box-filted cos(x)
vec3 fcos( in vec3 x )
{ | 1 | 4 |
WtScDt | iq | 2020-07-27T06:52:31 | // The MIT License
// Copyright © 2020 Inigo Quilez
// https://www.youtube.com/c/InigoQuilez
// https://iquilezles.org/
// 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, inclu... | mit | [
2255,
2364,
2393,
2393,
2893
] | [
[
1932,
1953,
1977,
1977,
2140
],
[
2205,
2205,
2225,
2225,
2253
],
[
2255,
2364,
2393,
2393,
2893
],
[
2895,
2895,
2951,
2970,
3564
]
] | // color palette, made of 8 cos functions
// (see https://iquilezles.org/www/articles/palettes/palettes.htm)
| vec3 getColor( in float t )
{ |
vec3 col = vec3(0.6,0.5,0.4);
col += 0.14*mcos(6.2832*t* 1.0+vec3(0.0,0.5,0.6));
col += 0.13*mcos(6.2832*t* 3.1+vec3(0.5,0.6,1.0));
col += 0.12*mcos(6.2832*t* 5.1+vec3(0.1,0.7,1.1));
col += 0.11*mcos(6.2832*t* 9.1+vec3(0.1,0.5,1.2));
col += 0.10*mcos(6.2832*t* 17.1+vec3(0.0,0.3,0.9));
c... | // color palette, made of 8 cos functions
// (see https://iquilezles.org/www/articles/palettes/palettes.htm)
vec3 getColor( in float t )
{ | 1 | 8 |
wtsBzS | mrange | 2020-08-10T18:35:18 | // License CC0: Double Ended Truchet Experiment
// Been looking at some double ended truchets by BigWings and Shane.
// After some experiments I got something I felt was interesting enough to share.
#define TIME iTime
#define RESOLUTION iResolution
#define PI 3.141592654
#define TAU ... | cc0-1.0 | [
4214,
4266,
4314,
4314,
5346
] | [
[
3776,
3776,
3803,
3803,
3872
],
[
3874,
3874,
3895,
3895,
3965
],
[
3967,
3967,
3988,
3988,
4017
],
[
4019,
4019,
4039,
4039,
4058
],
[
4064,
4064,
4104,
4104,
4212
],
[
4214,
4266,
... | // IQ Bezier: https://www.shadertoy.com/view/MlKcDD
| float bezier(vec2 pos, vec2 A, vec2 B, vec2 C) { |
const float sqrt3 = sqrt(3.0);
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 p = ky - kx*kx;
float p3 = p*p... | // IQ Bezier: https://www.shadertoy.com/view/MlKcDD
float bezier(vec2 pos, vec2 A, vec2 B, vec2 C) { | 2 | 6 |
WdVyDW | Moon519 | 2020-10-16T16:33:14 | // Shadertoy implementation of "Segment Tracing using Local Lipschitz Bounds" - Eurographics 2020
// Eric Galin, Eric Guérin, Axel Paris, Adrien Peytavie
// Paper: https://hal.archives-ouvertes.fr/hal-02507361/document
// Video: https://www.youtube.com/watch?v=NOinlrHyieE&feature=youtu.be
// Talk: https://www.youtube... | mit | [
950,
964,
995,
995,
1108
] | [
[
950,
964,
995,
995,
1108
],
[
1110,
1155,
1188,
1188,
1282
],
[
1284,
1373,
1407,
1407,
1443
],
[
1445,
1588,
1640,
1640,
1961
],
[
1963,
2068,
2116,
2116,
2159
],
[
2161,
2320,
2384... | // Transforms
| vec3 RotateY(vec3 p, float a)
{ |
float sa = sin(a);
float ca = cos(a);
return vec3(ca * p.x + sa * p.z, p.y, -sa * p.x + ca * p.z);
} | // Transforms
vec3 RotateY(vec3 p, float a)
{ | 1 | 3 |
WdVyDW | Moon519 | 2020-10-16T16:33:14 | // Shadertoy implementation of "Segment Tracing using Local Lipschitz Bounds" - Eurographics 2020
// Eric Galin, Eric Guérin, Axel Paris, Adrien Peytavie
// Paper: https://hal.archives-ouvertes.fr/hal-02507361/document
// Video: https://www.youtube.com/watch?v=NOinlrHyieE&feature=youtu.be
// Talk: https://www.youtube... | mit | [
1110,
1155,
1188,
1188,
1282
] | [
[
950,
964,
995,
995,
1108
],
[
1110,
1155,
1188,
1188,
1282
],
[
1284,
1373,
1407,
1407,
1443
],
[
1445,
1588,
1640,
1640,
1961
],
[
1963,
2068,
2116,
2116,
2159
],
[
2161,
2320,
2384... | // Cubic falloff
// x: distance
// R: radius
| float Falloff(float x, float R)
{ |
float xx = clamp(x / R, 0.0, 1.0);
float y = (1.0 - xx * xx);
return y * y * y;
} | // Cubic falloff
// x: distance
// R: radius
float Falloff(float x, float R)
{ | 1 | 1 |
WdVyDW | Moon519 | 2020-10-16T16:33:14 | // Shadertoy implementation of "Segment Tracing using Local Lipschitz Bounds" - Eurographics 2020
// Eric Galin, Eric Guérin, Axel Paris, Adrien Peytavie
// Paper: https://hal.archives-ouvertes.fr/hal-02507361/document
// Video: https://www.youtube.com/watch?v=NOinlrHyieE&feature=youtu.be
// Talk: https://www.youtube... | mit | [
1284,
1373,
1407,
1407,
1443
] | [
[
950,
964,
995,
995,
1108
],
[
1110,
1155,
1188,
1188,
1282
],
[
1284,
1373,
1407,
1407,
1443
],
[
1445,
1588,
1640,
1640,
1961
],
[
1963,
2068,
2116,
2116,
2159
],
[
2161,
2320,
2384... | // Computes the global lipschitz bound of the falloff function
// e: energy
// R: radius
| float FalloffK(float e, float R)
{ |
return e * 1.72 * abs(e) / R;
} | // Computes the global lipschitz bound of the falloff function
// e: energy
// R: radius
float FalloffK(float e, float R)
{ | 1 | 1 |
WdVyDW | Moon519 | 2020-10-16T16:33:14 | // Shadertoy implementation of "Segment Tracing using Local Lipschitz Bounds" - Eurographics 2020
// Eric Galin, Eric Guérin, Axel Paris, Adrien Peytavie
// Paper: https://hal.archives-ouvertes.fr/hal-02507361/document
// Video: https://www.youtube.com/watch?v=NOinlrHyieE&feature=youtu.be
// Talk: https://www.youtube... | mit | [
1445,
1588,
1640,
1640,
1961
] | [
[
950,
964,
995,
995,
1108
],
[
1110,
1155,
1188,
1188,
1282
],
[
1284,
1373,
1407,
1407,
1443
],
[
1445,
1588,
1640,
1640,
1961
],
[
1963,
2068,
2116,
2116,
2159
],
[
2161,
2320,
2384... | // Computes the local lipschitz bound of the falloff function
// a: value at first bound
// b: value at second bound
// R: radius
// e: energy
| float FalloffK(float a, float b, float R, float e)
{ |
if (a > R)
return 0.0;
if (b < R / 5.0)
{
float t = (1.0 - b / R);
return abs(e) * 6.0 * (sqrt(b) / R) * (t * t);
}
else if (a > (R * R) / 5.0)
{
float t = (1.0 - a / R);
return abs(e) * 6.0 * (sqrt(a) / R) * (t * t);
}
else
return FalloffK(e, R);
... | // Computes the local lipschitz bound of the falloff function
// a: value at first bound
// b: value at second bound
// R: radius
// e: energy
float FalloffK(float a, float b, float R, float e)
{ | 1 | 1 |
WdVyDW | Moon519 | 2020-10-16T16:33:14 | // Shadertoy implementation of "Segment Tracing using Local Lipschitz Bounds" - Eurographics 2020
// Eric Galin, Eric Guérin, Axel Paris, Adrien Peytavie
// Paper: https://hal.archives-ouvertes.fr/hal-02507361/document
// Video: https://www.youtube.com/watch?v=NOinlrHyieE&feature=youtu.be
// Talk: https://www.youtube... | mit | [
1963,
2068,
2116,
2116,
2159
] | [
[
950,
964,
995,
995,
1108
],
[
1110,
1155,
1188,
1188,
1282
],
[
1284,
1373,
1407,
1407,
1443
],
[
1445,
1588,
1640,
1640,
1961
],
[
1963,
2068,
2116,
2116,
2159
],
[
2161,
2320,
2384... | // Primitives
// Point primitive field function
// p: world point
// c: center
// R: radius
// e: energy
| float Vertex(vec3 p, vec3 c, float R, float e)
{ |
return e * Falloff(length(p - c), R);
} | // Primitives
// Point primitive field function
// p: world point
// c: center
// R: radius
// e: energy
float Vertex(vec3 p, vec3 c, float R, float e)
{ | 1 | 1 |
WdVyDW | Moon519 | 2020-10-16T16:33:14 | // Shadertoy implementation of "Segment Tracing using Local Lipschitz Bounds" - Eurographics 2020
// Eric Galin, Eric Guérin, Axel Paris, Adrien Peytavie
// Paper: https://hal.archives-ouvertes.fr/hal-02507361/document
// Video: https://www.youtube.com/watch?v=NOinlrHyieE&feature=youtu.be
// Talk: https://www.youtube... | mit | [
2161,
2320,
2384,
2384,
2944
] | [
[
950,
964,
995,
995,
1108
],
[
1110,
1155,
1188,
1188,
1282
],
[
1284,
1373,
1407,
1407,
1443
],
[
1445,
1588,
1640,
1640,
1961
],
[
1963,
2068,
2116,
2116,
2159
],
[
2161,
2320,
2384... | // Evaluates the local lipschitz bound of a point primitive over a segment [a, b]
// c: center
// R: radius
// e: energy
// a: segment start
// b: segment end
| float VertexKSegment(vec3 c, float R, float e, vec3 a, vec3 b)
{ |
vec3 axis = normalize(b - a);
float l = dot((c - a), axis);
float kk = 0.0;
if (l < 0.0)
{
kk = FalloffK(length(c - a), length(c - b), R, e);
}
else if (length(b - a) < l)
{
kk = FalloffK(length(c - b), length(c - a), R, e);
}
else
{
float dd = leng... | // Evaluates the local lipschitz bound of a point primitive over a segment [a, b]
// c: center
// R: radius
// e: energy
// a: segment start
// b: segment end
float VertexKSegment(vec3 c, float R, float e, vec3 a, vec3 b)
{ | 1 | 1 |
WdVyDW | Moon519 | 2020-10-16T16:33:14 | // Shadertoy implementation of "Segment Tracing using Local Lipschitz Bounds" - Eurographics 2020
// Eric Galin, Eric Guérin, Axel Paris, Adrien Peytavie
// Paper: https://hal.archives-ouvertes.fr/hal-02507361/document
// Video: https://www.youtube.com/watch?v=NOinlrHyieE&feature=youtu.be
// Talk: https://www.youtube... | mit | [
2946,
2959,
2981,
2981,
3189
] | [
[
950,
964,
995,
995,
1108
],
[
1110,
1155,
1188,
1188,
1282
],
[
1284,
1373,
1407,
1407,
1443
],
[
1445,
1588,
1640,
1640,
1961
],
[
1963,
2068,
2116,
2116,
2159
],
[
2161,
2320,
2384... | // Tree root
| float Object(vec3 p)
{ |
float I = Vertex(p, vec3(-radius / 2.0, 0, 0), radius, 1.0);
I += Vertex(p, vec3(radius / 2.0, 0, 0), radius, 1.0);
I += Vertex(p, vec3(radius / 3.0, radius, 0), radius, 1.0);
return I - T;
} | // Tree root
float Object(vec3 p)
{ | 1 | 4 |
WdVyDW | Moon519 | 2020-10-16T16:33:14 | // Shadertoy implementation of "Segment Tracing using Local Lipschitz Bounds" - Eurographics 2020
// Eric Galin, Eric Guérin, Axel Paris, Adrien Peytavie
// Paper: https://hal.archives-ouvertes.fr/hal-02507361/document
// Video: https://www.youtube.com/watch?v=NOinlrHyieE&feature=youtu.be
// Talk: https://www.youtube... | mit | [
3191,
3201,
3233,
3233,
3470
] | [
[
950,
964,
995,
995,
1108
],
[
1110,
1155,
1188,
1188,
1282
],
[
1284,
1373,
1407,
1407,
1443
],
[
1445,
1588,
1640,
1640,
1961
],
[
1963,
2068,
2116,
2116,
2159
],
[
2161,
2320,
2384... | // K root
| float KSegment(vec3 a, vec3 b)
{ |
float K = VertexKSegment(vec3(-radius / 2.0, 0, 0), radius, 1.0, a, b);
K += VertexKSegment(vec3(radius / 2.0, 0, 0), radius, 1.0, a, b);
K += VertexKSegment(vec3(radius / 3.0, radius, 0), radius, 1.0, a, b);
return K;
} | // K root
float KSegment(vec3 a, vec3 b)
{ | 1 | 1 |
WdVyDW | Moon519 | 2020-10-16T16:33:14 | // Shadertoy implementation of "Segment Tracing using Local Lipschitz Bounds" - Eurographics 2020
// Eric Galin, Eric Guérin, Axel Paris, Adrien Peytavie
// Paper: https://hal.archives-ouvertes.fr/hal-02507361/document
// Video: https://www.youtube.com/watch?v=NOinlrHyieE&feature=youtu.be
// Talk: https://www.youtube... | mit | [
3532,
3553,
3584,
3584,
3819
] | [
[
950,
964,
995,
995,
1108
],
[
1110,
1155,
1188,
1188,
1282
],
[
1284,
1373,
1407,
1407,
1443
],
[
1445,
1588,
1640,
1640,
1961
],
[
1963,
2068,
2116,
2116,
2159
],
[
2161,
2320,
2384... | // Normal evaluation
| vec3 ObjectNormal(in vec3 p )
{ |
float eps = 0.001;
float v = Object(p);
vec3 n;
n.x = Object(vec3(p.x + eps, p.y, p.z)) - v;
n.y = Object(vec3(p.x, p.y + eps, p.z)) - v;
n.z = Object(vec3(p.x, p.y, p.z + eps)) - v;
return normalize(n);
} | // Normal evaluation
vec3 ObjectNormal(in vec3 p )
{ | 1 | 28 |
WdVyDW | Moon519 | 2020-10-16T16:33:14 | // Shadertoy implementation of "Segment Tracing using Local Lipschitz Bounds" - Eurographics 2020
// Eric Galin, Eric Guérin, Axel Paris, Adrien Peytavie
// Paper: https://hal.archives-ouvertes.fr/hal-02507361/document
// Video: https://www.youtube.com/watch?v=NOinlrHyieE&feature=youtu.be
// Talk: https://www.youtube... | mit | [
3821,
3928,
3988,
3988,
4463
] | [
[
950,
964,
995,
995,
1108
],
[
1110,
1155,
1188,
1188,
1282
],
[
1284,
1373,
1407,
1407,
1443
],
[
1445,
1588,
1640,
1640,
1961
],
[
1963,
2068,
2116,
2116,
2159
],
[
2161,
2320,
2384... | // Trace ray using sphere tracing
// o : ray origin
// u : ray direction
// h : hit
// s : Number of steps
| float SphereTracing(vec3 o, vec3 u, out bool h, out int s)
{ |
float kGlobal = KGlobal();
float t = ra;
h = false;
s = 0;
for(int i = 0; i < StepsMax; i++)
{
vec3 p = o + t * u;
float v = Object(p);
s++;
// Hit object
if (v > 0.0)
{
h = true;
break;
}
// Move a... | // Trace ray using sphere tracing
// o : ray origin
// u : ray direction
// h : hit
// s : Number of steps
float SphereTracing(vec3 o, vec3 u, out bool h, out int s)
{ | 1 | 1 |
WdVyDW | Moon519 | 2020-10-16T16:33:14 | // Shadertoy implementation of "Segment Tracing using Local Lipschitz Bounds" - Eurographics 2020
// Eric Galin, Eric Guérin, Axel Paris, Adrien Peytavie
// Paper: https://hal.archives-ouvertes.fr/hal-02507361/document
// Video: https://www.youtube.com/watch?v=NOinlrHyieE&feature=youtu.be
// Talk: https://www.youtube... | mit | [
4465,
4570,
4631,
4631,
5512
] | [
[
950,
964,
995,
995,
1108
],
[
1110,
1155,
1188,
1188,
1282
],
[
1284,
1373,
1407,
1407,
1443
],
[
1445,
1588,
1640,
1640,
1961
],
[
1963,
2068,
2116,
2116,
2159
],
[
2161,
2320,
2384... | // Trace ray using ray marching
// o : ray origin
// u : ray direction
// h : hit
// s : Number of steps
| float SegmentTracing(vec3 o, vec3 u, out bool h, out int s)
{ |
float t = ra;
h = false;
float candidate = 1.0;
for(int i = 0; i < StepsMax; i++)
{
s++;
vec3 p = o + t * u;
float v = Object(p);
// Hit object
if (v > 0.0)
{
h = true;
break;
}
// Lipschitz ... | // Trace ray using ray marching
// o : ray origin
// u : ray direction
// h : hit
// s : Number of steps
float SegmentTracing(vec3 o, vec3 u, out bool h, out int s)
{ | 1 | 1 |
WdVyDW | Moon519 | 2020-10-16T16:33:14 | // Shadertoy implementation of "Segment Tracing using Local Lipschitz Bounds" - Eurographics 2020
// Eric Galin, Eric Guérin, Axel Paris, Adrien Peytavie
// Paper: https://hal.archives-ouvertes.fr/hal-02507361/document
// Video: https://www.youtube.com/watch?v=NOinlrHyieE&feature=youtu.be
// Talk: https://www.youtube... | mit | [
5514,
5535,
5561,
5561,
5683
] | [
[
950,
964,
995,
995,
1108
],
[
1110,
1155,
1188,
1188,
1282
],
[
1284,
1373,
1407,
1407,
1443
],
[
1445,
1588,
1640,
1640,
1961
],
[
1963,
2068,
2116,
2116,
2159
],
[
2161,
2320,
2384... | // Shading functions
| vec3 Background(vec3 rd)
{ |
const vec3 C1 = vec3(0.8, 0.8, 0.9);
const vec3 C2 = vec3(0.6, 0.8, 1.0);
return mix(C1, C2, rd.y * 1.0 + 0.25);
} | // Shading functions
vec3 Background(vec3 rd)
{ | 1 | 6 |
WsVcRd | pikmin2010 | 2020-10-25T01:49:01 | // 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 | [
2956,
2981,
3032,
3032,
3387
] | [
[
1622,
1622,
1647,
1647,
1666
],
[
1667,
1667,
1692,
1692,
1711
],
[
1712,
1712,
1748,
1748,
1776
],
[
1780,
1826,
1853,
1853,
2000
],
[
2002,
2048,
2075,
2075,
2222
],
[
2224,
2270,
... | // arbitrary orientation
| float sdCylinder(vec3 p, vec3 a, vec3 b, float r)
{ |
vec3 pa = p - a;
vec3 ba = b - a;
float baba = dot(ba,ba);
float paba = dot(pa,ba);
float x = length(pa*baba-ba*paba) - r*baba;
float y = abs(paba-baba*0.5)-baba*0.5;
float x2 = x*x;
float y2 = y*y*baba;
float d = (max(x,y)<0.0)?-min(x2,y2):(((x>0.0)?x2:0.0)+((y>0.0)?y2:0.0));
... | // arbitrary orientation
float sdCylinder(vec3 p, vec3 a, vec3 b, float r)
{ | 13 | 23 |
wdGfzD | IWBTShyGuy | 2020-11-29T18:44:50 | // Copyright © 2020 IWBTShyGuy
// Attribution 4.0 International (CC BY 4.0)
const float PI = 3.141592653;
const float PI2 = 2.0 * PI;
// square
const int N = 4;
// the circumradius of polygon
const float R_POLY = 0.4;
const float SCREW_THICKNESS = 0.02;
// the half of thickness of polygon edges
const float THICKNE... | cc-by-4.0 | [
602,
636,
663,
663,
922
] | [
[
602,
636,
663,
663,
922
],
[
1170,
1170,
1199,
1199,
1308
],
[
1310,
1310,
1356,
1356,
1478
],
[
1480,
1480,
1510,
1510,
2066
],
[
2068,
2068,
2137,
2137,
2970
],
[
2972,
2972,
3043,... | // normalized fragment coordinate
| vec2 uv_coord(vec2 coord) { |
int max_idx = iResolution.x > iResolution.y ? 0 : 1;
int min_idx = 1 - max_idx;
vec2 aspect_vec = vec2(1.0, 1.0);
aspect_vec[max_idx] = iResolution[max_idx] / iResolution[min_idx];
return 2.0 * coord / iResolution[min_idx] - aspect_vec;
} | // normalized fragment coordinate
vec2 uv_coord(vec2 coord) { | 1 | 1 |
3dyfDd | iq | 2020-12-17T12:19:02 | // The MIT License
// Copyright © 2020 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 | [
1438,
1533,
1584,
1584,
1992
] | [
[
1438,
1533,
1584,
1584,
1992
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdgTriangleIsosceles( in vec2 p, in vec2 q )
{ |
float w = sign(p.x);
p.x = abs(p.x);
vec2 a = p - q*clamp( dot(p,q)/dot(q,q), 0.0, 1.0 );
vec2 b = p - q*vec2( clamp( p.x/q.x, 0.0, 1.0 ), 1.0 );
float k = sign( q.y );
float l1 = dot(a,a);
float l2 = dot(b,b);
float d = sqrt((l1<l2)?l1:l2);
vec2 g = (l1<l2)? a: b;
float s = ... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdgTriangleIsosceles( in vec2 p, in vec2 q )
{ | 1 | 1 |
3lGXRc | iq | 2021-01-18T05:50:56 | // 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 | [
1402,
1497,
1539,
1539,
1970
] | [
[
1402,
1497,
1539,
1539,
1970
],
[
1972,
1972,
2029,
2029,
2745
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdgVesica(vec2 p, float r, float d)
{ |
vec2 s = sign(p); p = abs(p);
float b = sqrt(r*r-d*d); // can delay this sqrt by rewriting the comparison
vec3 res;
if( (p.y-b)*d > p.x*b )
{
vec2 q = vec2(p.x,p.y-b);
float l = length(q)*sign(d);
res = vec3( l, q/l );
}
else
{
vec2 q = vec2(p.x+... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdgVesica(vec2 p, float r, float d)
{ | 2 | 2 |
3tGXRc | iq | 2021-01-18T05:35:51 | // 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 | [
1398,
1543,
1592,
1592,
1868
] | [
[
1398,
1543,
1592,
1592,
1868
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
// c is the sin/cos of the angle. r is the radius
| vec3 sdgPie( in vec2 p, in vec2 c, in float r )
{ |
float s = sign(p.x); p.x = abs(p.x);
float l = length(p);
float n = l - r;
vec2 q = p - c*clamp(dot(p,c),0.0,r);
float m = length(q)* sign(c.y*p.x-c.x*p.y);
vec3 res = (n>m) ? vec3(n,p/l) : vec3(m,q/m);
return vec3(res.x,s*res.y,res.z);
} | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
// c is the sin/cos of the angle. r is the radius
vec3 sdgPie( in vec2 p, in vec2 c, in float r )
{ | 1 | 1 |
tlVyWh | iq | 2021-01-18T04:33:35 | // 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 | [
2203,
2298,
2343,
2343,
3260
] | [
[
2138,
2138,
2173,
2173,
2201
],
[
2203,
2298,
2343,
2343,
3260
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdgTriangle( in vec2 p, in vec2 v[3] )
{ |
float gs = cro(v[0]-v[2],v[1]-v[0]);
vec4 res;
// edge 0
{
vec2 e = v[1]-v[0];
vec2 w = p-v[0];
vec2 q = w-e*clamp(dot(w,e)/dot(e,e),0.0,1.0);
float d = dot(q,q);
float s = gs*cro(w,e);
res = vec4(d,q,s);
}
// edge 1
{
vec2 e = v[2]-v[1];
vec2 w =... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdgTriangle( in vec2 p, in vec2 v[3] )
{ | 1 | 1 |
wlccR2 | butadiene | 2021-01-11T04:43:22 |
// Description : GLSL 2D simplex noise function
// Author : Ian McEwan, Ashima Arts
// Maintainer : ijm
// Lastmod : 20110822 (ijm)
// License :
// Copyright (C) 2011 Ashima Arts. All rights reserved.
// Distributed under the MIT License. See LICENSE file.
// https://github.com/ashima/webgl-noise
//
/... | mit | [
1,
439,
460,
460,
507
] | [
[
1,
439,
460,
460,
507
],
[
508,
508,
529,
529,
576
],
[
577,
577,
599,
599,
634
],
[
636,
636,
658,
711,
2408
],
[
2429,
2517,
2553,
2553,
2698
],
[
2700,
2700,
2724,
2724,
3... | // Description : GLSL 2D simplex noise function
// Author : Ian McEwan, Ashima Arts
// Maintainer : ijm
// Lastmod : 20110822 (ijm)
// License :
// Copyright (C) 2011 Ashima Arts. All rights reserved.
// Distributed under the MIT License. See LICENSE file.
// https://github.com/ashima/webgl-noise
//
//... | vec3 mod289(vec3 x) { | return x - floor(x * (1.0 / 289.0)) * 289.0; } | // Description : GLSL 2D simplex noise function
// Author : Ian McEwan, Ashima Arts
// Maintainer : ijm
// Lastmod : 20110822 (ijm)
// License :
// Copyright (C) 2011 Ashima Arts. All rights reserved.
// Distributed under the MIT License. See LICENSE file.
// https://github.com/ashima/webgl-noise
//
//... | 56 | 179 |
wlccR2 | butadiene | 2021-01-11T04:43:22 |
// Description : GLSL 2D simplex noise function
// Author : Ian McEwan, Ashima Arts
// Maintainer : ijm
// Lastmod : 20110822 (ijm)
// License :
// Copyright (C) 2011 Ashima Arts. All rights reserved.
// Distributed under the MIT License. See LICENSE file.
// https://github.com/ashima/webgl-noise
//
/... | mit | [
2429,
2517,
2553,
2553,
2698
] | [
[
1,
439,
460,
460,
507
],
[
508,
508,
529,
529,
576
],
[
577,
577,
599,
599,
634
],
[
636,
636,
658,
711,
2408
],
[
2429,
2517,
2553,
2553,
2698
],
[
2700,
2700,
2724,
2724,
3... | // Ridged multifractal
// See "Texturing & Modeling, A Procedural Approach", Chapter 12
| float ridge(float h, float offset) { |
h = abs(h); // create creases
h = offset - h; // invert so creases are at top
h = h * h; // sharpen creases
return h;
} | // Ridged multifractal
// See "Texturing & Modeling, A Procedural Approach", Chapter 12
float ridge(float h, float offset) { | 2 | 2 |
WtGXRc | iq | 2021-01-20T05:53:42 | // The MIT License
// Copyright © 2020 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 | [
2139,
2313,
2391,
2391,
2794
] | [
[
2139,
2313,
2391,
2391,
2794
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
// sca is the sin/cos of the orientation
// scb is the sin/cos of the aperture
| vec3 sdgArc( in vec2 p, in vec2 sca, in vec2 scb, in float ra, in float rb )
{ |
vec2 q = p;
mat2 ma = mat2(sca.x,-sca.y,sca.y,sca.x);
p = ma*p;
float s = sign(p.x); p.x = abs(p.x);
if( scb.y*p.x > scb.x*p.y )
{
vec2 w = p - ra*scb;
float d = length(w);
return vec3( d-rb, vec2(s*w.x,w.y)*ma/d );
}
else
{
float l = length(q... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
// sca is the sin/cos of the orientation
// scb is the sin/cos of the aperture
vec3 sdgArc( in vec2 p, in vec2 sca, in vec2 scb, in float ra, in float rb )
{ | 1 | 1 |
WtVcD1 | iq | 2021-01-18T04:35:08 | // 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 | [
1401,
1496,
1531,
1531,
1559
] | [
[
1401,
1496,
1531,
1531,
1559
],
[
1560,
1560,
1601,
1601,
2796
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
| float cro( in vec2 a, in vec2 b ) { | return a.x*b.y - a.y*b.x; } | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
float cro( in vec2 a, in vec2 b ) { | 8 | 8 |
3lcfR8 | iq | 2021-02-01T13:38:00 | // 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 | [
2323,
2418,
2457,
2473,
3159
] | [
[
2323,
2418,
2457,
2473,
3159
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdgEllipse( vec2 p, in vec2 ab )
{ |
vec2 sp = sign(p);
p = abs( p );
// determine in/out and initial value
bool s = dot(p/ab,p/ab)>1.0;
float w = atan(p.y*ab.x, p.x*ab.y);
if(!s) w=(ab.x*(p.x-ab.x)<ab.y*(p.y-ab.y))? 1.570796327 : 0.0;
// Newton root solver
for( int i=0; i<4; i++ )
{
vec2 cs = vec2(cos(w),s... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdgEllipse( vec2 p, in vec2 ab )
{ | 1 | 1 |
wlyBWm | PauloFalcao | 2021-02-27T18:14:26 | // Smooth Repetition
// by @paulofalcao
//
// CC0 1.0 Universal https://creativecommons.org/publicdomain/zero/1.0/
//
// Twitter: @paulofalcao
// https://twitter.com/paulofalcao/status/1365726720695934979
//
// YouTube playing with this and Material Maker
// https://www.youtube.com/watch?v=HoAQ7DFRzQE
//
// I was using... | cc0-1.0 | [
873,
1012,
1076,
1076,
1148
] | [
[
873,
1012,
1076,
1076,
1148
],
[
1281,
1281,
1336,
1336,
1545
],
[
1974,
1974,
1999,
1999,
2014
],
[
2016,
2016,
2061,
2061,
2152
],
[
2154,
2154,
2187,
2187,
2242
],
[
2315,
2315,
2... | //Change asin_sin_mode to true to use this mode (default)
//blackle mode asin(sin(x)*S) with S between 0 and 1 (higher values less smooth)
| vec2 smoothrepeat_asin_sin(vec2 p,float smooth_size,float size){ |
p/=size;
p=asin(sin(p)*(1.0-smooth_size));
return p*size;
} | //Change asin_sin_mode to true to use this mode (default)
//blackle mode asin(sin(x)*S) with S between 0 and 1 (higher values less smooth)
vec2 smoothrepeat_asin_sin(vec2 p,float smooth_size,float size){ | 2 | 2 |
wtcfzM | iq | 2021-02-04T12:38:04 | // 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 | [
1490,
1607,
1652,
1652,
1777
] | [
[
1490,
1607,
1652,
1652,
1777
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .w = ∂f(p)/∂z
// .yzw = ∇f(p) with ‖∇f(p)‖ = 1
| vec4 sdgTorus( vec3 p, float ra, float rb )
{ |
float h = length(p.xz);
return vec4( length(vec2(h-ra,p.y))-rb,
normalize(p*vec3(h-ra,h,h-ra)) );
} | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .w = ∂f(p)/∂z
// .yzw = ∇f(p) with ‖∇f(p)‖ = 1
vec4 sdgTorus( vec3 p, float ra, float rb )
{ | 2 | 2 |
WttfR7 | iq | 2021-02-04T12:39:44 | // 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 | [
1488,
1605,
1657,
1657,
1831
] | [
[
1488,
1605,
1657,
1657,
1831
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .w = ∂f(p)/∂z
// .yzw = ∇f(p) with ‖∇f(p)‖ = 1
| vec4 sdgSegment( vec3 p, vec3 a, vec3 b, float r )
{ |
vec3 ba = b-a;
vec3 pa = p-a;
float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
vec3 q = pa-h*ba;
float d = length(q);
return vec4(d-r,q/d);
} | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .w = ∂f(p)/∂z
// .yzw = ∇f(p) with ‖∇f(p)‖ = 1
vec4 sdgSegment( vec3 p, vec3 a, vec3 b, float r )
{ | 1 | 1 |
7dlGRf | iq | 2021-03-22T09:36:51 | // 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 | [
1491,
1554,
1622,
1622,
2035
] | [
[
1491,
1554,
1622,
1622,
2035
],
[
2037,
2037,
2105,
2105,
2572
],
[
2574,
2574,
2642,
2655,
3117
],
[
3119,
3119,
3185,
3185,
3400
],
[
3402,
3402,
3459,
3459,
4236
]
] | // signed distance to a 2D parallelogram (width, height, skew)
| float sdParallelogram_1( in vec2 p, float wi, float he, float sk )
{ |
vec2 e = vec2(sk,he);
float e2 = sk*sk + he*he;
p = (p.y<0.0)?-p:p;
// horizontal edge
vec2 w = p - e; w.x -= clamp(w.x,-wi,wi);
vec2 d = vec2(dot(w,w), -w.y);
// vertical edge
float s = p.x*e.y - p.y*e.x;
p = (s<0.0)?-p:p;
vec2 v = p - vec2(wi,0); v -= e*clamp(dot(v,e)/e2... | // signed distance to a 2D parallelogram (width, height, skew)
float sdParallelogram_1( in vec2 p, float wi, float he, float sk )
{ | 1 | 1 |
sssGzX | iq | 2021-03-22T18:46:06 | // 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 | [
1408,
1503,
1569,
1569,
2183
] | [
[
1408,
1503,
1569,
1569,
2183
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdgParallelogram( in vec2 p, float wi, float he, float sk )
{ |
vec2 e = vec2(sk,he);
float v = 1.0;
if( p.y<0.0 ) { p=-p;v=-v;}
// horizontal edge
vec2 w = p - e; w.x -= clamp(w.x,-wi,wi);
vec4 dsg = vec4(dot(w,w),v*w,w.y);
// vertical edge
float s = p.x*e.y - p.y*e.x;
if( s<0.0 ) { p=-p; v=-v; }
vec2 q = p - vec2(wi,0); q -= e*clam... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdgParallelogram( in vec2 p, float wi, float he, float sk )
{ | 1 | 1 |
WlGfWc | jorge2017a1 | 2021-03-07T21:16:49 | //Modificado por jorge2017a1 ----jorgeFloresP
//Referencia de IQ https://www.shadertoy.com/view/wdBXRW
// The MIT License
// Copyright © 2019 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 th... | mit | [
1977,
2015,
2051,
2051,
2096
] | [
[
1809,
1809,
1842,
1842,
1864
],
[
1865,
1865,
1898,
1898,
1920
],
[
1921,
1921,
1954,
1954,
1975
],
[
1977,
2015,
2051,
2051,
2096
],
[
2097,
2110,
2147,
2147,
2227
],
[
2230,
2230,
... | //----------oPeraciones de Repeticion
| float opRep1D( float p, float c )
{ | float q = mod(p+0.5*c,c)-0.5*c; return q ;} | //----------oPeraciones de Repeticion
float opRep1D( float p, float c )
{ | 121 | 121 |
7d23DR | mrange | 2021-04-01T09:24:32 | // License CC0: 2D Amoebas
// While messing around I stumbled on a simple "amoeba" lika effect.
// Nothing complicated but nice IMHO so I shared
#define RESOLUTION iResolution
#define TIME iTime
float circle(vec2 p, float r) {
return length(p) - r;
}
// IQ's polynominal min
float pmin(float a, float b, flo... | cc0-1.0 | [
264,
288,
327,
327,
420
] | [
[
205,
205,
236,
236,
262
],
[
264,
288,
327,
327,
420
],
[
422,
453,
489,
489,
583
],
[
586,
586,
604,
634,
1068
],
[
1070,
1070,
1107,
1107,
1359
],
[
1361,
1361,
1416,
1416,
... | // IQ's polynominal min
| 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);
} | // IQ's polynominal min
float pmin(float a, float b, float k) { | 6 | 107 |
7d23DR | mrange | 2021-04-01T09:24:32 | // License CC0: 2D Amoebas
// While messing around I stumbled on a simple "amoeba" lika effect.
// Nothing complicated but nice IMHO so I shared
#define RESOLUTION iResolution
#define TIME iTime
float circle(vec2 p, float r) {
return length(p) - r;
}
// IQ's polynominal min
float pmin(float a, float b, flo... | cc0-1.0 | [
422,
453,
489,
489,
583
] | [
[
205,
205,
236,
236,
262
],
[
264,
288,
327,
327,
420
],
[
422,
453,
489,
489,
583
],
[
586,
586,
604,
634,
1068
],
[
1070,
1070,
1107,
1107,
1359
],
[
1361,
1361,
1416,
1416,
... | // http://mercury.sexy/hg_sdf/
| vec2 mod2(inout vec2 p, vec2 size) { |
vec2 c = floor((p + size*0.5)/size);
p = mod(p + size*0.5,size) - size*0.5;
return c;
} | // http://mercury.sexy/hg_sdf/
vec2 mod2(inout vec2 p, vec2 size) { | 52 | 53 |
fdXXR4 | mrange | 2021-04-13T08:04:55 | // License CC0: Starry background with nebula
// Created for another shader but thought the background could be useful to others so extracted it
// Controls how many layers of stars
#define LAYERS 5.0
// QUINTIC or HERMITE interpolation?
#define QUINTIC
// How often to change the nebula
#define PERIOD ... | cc0-1.0 | [
1991,
2031,
2053,
2053,
2625
] | [
[
666,
666,
694,
714,
790
],
[
792,
792,
814,
814,
862
],
[
864,
864,
885,
885,
967
],
[
969,
969,
989,
989,
1126
],
[
1128,
1207,
1229,
1229,
1398
],
[
1400,
1431,
1467,
1467,
... | // From one of IQ's value noise shaders
| float vnoise(vec2 x) { |
vec2 i = floor(x);
vec2 w = fract(x);
#ifdef QUINTIC
// quintic interpolation
vec2 u = w*w*w*(w*(w*6.0-15.0)+10.0);
#else
// cubic interpolation
vec2 u = w*w*(3.0-2.0*w);
#endif
float a = hash(i+vec2(0.0,0.0));
float b = hash(i+vec2(1.0,0.0));
float c = hash(i+vec2(0.0,1.0));
float d = hash(i... | // From one of IQ's value noise shaders
float vnoise(vec2 x) { | 1 | 5 |
NdS3WW | mrange | 2021-04-02T13:52:21 | // License CC0: The monolith, 1x4x9
#define TOLERANCE 0.0001
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
#define L2(x) dot(x, x)
#define PCOS(x) (0.5 + 0.5*cos(x))
#define SKYCOLOR(ro, rd) skyColor(... | cc0-1.0 | [
994,
1073,
1095,
1095,
1264
] | [
[
715,
715,
743,
763,
839
],
[
841,
865,
904,
904,
992
],
[
994,
1073,
1095,
1095,
1264
],
[
1266,
1298,
1340,
1340,
1599
],
[
1601,
1630,
1697,
1697,
2175
],
[
2177,
2177,
2220,
2... | // https://stackoverflow.com/questions/15095909/from-rgb-to-hsv-in-opengl-glsl
| vec3 hsv2rgb(vec3 c) { |
const vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
} | // https://stackoverflow.com/questions/15095909/from-rgb-to-hsv-in-opengl-glsl
vec3 hsv2rgb(vec3 c) { | 22 | 237 |
NdS3WW | mrange | 2021-04-02T13:52:21 | // License CC0: The monolith, 1x4x9
#define TOLERANCE 0.0001
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
#define L2(x) dot(x, x)
#define PCOS(x) (0.5 + 0.5*cos(x))
#define SKYCOLOR(ro, rd) skyColor(... | cc0-1.0 | [
1266,
1298,
1340,
1340,
1599
] | [
[
715,
715,
743,
763,
839
],
[
841,
865,
904,
904,
992
],
[
994,
1073,
1095,
1095,
1264
],
[
1266,
1298,
1340,
1340,
1599
],
[
1601,
1630,
1697,
1697,
2175
],
[
2177,
2177,
2220,
2... | // IQ's ray sphere intersection
| vec2 raySphere(vec3 ro, vec3 rd, vec4 s) { |
vec3 ce = s.xyz;
float ra = s.w;
vec3 oc = ro - ce;
float b = dot( oc, rd );
float c = dot( oc, oc ) - ra*ra;
float h = b*b - c;
if( h<0.0 ) return vec2(miss); // no intersection
h = sqrt( h );
return vec2( -b-h, -b+h );
} | // IQ's ray sphere intersection
vec2 raySphere(vec3 ro, vec3 rd, vec4 s) { | 2 | 2 |
NdS3WW | mrange | 2021-04-02T13:52:21 | // License CC0: The monolith, 1x4x9
#define TOLERANCE 0.0001
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
#define L2(x) dot(x, x)
#define PCOS(x) (0.5 + 0.5*cos(x))
#define SKYCOLOR(ro, rd) skyColor(... | cc0-1.0 | [
1601,
1630,
1697,
1697,
2175
] | [
[
715,
715,
743,
763,
839
],
[
841,
865,
904,
904,
992
],
[
994,
1073,
1095,
1095,
1264
],
[
1266,
1298,
1340,
1340,
1599
],
[
1601,
1630,
1697,
1697,
2175
],
[
2177,
2177,
2220,
2... | // IQ's ray box intersection
| vec2 rayBox(vec3 ro, vec3 rd, vec3 boxSize, out vec3 outNormal ) { |
vec3 m = 1.0/rd; // can precompute if traversing a set of aligned boxes
vec3 n = m*ro; // can precompute if traversing a set of aligned boxes
vec3 k = abs(m)*boxSize;
vec3 t1 = -n - k;
vec3 t2 = -n + k;
float tN = max( max( t1.x, t1.y ), t1.z );
float tF = min( min( t2.x, t2.y ), t2.z );
... | // IQ's ray box intersection
vec2 rayBox(vec3 ro, vec3 rd, vec3 boxSize, out vec3 outNormal ) { | 1 | 3 |
NdsSRM | Dain | 2021-04-14T12:40:26 | // The MIT License
// 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, distribute, sublicense, and/... | mit | [
1680,
1865,
1918,
1975,
2468
] | [
[
1680,
1865,
1918,
1975,
2468
],
[
2470,
2538,
2589,
2589,
2675
]
] | //A Z up oval, similiar to a capsule with a customizable mid radius
// .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .w = ∂f(p)/∂z
// .yzw = ∇f(p) with ‖∇f(p)‖ = 1
| vec4 sdgOvalZ(vec3 pIn, float a, float b, float h) { |
float r = a - b; //a must be greater than b!
float l = (h * h - r * r) / (r+r);
float sub2 = (a + l);
float sub1 = sub2 - length(vec2(h, l));
vec2 p = vec2(length(pIn.xy), abs(pIn.z) );
bool isTop =((p.y-h)*l) > p.x * h;
float y = isTop? h: 0.0;
float x = isTop ? 0.0: l;
vec2 p2 = ve... | //A Z up oval, similiar to a capsule with a customizable mid radius
// .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .w = ∂f(p)/∂z
// .yzw = ∇f(p) with ‖∇f(p)‖ = 1
vec4 sdgOvalZ(vec3 pIn, float a, float b, float h) { | 1 | 1 |
NdsSRM | Dain | 2021-04-14T12:40:26 | // The MIT License
// 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, distribute, sublicense, and/... | mit | [
2470,
2538,
2589,
2589,
2675
] | [
[
1680,
1865,
1918,
1975,
2468
],
[
2470,
2538,
2589,
2589,
2675
]
] | //This shader assumes Y is up, so wrapping it to call the Z up oval
| vec4 sdgOvalY(vec3 p, float a, float b, float h) { |
p.xyz = p.xzy;
vec4 r= sdgOvalZ(p, a,b,h);
r.yzw = r.ywz;
return r;
} | //This shader assumes Y is up, so wrapping it to call the Z up oval
vec4 sdgOvalY(vec3 p, float a, float b, float h) { | 1 | 1 |
sdSSzz | mrange | 2021-04-27T17:05:27 | // License CC0: Crystal skull
// Perhaps it's just me that sees a glowing skull captured in a crystal?
// Result after continued experimenting with marble fractals and different kinds of trap functions
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), sin(a), ... | cc0-1.0 | [
1304,
1422,
1468,
1468,
2313
] | [
[
906,
906,
934,
954,
1030
],
[
1032,
1111,
1133,
1133,
1302
],
[
1304,
1422,
1468,
1468,
2313
],
[
2315,
2315,
2345,
2345,
2382
],
[
2384,
2384,
2431,
2509,
2688
],
[
2690,
2690,
2733... | // Various ray object intersection from IQ:
// https://www.iquilezles.org/www/articles/intersectors/intersectors.htm
| float raySphere4(vec3 ro, vec3 rd, float ra) { |
float r2 = ra*ra;
vec3 d2 = rd*rd; vec3 d3 = d2*rd;
vec3 o2 = ro*ro; vec3 o3 = o2*ro;
float ka = 1.0/dot(d2,d2);
float k3 = ka* dot(ro,d3);
float k2 = ka* dot(o2,d2);
float k1 = ka* dot(o3,rd);
float k0 = ka*(dot(o2,o2) - r2*r2);
float c2 = k2 - k3*k3;
float c1 = k1 + 2.0*k3*k3*... | // Various ray object intersection from IQ:
// https://www.iquilezles.org/www/articles/intersectors/intersectors.htm
float raySphere4(vec3 ro, vec3 rd, float ra) { | 2 | 3 |
sdSSzz | mrange | 2021-04-27T17:05:27 | // License CC0: Crystal skull
// Perhaps it's just me that sees a glowing skull captured in a crystal?
// Result after continued experimenting with marble fractals and different kinds of trap functions
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), sin(a), ... | cc0-1.0 | [
3880,
3941,
3960,
3960,
4010
] | [
[
906,
906,
934,
954,
1030
],
[
1032,
1111,
1133,
1133,
1302
],
[
1304,
1422,
1468,
1468,
2313
],
[
2315,
2315,
2345,
2345,
2382
],
[
2384,
2384,
2431,
2509,
2688
],
[
2690,
2690,
2733... | // Marble fractal from https://www.shadertoy.com/view/MtX3Ws
| vec2 csqr(vec2 a) { |
return vec2(a.x*a.x - a.y*a.y, 2.*a.x*a.y);
} | // Marble fractal from https://www.shadertoy.com/view/MtX3Ws
vec2 csqr(vec2 a) { | 1 | 3 |
flsGDH | blackle | 2021-05-26T07:32:11 | //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 is further explorations in how domain repetition works
//and under what scenarios a naively domain repeated object migh... | cc0-1.0 | [
2564,
2625,
2650,
2650,
2693
] | [
[
1190,
1190,
1228,
1228,
1292
],
[
1294,
1294,
1321,
1321,
1403
],
[
1405,
1405,
1424,
1424,
1485
],
[
1487,
1487,
1528,
1528,
1639
],
[
1650,
1650,
1671,
1671,
2422
],
[
2424,
2424,
... | // https://iquilezles.org/www/articles/palettes/palettes.htm
| vec3 palette( float t )
{ |
return cos(t+vec3(0,1.8,3.2))*.4+.6;
} | // https://iquilezles.org/www/articles/palettes/palettes.htm
vec3 palette( float t )
{ | 1 | 8 |
NtsGWH | blackle | 2021-05-26T05:42:13 | //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.
float nozerosgn(float x) { return step(0.,x)*2.-1.; }
vec2 nozerosgn(vec2 x) { return step(0.,x)*2.-1.; }
//returns the vec... | cc0-1.0 | [
303,
448,
536,
633,
1009
] | [
[
194,
194,
220,
220,
247
],
[
248,
248,
274,
274,
301
],
[
303,
448,
536,
633,
1009
],
[
1011,
1139,
1179,
1179,
1268
],
[
1269,
1269,
1313,
1313,
1392
],
[
1394,
1394,
1413,
1413... | //returns the vectors pointing to each edge of the box with dimensions d,
//ordered by closeness to the point p. only valid inside the rectangle
| void edge4(vec2 p, vec2 d, inout vec2 e1, inout vec2 e2, inout vec2 e3, inout vec2 e4) { |
vec3 p3 = vec3(nozerosgn(p), 0); //this lets us construct the edge vectors
p = abs(p);
float c2 = nozerosgn(p.x+p.y-d.x-d.y+min(d.x,d.y)*2.);
e1 = (p.x-d.x < p.y-d.y) ? p3.zy : p3.xz;
e2 = c2*((c2 < 0. == p.x-d.x < p.y-d.y) ? p3.zy : p3.xz);
e3 = -c2*((c2 < 0. == p.x+d.x < p.y+d.y) ? p3.zy : p... | //returns the vectors pointing to each edge of the box with dimensions d,
//ordered by closeness to the point p. only valid inside the rectangle
void edge4(vec2 p, vec2 d, inout vec2 e1, inout vec2 e2, inout vec2 e3, inout vec2 e4) { | 1 | 1 |
NtsGWH | blackle | 2021-05-26T05:42:13 | //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.
float nozerosgn(float x) { return step(0.,x)*2.-1.; }
vec2 nozerosgn(vec2 x) { return step(0.,x)*2.-1.; }
//returns the vec... | cc0-1.0 | [
1011,
1139,
1179,
1179,
1268
] | [
[
194,
194,
220,
220,
247
],
[
248,
248,
274,
274,
301
],
[
303,
448,
536,
633,
1009
],
[
1011,
1139,
1179,
1179,
1268
],
[
1269,
1269,
1313,
1313,
1392
],
[
1394,
1394,
1413,
1413... | //rest of this is visualization code
//colours in box cycle between the boundaries for the 1st, 2nd, 3rd, and 4th closest edge.
| float linedist(vec2 p, vec2 a, vec2 b) { |
float k = dot(p-a,b-a)/dot(b-a,b-a);
return length(p-mix(a,b,clamp(k,0.,1.)));
} | //rest of this is visualization code
//colours in box cycle between the boundaries for the 1st, 2nd, 3rd, and 4th closest edge.
float linedist(vec2 p, vec2 a, vec2 b) { | 1 | 14 |
7l23zK | weasel | 2021-06-22T13:35:25 | // The MIT License
// Copyright © 2021 Henrik Dick
// 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, publi... | mit | [
1315,
1335,
1354,
1354,
1451
] | [
[
1186,
1199,
1217,
1217,
1313
],
[
1315,
1335,
1354,
1354,
1451
],
[
1453,
1490,
1516,
1516,
1726
],
[
1728,
1751,
1770,
1770,
1818
],
[
1820,
1846,
1873,
1873,
1938
],
[
1940,
1963,
... | // double factorial
| float dfac(int n) { |
float res = 1.0;
for (int i = n; i > 1; i-=2)
res *= float(i);
return res;
} | // double factorial
float dfac(int n) { | 3 | 3 |
7l23zK | weasel | 2021-06-22T13:35:25 | // The MIT License
// Copyright © 2021 Henrik Dick
// 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, publi... | mit | [
1453,
1490,
1516,
1516,
1726
] | [
[
1186,
1199,
1217,
1217,
1313
],
[
1315,
1335,
1354,
1354,
1451
],
[
1453,
1490,
1516,
1516,
1726
],
[
1728,
1751,
1770,
1770,
1818
],
[
1820,
1846,
1873,
1873,
1938
],
[
1940,
1963,
... | // fac(l-m)/fac(l+m) but more stable
| float fac2(int l, int m) { |
int am = abs(m);
if (am > l)
return 0.0;
float res = 1.0;
for (int i = max(l-am+1,2); i <= l+am; i++)
res *= float(i);
if (m < 0)
return res;
return 1.0 / res;
} | // fac(l-m)/fac(l+m) but more stable
float fac2(int l, int m) { | 3 | 3 |
7l23zK | weasel | 2021-06-22T13:35:25 | // The MIT License
// Copyright © 2021 Henrik Dick
// 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, publi... | mit | [
1728,
1751,
1770,
1770,
1818
] | [
[
1186,
1199,
1217,
1217,
1313
],
[
1315,
1335,
1354,
1354,
1451
],
[
1453,
1490,
1516,
1516,
1726
],
[
1728,
1751,
1770,
1770,
1818
],
[
1820,
1846,
1873,
1873,
1938
],
[
1940,
1963,
... | // complex exponential
| vec2 cexp(vec2 c) { |
return exp(c.x)*vec2(cos(c.y), sin(c.y));
} | // complex exponential
vec2 cexp(vec2 c) { | 3 | 3 |
7l23zK | weasel | 2021-06-22T13:35:25 | // The MIT License
// Copyright © 2021 Henrik Dick
// 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, publi... | mit | [
1820,
1846,
1873,
1873,
1938
] | [
[
1186,
1199,
1217,
1217,
1313
],
[
1315,
1335,
1354,
1354,
1451
],
[
1453,
1490,
1516,
1516,
1726
],
[
1728,
1751,
1770,
1770,
1818
],
[
1820,
1846,
1873,
1873,
1938
],
[
1940,
1963,
... | // complex multiplication
| vec2 cmul(vec2 a, vec2 b) { |
return vec2(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
} | // complex multiplication
vec2 cmul(vec2 a, vec2 b) { | 5 | 15 |
7l23zK | weasel | 2021-06-22T13:35:25 | // The MIT License
// Copyright © 2021 Henrik Dick
// 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, publi... | mit | [
2119,
2154,
2198,
2198,
2675
] | [
[
1186,
1199,
1217,
1217,
1313
],
[
1315,
1335,
1354,
1354,
1451
],
[
1453,
1490,
1516,
1516,
1726
],
[
1728,
1751,
1770,
1770,
1818
],
[
1820,
1846,
1873,
1873,
1938
],
[
1940,
1963,
... | // associated legendre polynomials
| float legendre_poly(float x, int l, int m) { |
if (l < abs(m))
return 0.0;
if (l == 0)
return 1.0;
float mul = m >= 0 ? 1.0 : float((~m&1)*2-1)*fac2(l,m);
m = abs(m);
// recursive calculation of legendre polynomial
float lp1 = 0.0;
float lp2 = float((~m&1)*2-1)*dfac(2*m-1)*pow(max(1.0-x*x, 1e-7), float(m)/2.0);
for (... | // associated legendre polynomials
float legendre_poly(float x, int l, int m) { | 1 | 3 |
7l23zK | weasel | 2021-06-22T13:35:25 | // The MIT License
// Copyright © 2021 Henrik Dick
// 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, publi... | mit | [
2677,
2709,
2765,
2765,
2943
] | [
[
1186,
1199,
1217,
1217,
1313
],
[
1315,
1335,
1354,
1354,
1451
],
[
1453,
1490,
1516,
1516,
1726
],
[
1728,
1751,
1770,
1770,
1818
],
[
1820,
1846,
1873,
1873,
1938
],
[
1940,
1963,
... | // spherical harmonics function
| vec2 sphere_harm(float theta, float phi, int l, int m) { |
float abs_value = 1.0/SQRT2PI*sqrt(float(2*l+1)/2.0*fac2(l,m))
*legendre_poly(cos(theta), l, m);
return cexp(vec2(0.0,float(m)*phi))*abs_value;
} | // spherical harmonics function
vec2 sphere_harm(float theta, float phi, int l, int m) { | 3 | 3 |
7l23zK | weasel | 2021-06-22T13:35:25 | // The MIT License
// Copyright © 2021 Henrik Dick
// 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, publi... | mit | [
3314,
3388,
3430,
3430,
3767
] | [
[
1186,
1199,
1217,
1217,
1313
],
[
1315,
1335,
1354,
1354,
1451
],
[
1453,
1490,
1516,
1516,
1726
],
[
1728,
1751,
1770,
1770,
1818
],
[
1820,
1846,
1873,
1873,
1938
],
[
1940,
1963,
... | // radius dependent term of the 1/r potential eigenstates in atomic units
| float radius_term(float r, int n, int l) { |
float a0 = 1.0; // atomic radius
float rr = r / a0;
float n2 = 2.0 / float(n) / a0;
float n3 = n2 * n2 * n2;
float p1 = sqrt(n3 * fac2(n, l) * float(n-l)/float(n));
float p2 = exp(-rr/float(n));
float p3 = pow(n2*r, float(l));
float p4 = laguerre_poly(n2*r, n-l-1, 2*l+1);
return p1 ... | // radius dependent term of the 1/r potential eigenstates in atomic units
float radius_term(float r, int n, int l) { | 1 | 1 |
7tj3DG | mrange | 2021-06-25T18:20:12 | // License CC0: Random friday fractal
// Result after a bit of random coding on friday afternoon
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
#define TOLERANCE ... | cc0-1.0 | [
584,
637,
659,
659,
828
] | [
[
458,
458,
486,
506,
582
],
[
584,
637,
659,
659,
828
],
[
830,
830,
866,
866,
1099
],
[
1101,
1101,
1128,
1128,
1215
],
[
1217,
1217,
1256,
1256,
1345
],
[
1347,
1347,
1386,
1386... | // From: https://stackoverflow.com/a/17897228/418488
| vec3 hsv2rgb(vec3 c) { |
const vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
} | // From: https://stackoverflow.com/a/17897228/418488
vec3 hsv2rgb(vec3 c) { | 22 | 237 |
sdBSWc | iq | 2021-06-21T05:20:04 | // 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 | [
1455,
1498,
1541,
1541,
1633
] | [
[
1455,
1498,
1541,
1541,
1633
],
[
1635,
1679,
1723,
1723,
1805
],
[
1852,
1852,
1892,
1892,
2029
],
[
2031,
2031,
2060,
2060,
5437
],
[
5439,
5439,
5460,
5460,
5558
]
] | // Incorrect EaseInOut/Smoothstep velocity
| float position_bad( float t, in float T )
{ |
return smoothstep(0.0,T,t)*t;
//return (t<T) ? (t*t*t)/(T*T*T)*(3.0*T-2.0*t) : t;
} | // Incorrect EaseInOut/Smoothstep velocity
float position_bad( float t, in float T )
{ | 1 | 1 |
sdBSWc | iq | 2021-06-21T05:20:04 | // 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 | [
1635,
1679,
1723,
1723,
1805
] | [
[
1455,
1498,
1541,
1541,
1633
],
[
1635,
1679,
1723,
1723,
1805
],
[
1852,
1852,
1892,
1892,
2029
],
[
2031,
2031,
2060,
2060,
5437
],
[
5439,
5439,
5460,
5460,
5558
]
] | // Correct integral of EaseInOut/Smoothstep
| float position_good( float t, in float T )
{ |
if( t>=T ) return t - 0.5*T;
float f = t/T;
return f*f*f*(T-t*0.5);
} | // Correct integral of EaseInOut/Smoothstep
float position_good( float t, in float T )
{ | 1 | 1 |
slj3Dd | iq | 2021-06-30T05:08:46 | // 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 | [
1261,
1351,
1415,
1499,
2515
] | [
[
1261,
1351,
1415,
1499,
2515
],
[
2517,
2517,
2574,
2610,
3581
]
] | // The arrow goes from a to b. It's thickness is w1. The arrow
// head's thickness is w2.
| float sdArrow( in vec2 p, vec2 a, vec2 b, float w1, float w2 )
{ |
const float k = 3.0; // arrow head ratio
vec2 ba = b - a;
float l2 = dot(ba,ba);
float l = sqrt(l2);
// pixel setup
p = p-a;
p = mat2(ba.x,-ba.y,ba.y,ba.x)*p/l;
p.y = abs(p.y);
vec2 pz = p-vec2(l-w2*k,w2);
// === distance (four segments) ===
vec2 q = p;
q.x -= clamp(... | // The arrow goes from a to b. It's thickness is w1. The arrow
// head's thickness is w2.
float sdArrow( in vec2 p, vec2 a, vec2 b, float w1, float w2 )
{ | 1 | 2 |
4tsBD7 | iq | 2021-07-15T22:22:15 | // 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 | [
1395,
1433,
1505,
1505,
1623
] | [
[
1395,
1433,
1505,
1505,
1623
],
[
1625,
1663,
1754,
1754,
1918
]
] | // disk: center c, normal n, radius r
| float diskIntersect( in vec3 ro, in vec3 rd, vec3 c, vec3 n, float r )
{ |
vec3 o = ro - c;
float t = -dot(n,o)/dot(rd,n);
vec3 q = o + rd*t;
return (dot(q,q)<r*r) ? t : -1.0;
} | // disk: center c, normal n, radius r
float diskIntersect( in vec3 ro, in vec3 rd, vec3 c, vec3 n, float r )
{ | 1 | 1 |
ftXXWX | mrange | 2021-07-18T19:01:48 | // License CC0: Cable nest
// Result after a few hours programming sunday afternoon
#define TOLERANCE 0.0001
#define NORMTOL 0.00125
#define MAX_RAY_LENGTH 20.0
#define MAX_RAY_MARCHES 90
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), sin(a), -sin(... | cc0-1.0 | [
1069,
1144,
1202,
1202,
1683
] | [
[
510,
510,
532,
532,
678
],
[
943,
943,
971,
991,
1067
],
[
1069,
1144,
1202,
1202,
1683
],
[
1685,
1685,
1707,
1707,
1755
],
[
1757,
1757,
1781,
1781,
1829
],
[
1831,
1831,
1856,
... | // https://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 );... | // https://iquilezles.org/www/articles/spherefunctions/spherefunctions.htm
float sphered(vec3 ro, vec3 rd, vec4 sph, float dbuffer) { | 8 | 11 |
NlXXzs | iq | 2021-07-14T17:22:14 | // 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 | [
1209,
1475,
1517,
1517,
1710
] | [
[
1209,
1475,
1517,
1517,
1710
],
[
1712,
1742,
1785,
1785,
2087
],
[
2089,
2204,
2254,
2254,
2296
],
[
2362,
2433,
2464,
2464,
2555
],
[
2557,
2628,
2675,
2675,
2707
],
[
2709,
2780,
... | // Returns the closest point o, a 3D box
// p is the point we are at
// b is the box radius (3 half side lengths)
// The box is axis aligned and centered at the origin. For a box rotated
// by M,you need to transform p and the returned point by inverse(M).
| vec3 closestPointToBox( vec3 p, vec3 b )
{ |
vec3 d = abs(p) - b;
float m = min(0.0,max(d.x,max(d.y,d.z)));
return p - vec3(d.x>=m?d.x:0.0,
d.y>=m?d.y:0.0,
d.z>=m?d.z:0.0)*sign(p);
} | // Returns the closest point o, a 3D box
// p is the point we are at
// b is the box radius (3 half side lengths)
// The box is axis aligned and centered at the origin. For a box rotated
// by M,you need to transform p and the returned point by inverse(M).
vec3 closestPointToBox( vec3 p, vec3 b )
{ | 1 | 1 |
NlXXzs | iq | 2021-07-14T17:22:14 | // 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 | [
2362,
2433,
2464,
2464,
2555
] | [
[
1209,
1475,
1517,
1517,
1710
],
[
1712,
1742,
1785,
1785,
2087
],
[
2089,
2204,
2254,
2254,
2296
],
[
2362,
2433,
2464,
2464,
2555
],
[
2557,
2628,
2675,
2675,
2707
],
[
2709,
2780,
... | // https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
| float sdBox( vec3 p, vec3 b )
{ |
vec3 d = abs(p) - b;
return min(max(d.x,max(d.y,d.z)),0.0) + length(max(d,0.0));
} | // https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
float sdBox( vec3 p, vec3 b )
{ | 61 | 579 |
NlXXzs | iq | 2021-07-14T17:22:14 | // 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 | [
2557,
2628,
2675,
2675,
2707
] | [
[
1209,
1475,
1517,
1517,
1710
],
[
1712,
1742,
1785,
1785,
2087
],
[
2089,
2204,
2254,
2254,
2296
],
[
2362,
2433,
2464,
2464,
2555
],
[
2557,
2628,
2675,
2675,
2707
],
[
2709,
2780,
... | // https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
| float sdSphere( vec3 p, vec3 cen, float rad )
{ |
return length(p-cen)-rad;
} | // https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
float sdSphere( vec3 p, vec3 cen, float rad )
{ | 2 | 2 |
NlXXzs | iq | 2021-07-14T17:22:14 | // 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 | [
2709,
2780,
2832,
2832,
2946
] | [
[
1209,
1475,
1517,
1517,
1710
],
[
1712,
1742,
1785,
1785,
2087
],
[
2089,
2204,
2254,
2254,
2296
],
[
2362,
2433,
2464,
2464,
2555
],
[
2557,
2628,
2675,
2675,
2707
],
[
2709,
2780,
... | // https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
| float sdCapsule( vec3 p, vec3 a, vec3 b, float r )
{ |
vec3 pa = p-a, ba = b-a;
float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
return length( pa - ba*h ) - r;
} | // https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
float sdCapsule( vec3 p, vec3 a, vec3 b, float r )
{ | 56 | 160 |
NlXXzs | iq | 2021-07-14T17:22:14 | // 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 | [
2948,
3019,
3064,
3064,
3352
] | [
[
1209,
1475,
1517,
1517,
1710
],
[
1712,
1742,
1785,
1785,
2087
],
[
2089,
2204,
2254,
2254,
2296
],
[
2362,
2433,
2464,
2464,
2555
],
[
2557,
2628,
2675,
2675,
2707
],
[
2709,
2780,
... | // https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
| float sdBoxFrame( vec3 p, vec3 b, float e )
{ |
p = abs(p )-b;
vec3 q = abs(p+e)-e;
return min(min(
length(max(vec3(p.x,q.y,q.z),0.0))+min(max(p.x,max(q.y,q.z)),0.0),
length(max(vec3(q.x,p.y,q.z),0.0))+min(max(q.x,max(p.y,q.z)),0.0)),
length(max(vec3(q.x,q.y,p.z),0.0))+min(max(q.x,max(q.y,p.z)),0.0));
} | // https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
float sdBoxFrame( vec3 p, vec3 b, float e )
{ | 1 | 20 |
NlXXzs | iq | 2021-07-14T17:22:14 | // 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 | [
4276,
4340,
4393,
4393,
4692
] | [
[
1209,
1475,
1517,
1517,
1710
],
[
1712,
1742,
1785,
1785,
2087
],
[
2089,
2204,
2254,
2254,
2296
],
[
2362,
2433,
2464,
2464,
2555
],
[
2557,
2628,
2675,
2675,
2707
],
[
2709,
2780,
... | // http://iquilezles.org/www/articles/normalsSDF/normalsSDF.htm
| vec3 calcNormal( in vec3 pos, in bool showSurface )
{ |
vec2 e = vec2(1.0,-1.0)*0.5773;
const float eps = 0.0005;
return normalize( e.xyy*map( pos + e.xyy*eps, showSurface ).x +
e.yyx*map( pos + e.yyx*eps, showSurface ).x +
e.yxy*map( pos + e.yxy*eps, showSurface ).x +
e.xxx*map( pos + e.xxx*eps, showSurface ).x );
} | // http://iquilezles.org/www/articles/normalsSDF/normalsSDF.htm
vec3 calcNormal( in vec3 pos, in bool showSurface )
{ | 1 | 1 |
NlXXzs | iq | 2021-07-14T17:22:14 | // 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 | [
4694,
4756,
4816,
4816,
5189
] | [
[
1209,
1475,
1517,
1517,
1710
],
[
1712,
1742,
1785,
1785,
2087
],
[
2089,
2204,
2254,
2254,
2296
],
[
2362,
2433,
2464,
2464,
2555
],
[
2557,
2628,
2675,
2675,
2707
],
[
2709,
2780,
... | // http://iquilezles.org/www/articles/rmshadows/rmshadows.htm
| float calcSoftShadow( vec3 ro, vec3 rd, bool showSurface )
{ |
float res = 1.0;
const float tmax = 2.0;
float t = 0.001;
for( int i=0; i<64; i++ )
{
float h = map(ro + t*rd, showSurface).x;
res = min( res, 64.0*h/t );
t += clamp(h, 0.01,0.5);
if( res<-1.0 || t>tmax ) break;
}
res = max(res,-1.0);
return 0.25*(1.0... | // http://iquilezles.org/www/articles/rmshadows/rmshadows.htm
float calcSoftShadow( vec3 ro, vec3 rd, bool showSurface )
{ | 1 | 1 |
fd33zn | mrange | 2021-08-14T13:49:10 | // License CC0: Saturday Torus
// Inspired by: https://www.istockphoto.com/photo/black-and-white-stripes-projection-on-torus-gm488221403-39181884
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME iTime
#define TTIME (TAU*TIME)
#define RESOLUTION iResolution
#define ROT(a) ma... | cc0-1.0 | [
394,
510,
554,
554,
2612
] | [
[
394,
510,
554,
554,
2612
],
[
2614,
2730,
2768,
2768,
2856
],
[
2858,
2918,
2946,
3012,
3088
],
[
3090,
3090,
3118,
3118,
4569
],
[
4571,
4658,
4694,
4694,
4927
],
[
4929,
4929,
4986... | // License: MIT, author: Inigo Quilez, found: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm
| float rayTorus(vec3 ro, vec3 rd, vec2 tor) { |
float po = 1.0;
float Ra2 = tor.x*tor.x;
float ra2 = tor.y*tor.y;
float m = dot(ro,ro);
float n = dot(ro,rd);
// bounding sphere
{
float h = n*n - m + (tor.x+tor.y)*(tor.x+tor.y);
if(h<0.0) return -1.0;
//float t = -n-sqrt(h); // could use this to compute intersections from ro+t*rd
}
... | // License: MIT, author: Inigo Quilez, found: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm
float rayTorus(vec3 ro, vec3 rd, vec2 tor) { | 2 | 2 |
fd33zn | mrange | 2021-08-14T13:49:10 | // License CC0: Saturday Torus
// Inspired by: https://www.istockphoto.com/photo/black-and-white-stripes-projection-on-torus-gm488221403-39181884
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME iTime
#define TTIME (TAU*TIME)
#define RESOLUTION iResolution
#define ROT(a) ma... | cc0-1.0 | [
2614,
2730,
2768,
2768,
2856
] | [
[
394,
510,
554,
554,
2612
],
[
2614,
2730,
2768,
2768,
2856
],
[
2858,
2918,
2946,
3012,
3088
],
[
3090,
3090,
3118,
3118,
4569
],
[
4571,
4658,
4694,
4694,
4927
],
[
4929,
4929,
4986... | // License: MIT, author: Inigo Quilez, found: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm
| vec3 torusNormal(vec3 pos, vec2 tor) { |
return normalize(pos*(dot(pos,pos)- tor.y*tor.y - tor.x*tor.x*vec3(1.0,1.0,-1.0)));
} | // License: MIT, author: Inigo Quilez, found: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm
vec3 torusNormal(vec3 pos, vec2 tor) { | 2 | 2 |
fd33zn | mrange | 2021-08-14T13:49:10 | // License CC0: Saturday Torus
// Inspired by: https://www.istockphoto.com/photo/black-and-white-stripes-projection-on-torus-gm488221403-39181884
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME iTime
#define TTIME (TAU*TIME)
#define RESOLUTION iResolution
#define ROT(a) ma... | cc0-1.0 | [
2858,
2918,
2946,
3012,
3088
] | [
[
394,
510,
554,
554,
2612
],
[
2614,
2730,
2768,
2768,
2856
],
[
2858,
2918,
2946,
3012,
3088
],
[
3090,
3090,
3118,
3118,
4569
],
[
4571,
4658,
4694,
4694,
4927
],
[
4929,
4929,
4986... | // License: Unknown, author: Unknown, found: don't remember
| float tanh_approx(float x) { |
float x2 = x*x;
return clamp(x*(27.0 + x2)/(27.0+9.0*x2), -1.0, 1.0);
} | // License: Unknown, author: Unknown, found: don't remember
float tanh_approx(float x) { | 100 | 102 |
fd33zn | mrange | 2021-08-14T13:49:10 | // License CC0: Saturday Torus
// Inspired by: https://www.istockphoto.com/photo/black-and-white-stripes-projection-on-torus-gm488221403-39181884
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME iTime
#define TTIME (TAU*TIME)
#define RESOLUTION iResolution
#define ROT(a) ma... | cc0-1.0 | [
4571,
4658,
4694,
4694,
4927
] | [
[
394,
510,
554,
554,
2612
],
[
2614,
2730,
2768,
2768,
2856
],
[
2858,
2918,
2946,
3012,
3088
],
[
3090,
3090,
3118,
3118,
4569
],
[
4571,
4658,
4694,
4694,
4927
],
[
4929,
4929,
4986... | // License: MIT, author: Inigo Quilez, found: https://www.iquilezles.org/www/index.htm
| vec3 postProcess(vec3 col, vec2 q) { |
col = clamp(col, 0.0, 1.0);
col = pow(col, 1.0/vec3(2.2));
col = col*0.6+0.4*col*col*(3.0-2.0*col);
col = mix(col, vec3(dot(col, vec3(0.33))), -0.4);
col *=0.5+0.5*pow(19.0*q.x*q.y*(1.0-q.x)*(1.0-q.y),0.7);
return col;
} | // License: MIT, author: Inigo Quilez, found: https://www.iquilezles.org/www/index.htm
vec3 postProcess(vec3 col, vec2 q) { | 6 | 43 |
sscGz4 | unjello | 2021-08-17T18:12:56 | /// Exodus / Aberration Creations, a 4k intro
/// 3rd place @ MAGFest 2019
/// License: CC0
///
/// Effects inspired by:
/// Octahedral Voxel Tracing / fizzer: https://www.shadertoy.com/view/4lcfDB
/// Swirly Strands / Plento: https://www.shadertoy.com/view/MtKfWy
/// InFX.1 / patu: https://www.shadertoy.com/view/llSSR... | cc0-1.0 | [
800,
856,
883,
883,
958
] | [
[
800,
856,
883,
883,
958
],
[
960,
960,
983,
983,
1506
],
[
1508,
1508,
1542,
1542,
1570
],
[
1572,
1603,
1642,
1642,
1708
],
[
1710,
1710,
1746,
1746,
1766
],
[
1768,
1768,
1802,
... | // random took from
// https://thebookofshaders.com/11/
| float random (in vec2 st) { |
return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123);
} | // random took from
// https://thebookofshaders.com/11/
float random (in vec2 st) { | 4 | 113 |
sscGz4 | unjello | 2021-08-17T18:12:56 | /// Exodus / Aberration Creations, a 4k intro
/// 3rd place @ MAGFest 2019
/// License: CC0
///
/// Effects inspired by:
/// Octahedral Voxel Tracing / fizzer: https://www.shadertoy.com/view/4lcfDB
/// Swirly Strands / Plento: https://www.shadertoy.com/view/MtKfWy
/// InFX.1 / patu: https://www.shadertoy.com/view/llSSR... | cc0-1.0 | [
1572,
1603,
1642,
1642,
1708
] | [
[
800,
856,
883,
883,
958
],
[
960,
960,
983,
983,
1506
],
[
1508,
1508,
1542,
1542,
1570
],
[
1572,
1603,
1642,
1642,
1708
],
[
1710,
1710,
1746,
1746,
1766
],
[
1768,
1768,
1802,
... | // http://mercury.sexy/hg_sdf/
| float sdfCubeCheap(vec3 p, vec3 size) { |
vec3 d = abs(p) - size;
return max(d.x, max(d.y, d.z));
} | // http://mercury.sexy/hg_sdf/
float sdfCubeCheap(vec3 p, vec3 size) { | 1 | 1 |
sscGz4 | unjello | 2021-08-17T18:12:56 | /// Exodus / Aberration Creations, a 4k intro
/// 3rd place @ MAGFest 2019
/// License: CC0
///
/// Effects inspired by:
/// Octahedral Voxel Tracing / fizzer: https://www.shadertoy.com/view/4lcfDB
/// Swirly Strands / Plento: https://www.shadertoy.com/view/MtKfWy
/// InFX.1 / patu: https://www.shadertoy.com/view/llSSR... | cc0-1.0 | [
2240,
2320,
2349,
2349,
2682
] | [
[
800,
856,
883,
883,
958
],
[
960,
960,
983,
983,
1506
],
[
1508,
1508,
1542,
1542,
1570
],
[
1572,
1603,
1642,
1642,
1708
],
[
1710,
1710,
1746,
1746,
1766
],
[
1768,
1768,
1802,
... | // https://www1.udel.edu/biology/rosewc/kaap427627/notes/matrices_rotations.pdf
| mat3 fullRotate(vec3 theta) { |
float sx=sin(theta.x);
float cx=cos(theta.x);
float sy=sin(theta.y);
float cy=cos(theta.y);
float sz=sin(theta.z);
float cz=cos(theta.z);
return mat3(
vec3(cy*cz, -cy*sz, sy),
vec3(sx*sy*cz+cx*sz, -sx*sy*sz+cx*cz, -sx*cy),
vec3(-cx*sy*cz+sx*sz, cx*sy*sz+sx*cz, cx*cy)... | // https://www1.udel.edu/biology/rosewc/kaap427627/notes/matrices_rotations.pdf
mat3 fullRotate(vec3 theta) { | 1 | 1 |
sscGz4 | unjello | 2021-08-17T18:12:56 | /// Exodus / Aberration Creations, a 4k intro
/// 3rd place @ MAGFest 2019
/// License: CC0
///
/// Effects inspired by:
/// Octahedral Voxel Tracing / fizzer: https://www.shadertoy.com/view/4lcfDB
/// Swirly Strands / Plento: https://www.shadertoy.com/view/MtKfWy
/// InFX.1 / patu: https://www.shadertoy.com/view/llSSR... | cc0-1.0 | [
5878,
5945,
6005,
6005,
6192
] | [
[
800,
856,
883,
883,
958
],
[
960,
960,
983,
983,
1506
],
[
1508,
1508,
1542,
1542,
1570
],
[
1572,
1603,
1642,
1642,
1708
],
[
1710,
1710,
1746,
1746,
1766
],
[
1768,
1768,
1802,
... | // http://learnwebgl.brown37.net/09_lights/lights_attenuation.html
| vec3 getSunLightColor(vec3 eye, vec3 dir, vec3 p, vec3 lp) { |
vec3 sun_pos = eye;
vec3 L = sun_pos - p;
float d = max(length(L), EPSILON);
float atten = 1.0 / (1.0 + d*0.2 + d*d*0.1);
vec3 c = (K_a + K_d + K_s)*atten;
return c;
} | // http://learnwebgl.brown37.net/09_lights/lights_attenuation.html
vec3 getSunLightColor(vec3 eye, vec3 dir, vec3 p, vec3 lp) { | 1 | 1 |
7sdXz7 | mrange | 2021-09-29T08:15:20 | // License CC0: Simple circle tiling
// Been working too much lately to do shader stuff.
// But today I experimented a bit with tiling so thought I share
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
#define PI 3.141592654
#define TAU ... | cc0-1.0 | [
1009,
1095,
1131,
1131,
1225
] | [
[
486,
486,
508,
508,
654
],
[
950,
950,
981,
981,
1007
],
[
1009,
1095,
1131,
1131,
1225
],
[
1227,
1293,
1314,
1314,
1382
],
[
1384,
1384,
1429,
1429,
1722
],
[
1724,
1811,
1847,
... | // License: MIT OR CC-BY-NC-4.0, author: mercury, found: https://mercury.sexy/hg_sdf/
| vec2 mod2(inout vec2 p, vec2 size) { |
vec2 c = floor((p + size*0.5)/size);
p = mod(p + size*0.5,size) - size*0.5;
return c;
} | // License: MIT OR CC-BY-NC-4.0, author: mercury, found: https://mercury.sexy/hg_sdf/
vec2 mod2(inout vec2 p, vec2 size) { | 52 | 53 |
7sdXz7 | mrange | 2021-09-29T08:15:20 | // License CC0: Simple circle tiling
// Been working too much lately to do shader stuff.
// But today I experimented a bit with tiling so thought I share
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
#define PI 3.141592654
#define TAU ... | cc0-1.0 | [
1227,
1293,
1314,
1314,
1382
] | [
[
486,
486,
508,
508,
654
],
[
950,
950,
981,
981,
1007
],
[
1009,
1095,
1131,
1131,
1225
],
[
1227,
1293,
1314,
1314,
1382
],
[
1384,
1384,
1429,
1429,
1722
],
[
1724,
1811,
1847,
... | // License: Unknown, author: Hexler, found: Kodelife example Grid
| float hash(vec2 uv) { |
return fract(sin(dot(uv, vec2(12.9898, 78.233))) * 43758.5453);
} | // License: Unknown, author: Hexler, found: Kodelife example Grid
float hash(vec2 uv) { | 3 | 21 |
NstSDn | mrange | 2021-09-29T19:44:14 | // License CC0: Adaptive tile sizes
// Been working too much lately to do shader stuff.
// But today I experimented a bit with tiling so thought I share
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
#define PI 3.141592654
#define TAU ... | cc0-1.0 | [
1223,
1341,
1362,
1362,
1582
] | [
[
541,
541,
563,
563,
709
],
[
1005,
1091,
1127,
1127,
1221
],
[
1223,
1341,
1362,
1362,
1582
],
[
1584,
1702,
1729,
1729,
1809
],
[
1811,
1811,
1832,
1832,
1941
],
[
1943,
1943,
1990,... | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
| float heart(vec2 p) { |
p.x = abs(p.x);
if( p.y+p.x>1.0 )
return sqrt(DOT2(p-vec2(0.25,0.75))) - sqrt(2.0)/4.0;
return sqrt(min(DOT2(p-vec2(0.00,1.00)),
DOT2(p-0.5*max(p.x+p.y,0.0)))) * sign(p.x-p.y);
} | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
float heart(vec2 p) { | 1 | 12 |
NstSDn | mrange | 2021-09-29T19:44:14 | // License CC0: Adaptive tile sizes
// Been working too much lately to do shader stuff.
// But today I experimented a bit with tiling so thought I share
#define TIME iTime
#define RESOLUTION iResolution
#define ROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
#define PI 3.141592654
#define TAU ... | cc0-1.0 | [
1584,
1702,
1729,
1729,
1809
] | [
[
541,
541,
563,
563,
709
],
[
1005,
1091,
1127,
1127,
1221
],
[
1223,
1341,
1362,
1362,
1582
],
[
1584,
1702,
1729,
1729,
1809
],
[
1811,
1811,
1832,
1832,
1941
],
[
1943,
1943,
1990,... | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
| float box(vec2 p, vec2 b) { |
vec2 d = abs(p)-b;
return length(max(d,0.0)) + min(max(d.x,d.y),0.0);
} | // License: MIT, author: Inigo Quilez, found: https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
float box(vec2 p, vec2 b) { | 4 | 62 |
wtVyDz | iq | 2021-09-09T02:12:40 | // 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 | [
1531,
1560,
1610,
1610,
1638
] | [
[
1275,
1275,
1336,
1336,
1472
],
[
1531,
1560,
1610,
1610,
1638
],
[
1640,
1670,
1722,
1722,
1842
],
[
1844,
1880,
1914,
1914,
1940
],
[
1941,
1941,
1966,
1966,
1985
],
[
1986,
1986,
... | // signed distance to a disk
| float sdDisk( in vec2 p, in vec2 c, in float r )
{ |
return length(p-c)-r;
} | // signed distance to a disk
float sdDisk( in vec2 p, in vec2 c, in float r )
{ | 2 | 2 |
wtVyDz | iq | 2021-09-09T02:12:40 | // 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 | [
1640,
1670,
1722,
1722,
1842
] | [
[
1275,
1275,
1336,
1336,
1472
],
[
1531,
1560,
1610,
1610,
1638
],
[
1640,
1670,
1722,
1722,
1842
],
[
1844,
1880,
1914,
1914,
1940
],
[
1941,
1941,
1966,
1966,
1985
],
[
1986,
1986,
... | // distance to a line segment
| float sdSegment( in vec2 p, in vec2 a, in vec2 b )
{ |
vec2 pa = p - a;
vec2 ba = b - a;
float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
return length( pa - ba*h );
} | // distance to a line segment
float sdSegment( in vec2 p, in vec2 a, in vec2 b )
{ | 5 | 121 |
wtVyDz | iq | 2021-09-09T02:12:40 | // 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 | [
1844,
1880,
1914,
1914,
1940
] | [
[
1275,
1275,
1336,
1336,
1472
],
[
1531,
1560,
1610,
1610,
1638
],
[
1640,
1670,
1722,
1722,
1842
],
[
1844,
1880,
1914,
1914,
1940
],
[
1941,
1941,
1966,
1966,
1985
],
[
1986,
1986,
... | // signed distance to a 2D triangle
| float cro(in vec2 a, in vec2 b ) { | return a.x*b.y-a.y*b.x; } | // signed distance to a 2D triangle
float cro(in vec2 a, in vec2 b ) { | 1 | 7 |
7sdXz2 | iq | 2021-10-06T23:49:45 | // 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 | [
1347,
1387,
1446,
1446,
1532
] | [
[
1347,
1387,
1446,
1446,
1532
],
[
1536,
1536,
1593,
1628,
2465
]
] | // s = side length
// r = corner radius
| float sdRoundSquare( in vec2 p, in float s, in float r )
{ |
vec2 q = abs(p)-s+r;
return min(max(q.x,q.y),0.0) + length(max(q,0.0)) - r;
} | // s = side length
// r = corner radius
float sdRoundSquare( in vec2 p, in float s, in float r )
{ | 5 | 5 |
fs3SWj | mattz | 2021-10-12T00:52:06 | //////////////////////////////////////////////////////////////////////
//
// "pentagonal tiling variations" by mattz
// License https://creativecommons.org/licenses/by/4.0/
//
// Click and drag to set vertex position.
//
// Renders "type 4" Cairo pentagonal tilings. See
// https://en.wikipedia.org/wiki/Cairo_pentagonal... | cc-by-4.0 | [
1083,
1119,
1138,
1138,
1168
] | [
[
1083,
1119,
1138,
1138,
1168
],
[
1170,
1223,
1255,
1255,
1310
],
[
1312,
1365,
1399,
1399,
1457
],
[
1459,
1498,
1534,
1534,
1700
],
[
1702,
1721,
1765,
1765,
1845
],
[
1847,
1868,
... | // vector rotated by 90 degrees CCW
| vec2 perp(vec2 u) { |
return vec2(-u.y, u.x);
} | // vector rotated by 90 degrees CCW
vec2 perp(vec2 u) { | 2 | 2 |
fs3SWj | mattz | 2021-10-12T00:52:06 | //////////////////////////////////////////////////////////////////////
//
// "pentagonal tiling variations" by mattz
// License https://creativecommons.org/licenses/by/4.0/
//
// Click and drag to set vertex position.
//
// Renders "type 4" Cairo pentagonal tilings. See
// https://en.wikipedia.org/wiki/Cairo_pentagonal... | cc-by-4.0 | [
1170,
1223,
1255,
1255,
1310
] | [
[
1083,
1119,
1138,
1138,
1168
],
[
1170,
1223,
1255,
1255,
1310
],
[
1312,
1365,
1399,
1399,
1457
],
[
1459,
1498,
1534,
1534,
1700
],
[
1702,
1721,
1765,
1765,
1845
],
[
1847,
1868,
... | // rotate vector by rotation vector (cos(t), sin(t))
| vec2 rotate(vec2 rvec, vec2 p) { |
return p.x * rvec + p.y * vec2(-rvec.y, rvec.x);
} | // rotate vector by rotation vector (cos(t), sin(t))
vec2 rotate(vec2 rvec, vec2 p) { | 2 | 2 |
fs3SWj | mattz | 2021-10-12T00:52:06 | //////////////////////////////////////////////////////////////////////
//
// "pentagonal tiling variations" by mattz
// License https://creativecommons.org/licenses/by/4.0/
//
// Click and drag to set vertex position.
//
// Renders "type 4" Cairo pentagonal tilings. See
// https://en.wikipedia.org/wiki/Cairo_pentagonal... | cc-by-4.0 | [
1312,
1365,
1399,
1399,
1457
] | [
[
1083,
1119,
1138,
1138,
1168
],
[
1170,
1223,
1255,
1255,
1310
],
[
1312,
1365,
1399,
1399,
1457
],
[
1459,
1498,
1534,
1534,
1700
],
[
1702,
1721,
1765,
1765,
1845
],
[
1847,
1868,
... | // rotate vector by rotation vector (cos(t), sin(t))
| vec2 unrotate(vec2 rvec, vec2 p) { |
return p.x * vec2(rvec.x, -rvec.y) + p.y * rvec.yx;
} | // rotate vector by rotation vector (cos(t), sin(t))
vec2 unrotate(vec2 rvec, vec2 p) { | 1 | 2 |
fs3SWj | mattz | 2021-10-12T00:52:06 | //////////////////////////////////////////////////////////////////////
//
// "pentagonal tiling variations" by mattz
// License https://creativecommons.org/licenses/by/4.0/
//
// Click and drag to set vertex position.
//
// Renders "type 4" Cairo pentagonal tilings. See
// https://en.wikipedia.org/wiki/Cairo_pentagonal... | cc-by-4.0 | [
1459,
1498,
1534,
1534,
1700
] | [
[
1083,
1119,
1138,
1138,
1168
],
[
1170,
1223,
1255,
1255,
1310
],
[
1312,
1365,
1399,
1399,
1457
],
[
1459,
1498,
1534,
1534,
1700
],
[
1702,
1721,
1765,
1765,
1845
],
[
1847,
1868,
... | // distance from point to line segment
| float dseg(vec2 p, vec2 a, vec2 b) { |
vec2 pa = p - a;
vec2 ba = b - a;
float u = dot(pa, ba) / dot(ba, ba);
u = clamp(u, 0.0, 1.0);
return length(pa - u * ba);
} | // distance from point to line segment
float dseg(vec2 p, vec2 a, vec2 b) { | 2 | 2 |
fs3SWj | mattz | 2021-10-12T00:52:06 | //////////////////////////////////////////////////////////////////////
//
// "pentagonal tiling variations" by mattz
// License https://creativecommons.org/licenses/by/4.0/
//
// Click and drag to set vertex position.
//
// Renders "type 4" Cairo pentagonal tilings. See
// https://en.wikipedia.org/wiki/Cairo_pentagonal... | cc-by-4.0 | [
1702,
1721,
1765,
1765,
1845
] | [
[
1083,
1119,
1138,
1138,
1168
],
[
1170,
1223,
1255,
1255,
1310
],
[
1312,
1365,
1399,
1399,
1457
],
[
1459,
1498,
1534,
1534,
1700
],
[
1702,
1721,
1765,
1765,
1845
],
[
1847,
1868,
... | // half-plane test
| bool in_half_plane(vec2 p, vec2 a, vec2 b) { |
vec2 pa = p - a;
vec2 ba = b - a;
return dot(pa, perp(ba)) > 0.0;
} | // half-plane test
bool in_half_plane(vec2 p, vec2 a, vec2 b) { | 2 | 2 |
fs3SWj | mattz | 2021-10-12T00:52:06 | //////////////////////////////////////////////////////////////////////
//
// "pentagonal tiling variations" by mattz
// License https://creativecommons.org/licenses/by/4.0/
//
// Click and drag to set vertex position.
//
// Renders "type 4" Cairo pentagonal tilings. See
// https://en.wikipedia.org/wiki/Cairo_pentagonal... | cc-by-4.0 | [
1847,
1868,
1918,
1918,
2007
] | [
[
1083,
1119,
1138,
1138,
1168
],
[
1170,
1223,
1255,
1255,
1310
],
[
1312,
1365,
1399,
1399,
1457
],
[
1459,
1498,
1534,
1534,
1700
],
[
1702,
1721,
1765,
1765,
1845
],
[
1847,
1868,
... | // point in triangle
| bool in_triangle(vec2 p, vec2 a, vec2 b, vec2 c) { |
return in_half_plane(p, a, b) && in_half_plane(p, b, c) && in_half_plane(p, c, a);
} | // point in triangle
bool in_triangle(vec2 p, vec2 a, vec2 b, vec2 c) { | 2 | 2 |
fs3SWj | mattz | 2021-10-12T00:52:06 | //////////////////////////////////////////////////////////////////////
//
// "pentagonal tiling variations" by mattz
// License https://creativecommons.org/licenses/by/4.0/
//
// Click and drag to set vertex position.
//
// Renders "type 4" Cairo pentagonal tilings. See
// https://en.wikipedia.org/wiki/Cairo_pentagonal... | cc-by-4.0 | [
2009,
2078,
2100,
2155,
2507
] | [
[
1083,
1119,
1138,
1138,
1168
],
[
1170,
1223,
1255,
1255,
1310
],
[
1312,
1365,
1399,
1399,
1457
],
[
1459,
1498,
1534,
1534,
1700
],
[
1702,
1721,
1765,
1765,
1845
],
[
1847,
1868,
... | // from https://www.shadertoy.com/view/XdXGW8 - used for noise below
| vec2 grad( ivec2 z ) { |
int n = z.x+z.y*11111;
// Hugo Elias hash (feel free to replace by another one)
n = (n<<13)^n;
n = (n*(n*n*15731+789221)+1376312589)>>16;
// Perlin style vectors
n &= 7;
vec2 gr = vec2(n&1,n>>1)*2.0-1.0;
return ( n>=6 ) ? vec2(0.0,gr.x) :
( n>=4 ) ? vec2(gr.x,0.0... | // from https://www.shadertoy.com/view/XdXGW8 - used for noise below
vec2 grad( ivec2 z ) { | 2 | 2 |
fs3SWj | mattz | 2021-10-12T00:52:06 | //////////////////////////////////////////////////////////////////////
//
// "pentagonal tiling variations" by mattz
// License https://creativecommons.org/licenses/by/4.0/
//
// Click and drag to set vertex position.
//
// Renders "type 4" Cairo pentagonal tilings. See
// https://en.wikipedia.org/wiki/Cairo_pentagonal... | cc-by-4.0 | [
2509,
2555,
2581,
2581,
2976
] | [
[
1083,
1119,
1138,
1138,
1168
],
[
1170,
1223,
1255,
1255,
1310
],
[
1312,
1365,
1399,
1399,
1457
],
[
1459,
1498,
1534,
1534,
1700
],
[
1702,
1721,
1765,
1765,
1845
],
[
1847,
1868,
... | // from https://www.shadertoy.com/view/XdXGW8
| float noise( in vec2 p ) { |
ivec2 i = ivec2(floor( p ));
vec2 f = fract( p );
vec2 u = f*f*f*(f*(f*6.0-15.0)+10.0);
return mix( mix( dot( grad( i+ivec2(0,0) ), f-vec2(0.0,0.0) ),
dot( grad( i+ivec2(1,0) ), f-vec2(1.0,0.0) ), u.x),
mix( dot( grad( i+ivec2(0,1) ), f-vec2(0.0,1.0) ),
... | // from https://www.shadertoy.com/view/XdXGW8
float noise( in vec2 p ) { | 2 | 83 |
fs3SWj | mattz | 2021-10-12T00:52:06 | //////////////////////////////////////////////////////////////////////
//
// "pentagonal tiling variations" by mattz
// License https://creativecommons.org/licenses/by/4.0/
//
// Click and drag to set vertex position.
//
// Renders "type 4" Cairo pentagonal tilings. See
// https://en.wikipedia.org/wiki/Cairo_pentagonal... | cc-by-4.0 | [
4232,
4259,
4283,
4312,
4931
] | [
[
1083,
1119,
1138,
1138,
1168
],
[
1170,
1223,
1255,
1255,
1310
],
[
1312,
1365,
1399,
1399,
1457
],
[
1459,
1498,
1534,
1534,
1700
],
[
1702,
1721,
1765,
1765,
1845
],
[
1847,
1868,
... | // for bump-mapped shading
| vec2 heightmap(vec2 p) { |
float dpoly = dseg(p, O, A);
dpoly = min(dpoly, dseg(p, A, B));
dpoly = min(dpoly, dseg(p, B, C));
dpoly = min(dpoly, dseg(p, C, D));
dpoly = min(dpoly, dseg(p, D, O));
// offset from edge
float k = 0.08;
// base height
float z = k + 0.01 * noise(5.*p);
if (dpoly ... | // for bump-mapped shading
vec2 heightmap(vec2 p) { | 2 | 2 |
ftKGzm | Jabo | 2021-11-20T13:00:40 | // The MIT License
// 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, distribute, sublicense, and/... | mit | [
1044,
1119,
1161,
1161,
1187
] | [
[
1044,
1119,
1161,
1161,
1187
],
[
1189,
1264,
1295,
1295,
1503
],
[
1505,
1576,
1634,
1634,
1734
],
[
1736,
1786,
1817,
1817,
1965
],
[
1967,
2067,
2092,
2092,
2419
],
[
2420,
2420,
... | // https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
| float sdCircle( in vec2 p, in float r )
{ |
return length(p)-r;
} | // https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
float sdCircle( in vec2 p, in float r )
{ | 9 | 11 |
ftKGzm | Jabo | 2021-11-20T13:00:40 | // The MIT License
// 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, distribute, sublicense, and/... | mit | [
1189,
1264,
1295,
1295,
1503
] | [
[
1044,
1119,
1161,
1161,
1187
],
[
1189,
1264,
1295,
1295,
1503
],
[
1505,
1576,
1634,
1634,
1734
],
[
1736,
1786,
1817,
1817,
1965
],
[
1967,
2067,
2092,
2092,
2419
],
[
2420,
2420,
... | // https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
| float sdTriangle( in vec2 p )
{ |
const float k = sqrt(3.0);
p.x = abs(p.x) - 1.0; p.y = p.y + 1.0/k;
if( p.x+k*p.y>0.0 ) p = vec2(p.x-k*p.y,-k*p.x-p.y)/2.0;
p.x -= clamp( p.x, -2.0, 0.0 );
return -length(p)*sign(p.y);
} | // https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
float sdTriangle( in vec2 p )
{ | 1 | 1 |
ftKGzm | Jabo | 2021-11-20T13:00:40 | // The MIT License
// 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, distribute, sublicense, and/... | mit | [
1505,
1576,
1634,
1634,
1734
] | [
[
1044,
1119,
1161,
1161,
1187
],
[
1189,
1264,
1295,
1295,
1503
],
[
1505,
1576,
1634,
1634,
1734
],
[
1736,
1786,
1817,
1817,
1965
],
[
1967,
2067,
2092,
2092,
2419
],
[
2420,
2420,
... | // https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
| float opSmoothSubtraction( float d1, float d2, float k )
{ |
float h = clamp( 0.5 - 0.5*(d2+d1)/k, 0.0, 1.0 );
return mix( d2, -d1, h ) + k*h*(1.0-h);
} | // https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
float opSmoothSubtraction( float d1, float d2, float k )
{ | 1 | 5 |
ftKGzm | Jabo | 2021-11-20T13:00:40 | // The MIT License
// 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, distribute, sublicense, and/... | mit | [
1736,
1786,
1817,
1817,
1965
] | [
[
1044,
1119,
1161,
1161,
1187
],
[
1189,
1264,
1295,
1295,
1503
],
[
1505,
1576,
1634,
1634,
1734
],
[
1736,
1786,
1817,
1817,
1965
],
[
1967,
2067,
2092,
2092,
2419
],
[
2420,
2420,
... | // modified https://www.shadertoy.com/view/ldBGDc
| float spiral(vec2 m, float t) { |
float r = pow(length(m) / 0.75, 3.5) * 0.75;
float a = atan(m.x, m.y);
float v = sin(48.*(sqrt(r)-0.0625*a-.05*t));
return clamp(v,0.,1.);
} | // modified https://www.shadertoy.com/view/ldBGDc
float spiral(vec2 m, float t) { | 1 | 3 |
ftKGzm | Jabo | 2021-11-20T13:00:40 | // The MIT License
// 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, distribute, sublicense, and/... | mit | [
1967,
2067,
2092,
2092,
2419
] | [
[
1044,
1119,
1161,
1161,
1187
],
[
1189,
1264,
1295,
1295,
1503
],
[
1505,
1576,
1634,
1634,
1734
],
[
1736,
1786,
1817,
1817,
1965
],
[
1967,
2067,
2092,
2092,
2419
],
[
2420,
2420,
... | // adapted for webgl https://www.ronja-tutorials.com/post/041-hsv-colorspace/#rgb-to-hsv-conversion
| vec3 hue2rgb(float hue) { |
hue = fract(hue); //only use fractional part of hue, making it loop
float r = abs(hue * 6. - 3.) - 1.; //red
float g = 2. - abs(hue * 6. - 2.); //green
float b = 2. - abs(hue * 6. - 4.); //blue
vec3 rgb = vec3(r,g,b); //combine components
rgb = clamp(rgb, 0., 1.); //saturate
return... | // adapted for webgl https://www.ronja-tutorials.com/post/041-hsv-colorspace/#rgb-to-hsv-conversion
vec3 hue2rgb(float hue) { | 1 | 10 |
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 | [
1844,
1919,
1967,
1967,
2081
] | [
[
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 sdLine( in vec2 p, in vec2 a, in vec2 b)
{ |
vec2 pa = p-a, ba = b-a;
float h = clamp(dot(pa,ba)/(dot(ba,ba)),0.0, 1.0);
return length(pa-ba*h);
} | // https://iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
float sdLine( in vec2 p, in vec2 a, in vec2 b)
{ | 1 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.