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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
dls3Wr | mkeeter | 2022-12-21T17:04:32 | // Using distance-to-quadratic and winding number to generate a closed-form
// distance field of a font outline, which is specified as lines + quadratic
// Bézier curves.
//
// Quadratic solver is based on https://www.shadertoy.com/view/MlKcDD, which
// includes the following copyright notice:
//
// Copyright © 20... | mit | [
7709,
7758,
7811,
7811,
8140
] | [
[
5475,
5475,
5498,
5498,
5518
],
[
5519,
5519,
5552,
5552,
5584
],
[
5586,
5627,
5689,
5689,
7707
],
[
7709,
7758,
7811,
7811,
8140
],
[
8142,
8142,
8196,
8196,
8386
],
[
8388,
8388,
... | // Source: https://www.shadertoy.com/view/wdBXRW
| float winding_sign(in vec2 p, in vec2 a, in vec2 b) { |
vec2 e = b - a;
vec2 w = p - a;
// winding number from http://geomalgorithms.com/a03-_inclusion.html
bvec3 cond = bvec3(p.y >= a.y,
p.y < b.y,
e.x*w.y > e.y*w.x);
if( all(cond) || all(not(cond))) {
return -1.0;
} else {
return 1.0... | // Source: https://www.shadertoy.com/view/wdBXRW
float winding_sign(in vec2 p, in vec2 a, in vec2 b) { | 1 | 1 |
mllGzH | iq | 2022-12-18T05:04:33 | // The MIT License
// Copyright © 2022 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit | [
1254,
1434,
1484,
1505,
2395
] | [
[
1254,
1434,
1484,
1505,
2395
],
[
2397,
2397,
2425,
2425,
2584
]
] | // takes:
// ro,rd = ray origin and direction
// s = wedge length, height and width
// returns:
// .x = distance to intersection
// .yzw = normal at intersection point
| vec4 iWedge( in vec3 ro, in vec3 rd, in vec3 s )
{ |
vec3 m = 1.0/rd;
vec3 z = vec3(rd.x>=0.0?1.0:-1.0, rd.y>=0.0?1.0:-1.0, rd.z>=0.0?1.0:-1.0);
vec3 k = s*z;
vec3 t1 = (-ro - k)*m;
vec3 t2 = (-ro + k)*m;
float tn = max(max(t1.x, t1.y), t1.z);
float tf = min(min(t2.x, t2.y), t2.z);
if( tn>tf ) return vec4(-1.0);
// boolean wi... | // takes:
// ro,rd = ray origin and direction
// s = wedge length, height and width
// returns:
// .x = distance to intersection
// .yzw = normal at intersection point
vec4 iWedge( in vec3 ro, in vec3 rd, in vec3 s )
{ | 1 | 1 |
ctf3z8 | ttg | 2022-12-16T23:56:20 | /*
24-bit fixed * 12-mantissa-bit multiply
https://www.shadertoy.com/view/ctf3z8
Multiply 24-bit signed integer by float using 12 bits of mantissa into
whole part and fract part without loss of precision over the integer argument's
range.
Click left/right to compare one at a time.
Copyright 2022 Theron Tarigo. All ... | isc | [
428,
603,
672,
672,
911
] | [
[
428,
603,
672,
672,
911
],
[
913,
913,
950,
950,
1848
]
] | // https://www.shadertoy.com/view/ctf3z8
// requires abs(a) < (1<<24), recognizes only 12 significand bits of b
// logical operation: returns fract(a*b+x), ret_n=floor(a*b+x)
| float frac_mad_i24_m12_f32 (out int ret_n, int a, float b, float x) { |
#ifdef SAFE
int _M=~0xFFF;
if (a!=(a&0xFFFFFF)) return 0.;
b = intBitsToFloat(floatBitsToInt(b)&_M);
#endif
vec2 p = vec2(a&0xFFF,a&~0xFFF)*b,i=floor(p),f=p-i,r=f+f.y+x;
ret_n = int(i.x+i.y+(r.y=floor(r.x)));
return r.x-r.y;
} | // https://www.shadertoy.com/view/ctf3z8
// requires abs(a) < (1<<24), recognizes only 12 significand bits of b
// logical operation: returns fract(a*b+x), ret_n=floor(a*b+x)
float frac_mad_i24_m12_f32 (out int ret_n, int a, float b, float x) { | 1 | 1 |
DdSXzW | fishy | 2022-12-02T00:28:26 | // 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 | [
1648,
1758,
1808,
1808,
2068
] | [
[
1648,
1758,
1808,
1808,
2068
],
[
2070,
2165,
2202,
2202,
2234
],
[
2236,
2236,
2273,
2273,
2534
],
[
2536,
2536,
2588,
2588,
2756
],
[
2758,
2758,
2776,
2811,
2976
],
[
2978,
2978,
... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ < 1 unfortunatelly
| vec3 sdgSMin( in vec3 a, in vec3 b, in float k )
{ |
float h = max(k-abs(a.x-b.x),0.0);
float m = 0.25*h*h/k; // [0 - k/4] for [|a-b|=k - |a-b|=0]
float n = 0.50* h/k; // [0 - 1/2] for [|a-b|=k - |a-b|=0]
return vec3( min(a.x, b.x) - m,
mix(a.yz, b.yz, (a.x<b.x)?n:1.0-n) );
} | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ < 1 unfortunatelly
vec3 sdgSMin( in vec3 a, in vec3 b, in float k )
{ | 2 | 3 |
ctBSDG | Paul_31415 | 2023-02-15T18:23:43 | // 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 | [
8184,
8242,
8286,
8286,
8439
] | [
[
1858,
1858,
1883,
1883,
1910
],
[
2993,
2993,
3017,
3017,
3059
],
[
3060,
3060,
3085,
3085,
3115
],
[
4329,
4467,
4504,
4857,
8182
],
[
8184,
8242,
8286,
8286,
8439
],
[
8442,
8467,
... | //using the "locus of points" geometric defn of hyperbola
| float inside_Hyperbola( vec2 p, in vec2 ab){ |
float sqrt2 = sqrt(2.0);//foci are at (0,±√2)
p /= ab;
p /= 2.0;
return sign(length(p-vec2(0,sqrt2))-length(p-vec2(0,-sqrt2))+2.0);
} | //using the "locus of points" geometric defn of hyperbola
float inside_Hyperbola( vec2 p, in vec2 ab){ | 1 | 1 |
ctBSDG | Paul_31415 | 2023-02-15T18:23:43 | // 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 | [
8442,
8467,
8507,
8507,
8558
] | [
[
1858,
1858,
1883,
1883,
1910
],
[
2993,
2993,
3017,
3017,
3059
],
[
3060,
3060,
3085,
3085,
3115
],
[
4329,
4467,
4504,
4857,
8182
],
[
8184,
8242,
8286,
8286,
8439
],
[
8442,
8467,
... | //precision loss testing
| float add_ploss(in float a, in float b){ |
return -log2(abs(a+b)/(abs(a)+abs(b)))/24.0;
} | //precision loss testing
float add_ploss(in float a, in float b){ | 1 | 1 |
ctBSDG | Paul_31415 | 2023-02-15T18:23:43 | // 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 | [
12043,
12083,
12153,
12153,
13776
] | [
[
1858,
1858,
1883,
1883,
1910
],
[
2993,
2993,
3017,
3017,
3059
],
[
3060,
3060,
3085,
3085,
3115
],
[
4329,
4467,
4504,
4857,
8182
],
[
8184,
8242,
8286,
8286,
8439
],
[
8442,
8467,
... | //for highlighting individual solutions
| vec2 pHyperbola_sols( vec2 p, in vec2 ab, in float s1, in float s2 )
{ |
float t = 0.0;
float r2 = ab.x*ab.x+ab.y*ab.y;
float az = ab.x*p.x;
float bw = ab.y*p.y;
float A = 2.0*r2;
float B = -2.0*(az+bw);
float C = 0.0;
float D = -2.0*(az-bw);
float E = -2.0*r2;
float boa = B/A;
float coa = C/A;
float doa = D/A;
float e... | //for highlighting individual solutions
vec2 pHyperbola_sols( vec2 p, in vec2 ab, in float s1, in float s2 )
{ | 1 | 1 |
ddd3zs | iq | 2023-03-02T04:52:06 | // The MIT License
// Copyright © 2023 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 | [
1213,
1264,
1328,
1451,
2914
] | [
[
1213,
1264,
1328,
1451,
2914
],
[
2980,
3029,
3081,
3081,
3195
],
[
3197,
3246,
3293,
3293,
3325
],
[
3513,
3513,
3574,
3644,
4234
],
[
4236,
4282,
4353,
4353,
4704
],
[
4706,
4751,
... | // .x distance to the cone
// .yzw closest point
| vec4 sdcCappedCone(vec3 p, vec3 a, vec3 b, float ra, float rb)
{ |
vec3 pa = p-a;
vec3 ba = b-a;
float baba = dot(ba,ba);
float bale = sqrt(baba);
vec3 w = ba/bale;
float v = dot(pa,w);
vec3 q = a + w*v;
vec3 pq = p-q;
float pqpq = dot(pq,pq);
float u = sqrt(pqpq);
//--------------------------------------
// distance ... | // .x distance to the cone
// .yzw closest point
vec4 sdcCappedCone(vec3 p, vec3 a, vec3 b, float ra, float rb)
{ | 1 | 1 |
ddd3zs | iq | 2023-03-02T04:52:06 | // The MIT License
// Copyright © 2023 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 | [
2980,
3029,
3081,
3081,
3195
] | [
[
1213,
1264,
1328,
1451,
2914
],
[
2980,
3029,
3081,
3081,
3195
],
[
3197,
3246,
3293,
3293,
3325
],
[
3513,
3513,
3574,
3644,
4234
],
[
4236,
4282,
4353,
4353,
4704
],
[
4706,
4751,
... | // https://iquilezles.org/articles/distfunctions
| 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/articles/distfunctions
float sdCapsule( vec3 p, vec3 a, vec3 b, float r )
{ | 56 | 160 |
ddd3zs | iq | 2023-03-02T04:52:06 | // The MIT License
// Copyright © 2023 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 | [
3197,
3246,
3293,
3293,
3325
] | [
[
1213,
1264,
1328,
1451,
2914
],
[
2980,
3029,
3081,
3081,
3195
],
[
3197,
3246,
3293,
3293,
3325
],
[
3513,
3513,
3574,
3644,
4234
],
[
4236,
4282,
4353,
4353,
4704
],
[
4706,
4751,
... | // https://iquilezles.org/articles/distfunctions
| float sdSphere( vec3 p, vec3 cen, float rad )
{ |
return length(p-cen)-rad;
} | // https://iquilezles.org/articles/distfunctions
float sdSphere( vec3 p, vec3 cen, float rad )
{ | 2 | 2 |
ddd3zs | iq | 2023-03-02T04:52:06 | // The MIT License
// Copyright © 2023 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 | [
4236,
4282,
4353,
4353,
4704
] | [
[
1213,
1264,
1328,
1451,
2914
],
[
2980,
3029,
3081,
3081,
3195
],
[
3197,
3246,
3293,
3293,
3325
],
[
3513,
3513,
3574,
3644,
4234
],
[
4236,
4282,
4353,
4353,
4704
],
[
4706,
4751,
... | // https://iquilezles.org/articles/normalsSDF
| vec3 calcNormal( in vec3 pos, in bool showSurface, vec3 samplePoint )
{ |
vec2 e = vec2(1.0,-1.0)*0.5773;
const float eps = 0.0005;
return normalize( e.xyy*map( pos + e.xyy*eps, showSurface, samplePoint ).x +
e.yyx*map( pos + e.yyx*eps, showSurface, samplePoint ).x +
e.yxy*map( pos + e.yxy*eps, showSurface, samplePoint ).x +
e.xxx*map( pos + e.xxx*eps, sh... | // https://iquilezles.org/articles/normalsSDF
vec3 calcNormal( in vec3 pos, in bool showSurface, vec3 samplePoint )
{ | 1 | 1 |
ddd3zs | iq | 2023-03-02T04:52:06 | // The MIT License
// Copyright © 2023 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 | [
4706,
4751,
4832,
4832,
5218
] | [
[
1213,
1264,
1328,
1451,
2914
],
[
2980,
3029,
3081,
3081,
3195
],
[
3197,
3246,
3293,
3293,
3325
],
[
3513,
3513,
3574,
3644,
4234
],
[
4236,
4282,
4353,
4353,
4704
],
[
4706,
4751,
... | // https://iquilezles.org/articles/rmshadows
| float calcSoftShadow( vec3 ro, vec3 rd, in bool showSurface, vec3 samplePoint )
{ |
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, samplePoint).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);
ret... | // https://iquilezles.org/articles/rmshadows
float calcSoftShadow( vec3 ro, vec3 rd, in bool showSurface, vec3 samplePoint )
{ | 1 | 1 |
ddt3Rs | iq | 2023-03-02T04:51:38 | // The MIT License
// Copyright © 2023 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 | [
1301,
1396,
1475,
1475,
2350
] | [
[
1301,
1396,
1475,
1475,
2350
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdgTrapezoid( in vec2 p, in float ra, float rb, float he, out vec2 ocl )
{ |
float sx = (p.x<0.0)?-1.0:1.0;
float sy = (p.y<0.0)?-1.0:1.0;
p.x = abs(p.x);
vec4 res;
// bottom and top edges
{
float h = min(p.x,(p.y<0.0)?ra:rb);
vec2 c = vec2(h,sy*he);
vec2 q = p - c;
float d = dot(q,q);
float s = abs(p.y) - he;
res = ... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdgTrapezoid( in vec2 p, in float ra, float rb, float he, out vec2 ocl )
{ | 1 | 1 |
mt3Gzl | bub | 2023-05-01T05:14:30 | // 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 | [
1660,
1733,
1778,
1778,
1903
] | [
[
1660,
1733,
1778,
1778,
1903
]
] | //where is major radius and minor radius?
//ra is major and rb is minor?
| 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)) );
} | //where is major radius and minor radius?
//ra is major and rb is minor?
vec4 sdgTorus( vec3 p, float ra, float rb )
{ | 2 | 2 |
cs2yzG | iq | 2023-06-27T05:15:20 | // The MIT License
// Copyright © 2023 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 | [
1873,
1916,
1968,
1968,
2092
] | [
[
1411,
1411,
1478,
1501,
1870
],
[
1873,
1916,
1968,
1968,
2092
],
[
2094,
2094,
2151,
2170,
3725
]
] | // iquilezles.org/articles/distfunctions2d
| float udSegment( in vec2 p, in vec2 a, in vec2 b )
{ |
vec2 ba = b-a;
vec2 pa = p-a;
float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
return length(pa-h*ba);
} | // iquilezles.org/articles/distfunctions2d
float udSegment( in vec2 p, in vec2 a, in vec2 b )
{ | 1 | 11 |
DslcWB | pizzahollandaise | 2023-06-22T07:13:11 | // 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 | [
1419,
1485,
1508,
1508,
1527
] | [
[
1241,
1241,
1275,
1275,
1327
],
[
1329,
1329,
1361,
1361,
1395
],
[
1419,
1485,
1508,
1508,
1527
],
[
1528,
1528,
1587,
1651,
2473
],
[
2475,
2475,
2495,
2495,
2726
],
[
2729,
2729,
... | // Rounded capsule https://iquilezles.org/articles/distfunctions/
| float dot2(in vec3 v) { | return dot(v,v); } | // Rounded capsule https://iquilezles.org/articles/distfunctions/
float dot2(in vec3 v) { | 2 | 7 |
csscRl | pizzahollandaise | 2023-06-18T16:31:14 | // 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 | [
1219,
1323,
1389,
1389,
1543
] | [
[
1219,
1323,
1389,
1389,
1543
],
[
1545,
1545,
1564,
1564,
1757
],
[
1760,
1760,
1817,
1817,
2436
]
] | // Essentially the box from iq
// Squared distance so you only have to take one sqrt for multiple aabbs
| float sqAABB( in vec2 p, in vec2 minCorner, in vec2 maxCorner )
{ |
vec2 size = (maxCorner - minCorner) * 0.5;
vec2 center = minCorner + size;
vec2 d = max(abs(p - center) - size, 0.0);
return dot(d, d);
} | // Essentially the box from iq
// Squared distance so you only have to take one sqrt for multiple aabbs
float sqAABB( in vec2 p, in vec2 minCorner, in vec2 maxCorner )
{ | 1 | 1 |
DdlyRr | lush3dash1 | 2023-06-11T21:14:16 | // "Wind Waker Ocean" by @Polyflare (29/1/15)
// License: Creative Commons Attribution 4.0 International
// Source code for the texture generator is available at:
// https://github.com/lmurray/circleator
//-----------------------------------------------------------------------------
// User settings
// 0 = No antial... | cc-by-4.0 | [
6034,
6081,
6113,
6113,
6970
] | [
[
1241,
1241,
1280,
1280,
1467
],
[
1469,
1538,
1565,
1565,
6032
],
[
6034,
6081,
6113,
6113,
6970
],
[
6972,
7019,
7043,
7043,
7248
],
[
7250,
7286,
7316,
7316,
7467
]
] | // Procedural texture generation for the water
| vec3 water(vec2 uv, vec3 cdir)
{ |
uv *= vec2(0.25);
#if PARALLAX_WATER
// Parallax height distortion with two directional waves at
// slightly different angles.
vec2 a = 0.025 * cdir.xz / cdir.y; // Parallax offset
float h = sin(uv.x + iTime); // Height at UV
uv += a * h;
h = sin(0.841471 * uv.x - 0.540302 * uv.y + iTi... | // Procedural texture generation for the water
vec3 water(vec2 uv, vec3 cdir)
{ | 2 | 3 |
DdlyRr | lush3dash1 | 2023-06-11T21:14:16 | // "Wind Waker Ocean" by @Polyflare (29/1/15)
// License: Creative Commons Attribution 4.0 International
// Source code for the texture generator is available at:
// https://github.com/lmurray/circleator
//-----------------------------------------------------------------------------
// User settings
// 0 = No antial... | cc-by-4.0 | [
6972,
7019,
7043,
7043,
7248
] | [
[
1241,
1241,
1280,
1280,
1467
],
[
1469,
1538,
1565,
1565,
6032
],
[
6034,
6081,
6113,
6113,
6970
],
[
6972,
7019,
7043,
7043,
7248
],
[
7250,
7286,
7316,
7316,
7467
]
] | // Camera perspective based on [0..1] viewport
| vec3 pixtoray(vec2 uv)
{ |
vec3 pixpos;
pixpos.xy = uv - 0.5;
pixpos.y *= iResolution.y / iResolution.x; // Aspect correction
pixpos.z = -0.6; // Focal length (Controls field of view)
return normalize(pixpos);
} | // Camera perspective based on [0..1] viewport
vec3 pixtoray(vec2 uv)
{ | 2 | 2 |
DdlyRr | lush3dash1 | 2023-06-11T21:14:16 | // "Wind Waker Ocean" by @Polyflare (29/1/15)
// License: Creative Commons Attribution 4.0 International
// Source code for the texture generator is available at:
// https://github.com/lmurray/circleator
//-----------------------------------------------------------------------------
// User settings
// 0 = No antial... | cc-by-4.0 | [
7250,
7286,
7316,
7316,
7467
] | [
[
1241,
1241,
1280,
1280,
1467
],
[
1469,
1538,
1565,
1565,
6032
],
[
6034,
6081,
6113,
6113,
6970
],
[
6972,
7019,
7043,
7043,
7248
],
[
7250,
7286,
7316,
7316,
7467
]
] | // Quaternion-vector multiplication
| vec3 quatmul(vec4 q, vec3 v)
{ |
vec3 qvec = q.xyz;
vec3 uv = cross(qvec, v);
vec3 uuv = cross(qvec, uv);
uv *= (2.0 * q.w);
uuv *= 2.0;
return v + uv + uuv;
} | // Quaternion-vector multiplication
vec3 quatmul(vec4 q, vec3 v)
{ | 2 | 2 |
Dt3SDH | iq | 2023-06-06T07:02:34 | // The MIT License
// https://www.youtube.com/c/InigoQuilez
// https://iquilezles.org/
// Copyright © 2023 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, inclu... | mit | [
1539,
1588,
1640,
1640,
1668
] | [
[
1539,
1588,
1640,
1640,
1668
],
[
1670,
1719,
1768,
1768,
1878
],
[
1880,
1930,
1972,
1972,
2010
],
[
2012,
2061,
2146,
2146,
2530
],
[
2603,
2603,
2657,
2657,
2800
],
[
2802,
2802,
... | // https://iquilezles.org/articles/distfunctions
| float sdCircle( in vec2 p, in vec2 c, in float r )
{ |
return length(p-c)-r;
} | // https://iquilezles.org/articles/distfunctions
float sdCircle( in vec2 p, in vec2 c, in float r )
{ | 2 | 5 |
Dt3SDH | iq | 2023-06-06T07:02:34 | // The MIT License
// https://www.youtube.com/c/InigoQuilez
// https://iquilezles.org/
// Copyright © 2023 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, inclu... | mit | [
1670,
1719,
1768,
1768,
1878
] | [
[
1539,
1588,
1640,
1640,
1668
],
[
1670,
1719,
1768,
1768,
1878
],
[
1880,
1930,
1972,
1972,
2010
],
[
2012,
2061,
2146,
2146,
2530
],
[
2603,
2603,
2657,
2657,
2800
],
[
2802,
2802,
... | // https://iquilezles.org/articles/distfunctions
| 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/articles/distfunctions
float sdLine( in vec2 p, in vec2 a, in vec2 b )
{ | 6 | 23 |
Dt3SDH | iq | 2023-06-06T07:02:34 | // The MIT License
// https://www.youtube.com/c/InigoQuilez
// https://iquilezles.org/
// Copyright © 2023 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, inclu... | mit | [
1880,
1930,
1972,
1972,
2010
] | [
[
1539,
1588,
1640,
1640,
1668
],
[
1670,
1719,
1768,
1768,
1878
],
[
1880,
1930,
1972,
1972,
2010
],
[
2012,
2061,
2146,
2146,
2530
],
[
2603,
2603,
2657,
2657,
2800
],
[
2802,
2802,
... | // https://iquilezles.org/articles/distfunctions/
| vec2 opUnion( vec2 m, float d, float a )
{ |
return (d<m.x) ? vec2(d,a) : m;
} | // https://iquilezles.org/articles/distfunctions/
vec2 opUnion( vec2 m, float d, float a )
{ | 1 | 1 |
Dt3SDH | iq | 2023-06-06T07:02:34 | // The MIT License
// https://www.youtube.com/c/InigoQuilez
// https://iquilezles.org/
// Copyright © 2023 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, inclu... | mit | [
2012,
2061,
2146,
2146,
2530
] | [
[
1539,
1588,
1640,
1640,
1668
],
[
1670,
1719,
1768,
1768,
1878
],
[
1880,
1930,
1972,
1972,
2010
],
[
2012,
2061,
2146,
2146,
2530
],
[
2603,
2603,
2657,
2657,
2800
],
[
2802,
2802,
... | // https://iquilezles.org/articles/intersectors/
| void intersectCircle( in vec2 ro, in vec2 rd, float rad, out vec4 p1, out vec4 p2 )
{ |
float b = dot( ro, rd );
float c = dot( ro, ro ) - rad*rad;
float h = b*b - c;
if( h>0.0 )
{
// real
h = sqrt(h);
p1 = vec4( ro + (-b+h)*rd, ro );
p2 = vec4( ro + (-b-h)*rd, ro );
}
else
{
// complex
h = sqrt(-h);
p1 = vec4( ro - b*rd,... | // https://iquilezles.org/articles/intersectors/
void intersectCircle( in vec2 ro, in vec2 rd, float rad, out vec4 p1, out vec4 p2 )
{ | 1 | 1 |
slGyWt | iq | 2023-06-02T00:42:14 | // The MIT License
// Copyright © 2023 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 | [
1229,
1333,
1386,
1386,
1454
] | [
[
1229,
1333,
1386,
1386,
1454
],
[
1456,
1560,
1597,
1597,
1855
],
[
1858,
1858,
1887,
1887,
1915
],
[
2726,
2726,
2750,
2750,
2934
],
[
2936,
2936,
2959,
2959,
3108
],
[
3112,
3112,
... | // SDFs from iquilezles.org/articles/distfunctions2d
// .x = f(p), .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdgCircle( in vec2 p, in vec2 c, in float r )
{ |
p -= c;
float l = length(p);
return vec3( l-r, p/l );
} | // SDFs from iquilezles.org/articles/distfunctions2d
// .x = f(p), .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdgCircle( in vec2 p, in vec2 c, in float r )
{ | 1 | 1 |
slGyWt | iq | 2023-06-02T00:42:14 | // The MIT License
// Copyright © 2023 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 | [
1456,
1560,
1597,
1597,
1855
] | [
[
1229,
1333,
1386,
1386,
1454
],
[
1456,
1560,
1597,
1597,
1855
],
[
1858,
1858,
1887,
1887,
1915
],
[
2726,
2726,
2750,
2750,
2934
],
[
2936,
2936,
2959,
2959,
3108
],
[
3112,
3112,
... | // SDFs from iquilezles.org/articles/distfunctions2d
// .x = f(p), .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdgBox( in vec2 p, in vec2 b )
{ |
vec2 w = abs(p)-b;
vec2 s = vec2(p.x<0.0?-1:1,p.y<0.0?-1:1);
float g = max(w.x,w.y);
vec2 q = max(w,0.0);
float l = length(q);
return vec3( (g>0.0)?l: g,
s*((g>0.0)?q/l : ((w.x>w.y)?vec2(1,0):vec2(0,1))));
} | // SDFs from iquilezles.org/articles/distfunctions2d
// .x = f(p), .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdgBox( in vec2 p, in vec2 b )
{ | 1 | 5 |
DldXRf | iq | 2023-06-01T22:51:37 | // The MIT License
// Copyright © 2023 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 | [
1363,
1458,
1486,
1486,
2088
] | [
[
1363,
1458,
1486,
1486,
2088
],
[
2091,
2091,
2148,
2148,
3108
]
] | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
| vec3 sdgHeart( in vec2 p )
{ |
float sx = p.x<0.0?-1.0:1.0;
p.x = abs(p.x);
if( p.y+p.x>1.0 )
{
const float r = sqrt(2.0)/4.0;
vec2 q0 = p - vec2(0.25,0.75);
float l = length(q0);
vec3 d = vec3(l-r,q0/l);
d.y *= sx;
return d;
}
else
{
vec2 q1 = p-vec2(0.0,1.0)... | // .x = f(p)
// .y = ∂f(p)/∂x
// .z = ∂f(p)/∂y
// .yz = ∇f(p) with ‖∇f(p)‖ = 1
vec3 sdgHeart( in vec2 p )
{ | 1 | 1 |
ctfcW4 | SnoopethDuckDuck | 2023-07-30T13:52:14 | // License: CC0
#define pi 3.14159
#define ss(a) smoothstep(-1./R.y, 1./R.y, .02 - length(u - a))
// Spring easing function:
// https://www.desmos.com/calculator/vluz5j0svo
// Wobble both ways (green)
// https://www.desmos.com/calculator/9atfimg1ox
#define f(a,b,x) sign(cos(x)) \
* (1. - exp(-(a) * ab... | cc0-1.0 | [
358,
438,
496,
496,
685
] | [
[
358,
438,
496,
496,
685
],
[
687,
889,
934,
991,
1723
],
[
1731,
1731,
1772,
1772,
2067
]
] | // Instant push -> wobble (red)
// https://www.desmos.com/calculator/gbkax818fx
| float g(float a1, float b1, float a2, float b2, float x) { |
x = mod(x, 2.);
float f1 = 1. - exp(-a1 * x) * cos(b1 * x);
float f2 = exp(-a2 * (x-1.)) * cos(b2 * (x-1.));
f2 = mix(1., f2, step(1., x));
return 1. - 2. * f1 * f2;
} | // Instant push -> wobble (red)
// https://www.desmos.com/calculator/gbkax818fx
float g(float a1, float b1, float a2, float b2, float x) { | 1 | 1 |
ctfcW4 | SnoopethDuckDuck | 2023-07-30T13:52:14 | // License: CC0
#define pi 3.14159
#define ss(a) smoothstep(-1./R.y, 1./R.y, .02 - length(u - a))
// Spring easing function:
// https://www.desmos.com/calculator/vluz5j0svo
// Wobble both ways (green)
// https://www.desmos.com/calculator/9atfimg1ox
#define f(a,b,x) sign(cos(x)) \
* (1. - exp(-(a) * ab... | cc0-1.0 | [
687,
889,
934,
991,
1723
] | [
[
358,
438,
496,
496,
685
],
[
687,
889,
934,
991,
1723
],
[
1731,
1731,
1772,
1772,
2067
]
] | // Slow push -> wobble (blue)
// https://www.desmos.com/calculator/rwsnoaj9by
// a: oscillation strength, a > 0
// b: oscillation amount, b = anything
// n: Superellipse strength, n = 2, 4, 6, etc.
| float h(float a, float b, float n, float x) { |
float s = sign(mod(x, 4.) - 2.);
// Make x periodic
x = mod(x, 2.);
// Clamp x so mix(f,g,v) is a quarter superellipse for 1 < x < 2
float v = min(1., x);
// Spring equation
float f = 1. - exp(-a * x) * cos(b * x);
// Half superellipse equation (n = 2. is circle)
... | // Slow push -> wobble (blue)
// https://www.desmos.com/calculator/rwsnoaj9by
// a: oscillation strength, a > 0
// b: oscillation amount, b = anything
// n: Superellipse strength, n = 2, 4, 6, etc.
float h(float a, float b, float n, float x) { | 1 | 1 |
ms2BWV | alphardex | 2023-07-24T07:28:13 | //
// Description : Array and textureless GLSL 2D/3D/4D simplex
// noise functions.
// 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 L... | mit | [
4014,
4082,
4108,
4108,
4295
] | [
[
392,
392,
412,
412,
452
],
[
454,
454,
474,
474,
514
],
[
516,
516,
537,
537,
574
],
[
576,
576,
604,
604,
653
],
[
655,
655,
677,
677,
3269
],
[
3295,
3295,
3313,
3313,
3988... | // inspired from: https://www.shadertoy.com/view/fsjyR3
| float paperNoise(vec2 uv){ |
float n1=fbm(vec3(uv.xy+vec2(1.,0.),0.));
float n2=fbm(vec3(uv.xy-vec2(1.,0.),0.));
float n=n1-n2;
return n;
} | // inspired from: https://www.shadertoy.com/view/fsjyR3
float paperNoise(vec2 uv){ | 1 | 1 |
Dtf3Dl | iq | 2023-07-21T20:43:16 | // The MIT License
// Copyright © 2023 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 | [
1359,
1389,
1419,
1419,
3543
] | [
[
1174,
1174,
1201,
1201,
1357
],
[
1359,
1389,
1419,
1419,
3543
],
[
3549,
3549,
3606,
3606,
4082
]
] | // Cost: (6/14 MUL 6/13 ADD)
| vec3 compute( int x, int y )
{ |
int R, B;
//-------------------------
// Section A (2 MUL, 3 ADD)
//-------------------------
int u = x-36;
int v = 18-y;
int u2 = u*u;
int v2 = v*v;
int h = u2 + v2;
//-------------------------
if( h < 200 )
{
//---------------------------------... | // Cost: (6/14 MUL 6/13 ADD)
vec3 compute( int x, int y )
{ | 1 | 1 |
ml2cWc | MattOstgard | 2023-08-18T18:09:43 | // The MIT License
// Copyright © 2016 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 | [
7134,
7203,
7231,
7231,
7421
] | [
[
1532,
2003,
2080,
2153,
4752
],
[
4755,
5053,
5117,
5209,
5883
],
[
5886,
6252,
6322,
6404,
7132
],
[
7134,
7203,
7231,
7231,
7421
]
] | // Generate a pattern (grid-like) based on the given UV coordinates.
| vec3 pattern( in vec2 uv )
{ |
vec3 col = vec3(0.6);
col += 0.4*smoothstep(-0.01,0.01,cos(uv.x*0.5)*cos(uv.y*0.5));
col *= smoothstep(-1.0,-0.98,cos(uv.x))*smoothstep(-1.0,-0.98,cos(uv.y));
return col;
} | // Generate a pattern (grid-like) based on the given UV coordinates.
vec3 pattern( in vec2 uv )
{ | 6 | 36 |
dt2yDK | iq | 2023-08-18T01:10:50 | // The MIT License
// Copyright © 2023 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 | [
1156,
1184,
1249,
1249,
1403
] | [
[
1156,
1184,
1249,
1249,
1403
],
[
1732,
1755,
1820,
1820,
1966
],
[
1968,
1968,
2025,
2061,
3243
]
] | // Closest point on segment
| vec2 cloSegment( in vec2 p, in vec2 a, in vec2 b, in float th )
{ |
vec2 ba = b-a;
vec2 pa = p-a;
float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
vec2 c = a + h*ba;
return c + th*normalize(p-c);
} | // Closest point on segment
vec2 cloSegment( in vec2 p, in vec2 a, in vec2 b, in float th )
{ | 1 | 1 |
dt2yDK | iq | 2023-08-18T01:10:50 | // The MIT License
// Copyright © 2023 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 | [
1732,
1755,
1820,
1820,
1966
] | [
[
1156,
1184,
1249,
1249,
1403
],
[
1732,
1755,
1820,
1820,
1966
],
[
1968,
1968,
2025,
2061,
3243
]
] | // distance to segment
| float sdSegment( in vec2 p, in vec2 a, in vec2 b, in float th )
{ |
vec2 ba = b-a;
vec2 pa = p-a;
float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
vec2 q = pa-h*ba;
return length(q) - th;
} | // distance to segment
float sdSegment( in vec2 p, in vec2 a, in vec2 b, in float th )
{ | 1 | 1 |
DljcDG | iq | 2023-08-17T22:23:32 | // The MIT License
// Copyright © 2023 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 | [
1157,
1189,
1240,
1240,
1554
] | [
[
1157,
1189,
1240,
1240,
1554
],
[
1556,
1583,
1634,
1634,
1735
],
[
1737,
1737,
1794,
1830,
2895
]
] | // closest point on rounded box
| vec2 cloRoundBox( in vec2 p, in vec2 b, float r )
{ |
vec2 s = vec2(p.x<0.0?-1:1,p.y<0.0?-1:1);
vec2 w = abs(p) - b;
if( max(w.x,w.y)>0.0 )
{
vec2 q = max(w,0.0);
float l = length(q);
p -= s*(l-r)*q/l;
}
else
{
if( w.x>w.y ) p.x = s.x*(b.x+r);
else p.y = s.y*(b.y+r);
}
return p;
} | // closest point on rounded box
vec2 cloRoundBox( in vec2 p, in vec2 b, float r )
{ | 1 | 1 |
DljcDG | iq | 2023-08-17T22:23:32 | // The MIT License
// Copyright © 2023 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 | [
1556,
1583,
1634,
1634,
1735
] | [
[
1157,
1189,
1240,
1240,
1554
],
[
1556,
1583,
1634,
1634,
1735
],
[
1737,
1737,
1794,
1830,
2895
]
] | // distance to rounded box
| float sdRoundBox( in vec2 p, in vec2 b, float r )
{ |
vec2 w = abs(p)-b;
float g = max(w.x,w.y);
return ((g>0.0)?length(max(w,0.0)):g) - r;
} | // distance to rounded box
float sdRoundBox( in vec2 p, in vec2 b, float r )
{ | 1 | 1 |
cldSzf | iq | 2023-08-17T22:23:20 | // The MIT License
// Copyright © 2023 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 | [
1917,
1936,
1973,
1973,
2067
] | [
[
1714,
1714,
1751,
1751,
1914
],
[
1917,
1936,
1973,
1973,
2067
],
[
2069,
2069,
2126,
2162,
3174
]
] | // distance to box
| float sdBox( in vec2 p, in vec2 b )
{ |
vec2 w = abs(p)-b;
float g = max(w.x,w.y);
return (g>0.0)?length(max(w,0.0)):g;
} | // distance to box
float sdBox( in vec2 p, in vec2 b )
{ | 1 | 145 |
Dt2yRV | iY0Yi | 2023-08-14T14:32:21 | // Hash without Sine
// MIT License...
// Copyright (c)2014 David Hoskins.
//https://www.shadertoy.com/view/4djSRW
float hash12(vec2 p){
vec3 p3 = fract(vec3(p.xyx) * .1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
}
int getDigits(float f, int digc, int index) {
// Note: For 32... | mit | [
0,
115,
136,
136,
253
] | [
[
0,
115,
136,
136,
253
],
[
255,
255,
300,
622,
844
],
[
846,
846,
891,
891,
924
],
[
926,
926,
965,
965,
998
],
[
1000,
1000,
1056,
1056,
1621
]
] | // Hash without Sine
// MIT License...
// Copyright (c)2014 David Hoskins.
//https://www.shadertoy.com/view/4djSRW
| float hash12(vec2 p){ |
vec3 p3 = fract(vec3(p.xyx) * .1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
} | // Hash without Sine
// MIT License...
// Copyright (c)2014 David Hoskins.
//https://www.shadertoy.com/view/4djSRW
float hash12(vec2 p){ | 12 | 19 |
msKyDR | uctumi | 2023-09-30T21:00:47 | /*
* Copyright 2014 Roman Bobniev (FatumR)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... | apache-2.0 | [
841,
877,
910,
910,
1511
] | [
[
654,
654,
674,
674,
745
],
[
747,
747,
768,
768,
839
],
[
841,
877,
910,
910,
1511
],
[
1513,
1513,
1534,
1534,
2026
],
[
2028,
2028,
2057,
2057,
2332
],
[
2797,
2797,
2854,
2854... | // Rough Value noise implementation
| float valueNoiseSimple(vec2 vl) { |
float minStep = 1.0 ;
vec2 grid = floor(vl);
vec2 gridPnt1 = grid;
vec2 gridPnt2 = vec2(grid.x, grid.y + minStep);
vec2 gridPnt3 = vec2(grid.x + minStep, grid.y);
vec2 gridPnt4 = vec2(gridPnt3.x, gridPnt2.y);
float s = rand2(grid);
float t = rand2(gridPnt3);
float u = rand2(gridPnt2);
... | // Rough Value noise implementation
float valueNoiseSimple(vec2 vl) { | 3 | 5 |
msdBWX | virmoesiae | 2023-10-19T16:13:27 | /*
AD BY VIRMODOETIAE, a.k.a VIRMOESIAE ---------------------------
Do you like shaders? Would you like to toy with them offline?
Would you like an interactive UI to play around with your shader
variables/uniforms in real-time without compilation? Would you
like to have a layer-based shader ble... | libpng | [
1611,
1656,
1678,
1678,
1739
] | [
[
1611,
1656,
1678,
1678,
1739
],
[
1741,
1752,
1774,
1774,
1913
],
[
1915,
1966,
1997,
1997,
2278
],
[
2280,
2338,
2368,
2368,
2865
],
[
2867,
3029,
3058,
3058,
3481
],
[
3483,
3536,
... | // My take on the pseudo-random number thing
| float random(vec2 x)
{ |
return fract(138912.*sin(dot(x, vec2(138.9, 191.2))));
} | // My take on the pseudo-random number thing
float random(vec2 x)
{ | 1 | 1 |
msdBWX | virmoesiae | 2023-10-19T16:13:27 | /*
AD BY VIRMODOETIAE, a.k.a VIRMOESIAE ---------------------------
Do you like shaders? Would you like to toy with them offline?
Would you like an interactive UI to play around with your shader
variables/uniforms in real-time without compilation? Would you
like to have a layer-based shader ble... | libpng | [
1741,
1752,
1774,
1774,
1913
] | [
[
1611,
1656,
1678,
1678,
1739
],
[
1741,
1752,
1774,
1774,
1913
],
[
1915,
1966,
1997,
1997,
2278
],
[
2280,
2338,
2368,
2368,
2865
],
[
2867,
3029,
3058,
3058,
3481
],
[
3483,
3536,
... | // From iq
| vec2 random2(vec2 st){ |
st = vec2( dot(st,vec2(127.1,311.7)),
dot(st,vec2(269.5,183.3)) );
return -1.0 + 2.0*fract(sin(st)*43758.5453123);
} | // From iq
vec2 random2(vec2 st){ | 39 | 56 |
msdBWX | virmoesiae | 2023-10-19T16:13:27 | /*
AD BY VIRMODOETIAE, a.k.a VIRMOESIAE ---------------------------
Do you like shaders? Would you like to toy with them offline?
Would you like an interactive UI to play around with your shader
variables/uniforms in real-time without compilation? Would you
like to have a layer-based shader ble... | libpng | [
2867,
3029,
3058,
3058,
3481
] | [
[
1611,
1656,
1678,
1678,
1739
],
[
1741,
1752,
1774,
1774,
1913
],
[
1915,
1966,
1997,
1997,
2278
],
[
2280,
2338,
2368,
2368,
2865
],
[
2867,
3029,
3058,
3058,
3481
],
[
3483,
3536,
... | // A 2D noise implementation I came up with that requires
// one less call to the pseudo-random number generator and
// one less mixing. Easily extandable to 3D
| float triValueNoise(vec2 x)
{ |
x.y *= 1.1547;
x.x -= 0.5*x.y;
vec2 l = floor(x);
vec2 r = fract(x);
float s = float(int(r.x+r.y > 1.));
vec2 e = vec2(1.,0.);
float a = random(l+s*e.yx);
float b = random(l+s*e.yx+e.xy);
float c = random(l+s*e.xy+(1.-s)*e.yx);
r.y = s+r.y*(1.-2.*s);
r.x = (r.x-s*r.y)/(1.-r.... | // A 2D noise implementation I came up with that requires
// one less call to the pseudo-random number generator and
// one less mixing. Easily extandable to 3D
float triValueNoise(vec2 x)
{ | 1 | 1 |
msdBWX | virmoesiae | 2023-10-19T16:13:27 | /*
AD BY VIRMODOETIAE, a.k.a VIRMOESIAE ---------------------------
Do you like shaders? Would you like to toy with them offline?
Would you like an interactive UI to play around with your shader
variables/uniforms in real-time without compilation? Would you
like to have a layer-based shader ble... | libpng | [
4116,
4197,
4216,
4216,
4555
] | [
[
1611,
1656,
1678,
1678,
1739
],
[
1741,
1752,
1774,
1774,
1913
],
[
1915,
1966,
1997,
1997,
2278
],
[
2280,
2338,
2368,
2368,
2865
],
[
2867,
3029,
3058,
3058,
3481
],
[
3483,
3536,
... | // Fractional Brownian Motion noise to test the
// single-octave noise function
| float fbm(vec2 x)
{ |
float n = 0.;
float A = 0.;
vec2 af = vec2(1., 2.);
for (int i=0; i<4; i++)
{
// Rotate each octave
float s = sin(float(2*i));
float c = cos(float(2*i));
mat2 m = mat2(c, s, -s, c);
n += af.x*NOISE(af.y*m*x);
A += af.x;
af *= vec2(.4,2.);
... | // Fractional Brownian Motion noise to test the
// single-octave noise function
float fbm(vec2 x)
{ | 1 | 9 |
msdBWX | virmoesiae | 2023-10-19T16:13:27 | /*
AD BY VIRMODOETIAE, a.k.a VIRMOESIAE ---------------------------
Do you like shaders? Would you like to toy with them offline?
Would you like an interactive UI to play around with your shader
variables/uniforms in real-time without compilation? Would you
like to have a layer-based shader ble... | libpng | [
4557,
4631,
4654,
4654,
4822
] | [
[
1611,
1656,
1678,
1678,
1739
],
[
1741,
1752,
1774,
1774,
1913
],
[
1915,
1966,
1997,
1997,
2278
],
[
2280,
2338,
2368,
2368,
2865
],
[
2867,
3029,
3058,
3058,
3481
],
[
3483,
3536,
... | // A warp-based pattern inspired by https://iquilezles.org/articles/warp/
| float pattern(vec2 x)
{ |
vec2 a = vec2(fbm(x)+iTime/15., fbm(x+vec2(2.2,0.)));
float b = fbm(x+a+iTime/10.);
vec2 c = vec2(fbm(x+b), fbm(a-vec2(1.7,0.)));
return fbm(x+.5*c);
} | // A warp-based pattern inspired by https://iquilezles.org/articles/warp/
float pattern(vec2 x)
{ | 1 | 2 |
dsGyWy | Zavie | 2023-10-05T20:46:19 | /*
This shader visualises the relative solid angle of the texels
of the face of a cubemap (compared to the center texel).
A very simple approximation is proposed. The approximation is
too crude for very low resolutions, but beyond 8x8 it seems
to result in under 1% error.
Maybe a fitting or offset could correct the ... | cc-by-4.0 | [
1519,
1758,
1795,
1795,
1847
] | [
[
835,
835,
899,
899,
1517
],
[
1519,
1758,
1795,
1795,
1847
],
[
1849,
1849,
1899,
1899,
2349
],
[
2351,
2351,
2409,
2409,
2496
],
[
2561,
2561,
2597,
2597,
2629
],
[
2631,
2631,
2654... | //
// areaElement and texelSolidAngle are adapted from
// AMD cubemapgen source code:
// https://code.google.com/archive/p/cubemapgen/
//
// See the derivation here:
// https://www.rorydriscoll.com/2012/01/15/cubemap-texel-solid-angle/
//
| float areaElement(float x, float y)
{ |
return atan(x * y, sqrt(x * x + y * y + 1.));
} | //
// areaElement and texelSolidAngle are adapted from
// AMD cubemapgen source code:
// https://code.google.com/archive/p/cubemapgen/
//
// See the derivation here:
// https://www.rorydriscoll.com/2012/01/15/cubemap-texel-solid-angle/
//
float areaElement(float x, float y)
{ | 1 | 1 |
ctdfzN | Peace | 2023-11-26T20:59:48 | // The MIT License
// Copyright © 2024 Giorgi Azmaipharashvili
// 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, ... | mit | [
1090,
1166,
1188,
1188,
1325
] | [
[
1090,
1166,
1188,
1188,
1325
],
[
1327,
1408,
1433,
1433,
2009
],
[
2011,
2011,
2064,
2064,
2677
]
] | // From David Hoskins (MIT licensed): https://www.shadertoy.com/view/4djSRW
| vec3 hash33(vec3 p3) { |
p3 = fract(p3 * vec3(0.1031, 0.1030, 0.0973));
p3 += dot(p3, p3.yxz + 33.33);
return fract((p3.xxy + p3.yxx) * p3.zyx) - 0.5;
} | // From David Hoskins (MIT licensed): https://www.shadertoy.com/view/4djSRW
vec3 hash33(vec3 p3) { | 1 | 13 |
ctdfzN | Peace | 2023-11-26T20:59:48 | // The MIT License
// Copyright © 2024 Giorgi Azmaipharashvili
// 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, ... | mit | [
1327,
1408,
1433,
1433,
2009
] | [
[
1090,
1166,
1188,
1188,
1325
],
[
1327,
1408,
1433,
1433,
2009
],
[
2011,
2011,
2064,
2064,
2677
]
] | // From Nikita Miropolskiy (MIT licensed): https://www.shadertoy.com/view/XsX3zB
| float simplex3d(vec3 p) { |
vec3 s = floor(p + dot(p, vec3(1.0 / 3.0)));
vec3 x = p - s + dot(s, vec3(1.0 / 6.0));
vec3 e = step(vec3(0), x - x.yzx);
vec3 i1 = e * (1.0 - e.zxy);
vec3 i2 = 1.0 - e.zxy * (1.0 - e);
vec3 x1 = x - i1 + 1.0 / 6.0;
vec3 x2 = x - i2 + 1.0 / 3.0;
vec3 x3 = x - 0.5;
vec4 w = max(0.6 - vec4(dot(x, x), d... | // From Nikita Miropolskiy (MIT licensed): https://www.shadertoy.com/view/XsX3zB
float simplex3d(vec3 p) { | 1 | 56 |
clGyWm | iq | 2023-11-18T00:27:31 | // The MIT License
// Copyright © 2023 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 | [
1213,
1312,
1339,
1339,
1464
] | [
[
1213,
1312,
1339,
1339,
1464
],
[
1466,
1466,
1494,
1494,
2306
],
[
2308,
2308,
2365,
2365,
2792
]
] | // please never use this hash or any other fract based
// hash in production. they are really bad.
| vec2 hash( in vec2 x )
{ |
const vec2 k = vec2( 0.3183099, 0.3678794 );
x = x*k + k.yx;
return fract( 16.0*k*fract( x.x*x.y*(x.x+x.y)) );
} | // please never use this hash or any other fract based
// hash in production. they are really bad.
vec2 hash( in vec2 x )
{ | 1 | 1 |
dtGyWw | fishy | 2023-11-17T23:40:21 | // The MIT License
// Copyright © 2015 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 | [
1868,
1903,
1955,
1955,
2078
] | [
[
1868,
1903,
1955,
1955,
2078
],
[
2080,
2080,
2123,
2179,
2850
],
[
2852,
2852,
2909,
2909,
3772
]
] | // for visualization purposes only
| float sdSegment( in vec2 p, in vec2 a, in vec2 b )
{ |
vec2 ba = b-a;
vec2 pa = p-a;
float h =clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
return length(pa-h*ba);
} | // for visualization purposes only
float sdSegment( in vec2 p, in vec2 a, in vec2 b )
{ | 2 | 121 |
dldyWN | lf94 | 2023-11-06T03:44:40 | // 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 | [
1600,
1626,
1674,
1674,
1925
] | [
[
1230,
1288,
1330,
1330,
1374
],
[
1376,
1453,
1489,
1489,
1598
],
[
1600,
1626,
1674,
1674,
1925
],
[
1927,
1927,
1984,
1984,
2699
]
] | // This is the final form
| float sdBox( in vec2 p, in vec2 b, in vec2 r )
{ |
vec2 s = max(vec2(r.y/r.x, r.x/r.y), 1.);
vec2 b2 = b*vec2(r.y/r.x, r.x/r.y);
vec2 d = abs(p)-b2;
vec2 d2 = vec2((d.x-r.x)*s.x, (d.y-r.y)*s.y);
return (length(max(d2,0.0)) + min(max(d2.x,d2.y),0.0)) - max(r.y/r.x, r.x/r.y);
} | // This is the final form
float sdBox( in vec2 p, in vec2 b, in vec2 r )
{ | 1 | 1 |
dltcW4 | hasse | 2023-11-06T00:35:27 | // Forked from https://www.shadertoy.com/view/ll3Xzf
// Original license text:
// The MIT License
// Copyright © 2016 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 restri... | mit | [
1158,
1507,
1665,
1665,
2864
] | [
[
1158,
1507,
1665,
1665,
2864
],
[
2866,
2891,
3052,
3052,
3222
],
[
3224,
3224,
3281,
3281,
5204
]
] | // Disk projection code (project_disk()) is by me and is CC0.
// Currently, there's some float instability near grazing angles.
// https://math.stackexchange.com/questions/2411047/parameters-of-the-conic-curve-resulting-from-the-perspective-projection-of-a-cir/2411591#comment4978079_2411047
// https://en.wikipedia.org/... | void project_disk(
vec3 center,
vec3 normal,
float radius,
vec2 proj_info,
out vec2 proj_center,
out vec2 major,
out vec2 minor
){ |
float nc = dot(normal, center);
float r2 = radius * radius;
float c2r2 = dot(center, center) - r2;
vec3 n2 = normal * normal;
vec3 ACF = nc * nc - 2.0f * center * normal * nc + c2r2 * n2;
float A = ACF.x, C = ACF.y, F = ACF.z;
float B = 2.0f * c2r2 * normal.x * normal.y - 2.0f * (center.x ... | // Disk projection code (project_disk()) is by me and is CC0.
// Currently, there's some float instability near grazing angles.
// https://math.stackexchange.com/questions/2411047/parameters-of-the-conic-curve-resulting-from-the-perspective-projection-of-a-cir/2411591#comment4978079_2411047
// https://en.wikipedia.org/... | 1 | 1 |
Dts3R2 | piyushslayer | 2023-12-24T18:31:04 | /**
* Creative Commons CC0 1.0 Universal (CC-0)
*
* A simple christmas tree made from 2D points.
*
*/
#define PI 3.1415926535
#define TAU 6.2831853071
#define ROTATE(v, x) mat2(cos(x), sin(x), -sin(x), cos(x)) * v
#define REMAP_HALF_NDC(x, c, d) (((x + 0.5) * (d - c)) + c) // Remap from [-0.5, 0.5] domain to [c, d]
#... | cc0-1.0 | [
800,
841,
863,
863,
980
] | [
[
800,
841,
863,
863,
980
],
[
982,
982,
1004,
1004,
1137
],
[
1139,
1247,
1361,
1361,
1588
],
[
1590,
1590,
1653,
1653,
2262
],
[
2264,
2264,
2327,
2327,
3853
],
[
3855,
3855,
3912,
... | // https://www.shadertoy.com/view/4djSRW
| float Hash12(vec2 p)
{ |
vec3 p3 = fract(vec3(p.xyx) * .1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
} | // https://www.shadertoy.com/view/4djSRW
float Hash12(vec2 p)
{ | 2 | 6 |
Dts3R2 | piyushslayer | 2023-12-24T18:31:04 | /**
* Creative Commons CC0 1.0 Universal (CC-0)
*
* A simple christmas tree made from 2D points.
*
*/
#define PI 3.1415926535
#define TAU 6.2831853071
#define ROTATE(v, x) mat2(cos(x), sin(x), -sin(x), cos(x)) * v
#define REMAP_HALF_NDC(x, c, d) (((x + 0.5) * (d - c)) + c) // Remap from [-0.5, 0.5] domain to [c, d]
#... | cc0-1.0 | [
1139,
1247,
1361,
1361,
1588
] | [
[
800,
841,
863,
863,
980
],
[
982,
982,
1004,
1004,
1137
],
[
1139,
1247,
1361,
1361,
1588
],
[
1590,
1590,
1653,
1653,
2262
],
[
2264,
2264,
2327,
2327,
3853
],
[
3855,
3855,
3912,
... | // Signed distance to an n-star polygon with external angle en by iq: https://www.shadertoy.com/view/3tSGDy
| float SignedDistanceNStar2D(in vec2 p, in float r, in float an, in float bn, in vec2 acs, in float m) // m=[2,n]
{ |
float en = PI / m;
vec2 ecs = vec2(cos(en), sin(en));
p = length(p) * vec2(cos(bn), abs(sin(bn)));
p -= r * acs;
p += ecs * clamp(-dot(p, ecs), 0.0, r * acs.y / ecs.y);
return length(p) * sign(p.x);
} | // Signed distance to an n-star polygon with external angle en by iq: https://www.shadertoy.com/view/3tSGDy
float SignedDistanceNStar2D(in vec2 p, in float r, in float an, in float bn, in vec2 acs, in float m) // m=[2,n]
{ | 2 | 2 |
dtGBRG | Dain | 2023-12-11T01:18:25 | // https://www.shadertoy.com/view/dtGBDz orthogonal circles grassy plant, 2023 jt
// based on https://www.shadertoy.com/view/ctyBzm orthogonal circles flower sdf 3d
// based on https://www.shadertoy.com/view/clGBzm orthogonal circles flower sdf 2
// based on https://www.shadertoy.com/view/dldBWl orthogonal circles flow... | mit | [
5004,
5070,
5093,
5093,
5352
] | [
[
2307,
2307,
2430,
2430,
3560
],
[
3562,
3562,
3581,
3605,
3628
],
[
3629,
3629,
3649,
3673,
3723
],
[
3724,
3724,
3859,
3859,
4286
],
[
4288,
4288,
4345,
4345,
4691
],
[
4693,
4693,
... | // https://iquilezles.org/articles/normalsSDF tetrahedron normals
| vec3 normal( vec3 p )
{ |
const float h = EPSILON;
const vec2 k = vec2(1,-1);
return normalize( k.xyy*map( p + k.xyy*h ) +
k.yyx*map( p + k.yyx*h ) +
k.yxy*map( p + k.yxy*h ) +
k.xxx*map( p + k.xxx*h ) );
} | // https://iquilezles.org/articles/normalsSDF tetrahedron normals
vec3 normal( vec3 p )
{ | 1 | 6 |
dtGBRG | Dain | 2023-12-11T01:18:25 | // https://www.shadertoy.com/view/dtGBDz orthogonal circles grassy plant, 2023 jt
// based on https://www.shadertoy.com/view/ctyBzm orthogonal circles flower sdf 3d
// based on https://www.shadertoy.com/view/clGBzm orthogonal circles flower sdf 2
// based on https://www.shadertoy.com/view/dldBWl orthogonal circles flow... | mit | [
5897,
6182,
6234,
6234,
6287
] | [
[
2307,
2307,
2430,
2430,
3560
],
[
3562,
3562,
3581,
3605,
3628
],
[
3629,
3629,
3649,
3673,
3723
],
[
3724,
3724,
3859,
3859,
4286
],
[
4288,
4288,
4345,
4345,
4691
],
[
4693,
4693,
... | // NOTE: Don't forget to add +normal*EPSILON to the starting position
// to avoid artifacts caused by getting stuck in the surface
// due to starting at distance < EPSILON from the surface.
// (normal could be calculated here but that would most likely be redundant)
| float shadow(vec3 ro, vec3 rd, float t0, float t1)
{ |
return trace(ro, rd, t0, t1) < t1 ? 0.0 : 1.0;
} | // NOTE: Don't forget to add +normal*EPSILON to the starting position
// to avoid artifacts caused by getting stuck in the surface
// due to starting at distance < EPSILON from the surface.
// (normal could be calculated here but that would most likely be redundant)
float shadow(vec3 ro, vec3 rd, floa... | 1 | 1 |
dtGBRG | Dain | 2023-12-11T01:18:25 | // https://www.shadertoy.com/view/dtGBDz orthogonal circles grassy plant, 2023 jt
// based on https://www.shadertoy.com/view/ctyBzm orthogonal circles flower sdf 3d
// based on https://www.shadertoy.com/view/clGBzm orthogonal circles flower sdf 2
// based on https://www.shadertoy.com/view/dldBWl orthogonal circles flow... | mit | [
6779,
6843,
6885,
6885,
7175
] | [
[
2307,
2307,
2430,
2430,
3560
],
[
3562,
3562,
3581,
3605,
3628
],
[
3629,
3629,
3649,
3673,
3723
],
[
3724,
3724,
3859,
3859,
4286
],
[
4288,
4288,
4345,
4345,
4691
],
[
4693,
4693,
... | // https://www.shadertoy.com/view/Xds3zN raymarching primitives
| float calcAO( in vec3 pos, in vec3 nor )
{ |
float occ = 0.0;
float sca = 1.0;
for( int i=0; i<5; i++ )
{
float h = 0.01 + 0.12*float(i)/4.0;
float d = map( pos + h*nor );
occ += (h-d)*sca;
sca *= 0.95;
if( occ>0.35 ) break;
}
return clamp( 1.0 - 3.0*occ, 0.0, 1.0 ) ;
} | // https://www.shadertoy.com/view/Xds3zN raymarching primitives
float calcAO( in vec3 pos, in vec3 nor )
{ | 1 | 259 |
clKfWm | afl_ext | 2023-12-09T21:45:07 | // afl_ext 2017-2023
// MIT License
// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!
#define NormalizedMouse (iMouse.xy / iResolution.xy) // normalize mouse coords
// settings for the shader
#define STEP_SIZE_SCALE 500.0 // lower means more steps
#define CloudsFl... | mit | [
993,
1070,
1130,
1130,
1523
] | [
[
993,
1070,
1130,
1130,
1523
],
[
1525,
1592,
1621,
1621,
2317
],
[
2319,
2340,
2366,
2366,
2454
],
[
2456,
2479,
2500,
2500,
2569
],
[
2571,
2589,
2611,
2611,
3773
],
[
3775,
3807,
3... | // Helper function generating a rotation matrix around the axis by the angle
| mat3 createRotationMatrixAxisAngle(vec3 axis, float angle) { |
float s = sin(angle);
float c = cos(angle);
float oc = 1.0 - c;
return mat3(
oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s,
oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s,
oc * axis.z * axis.x - axis.... | // Helper function generating a rotation matrix around the axis by the angle
mat3 createRotationMatrixAxisAngle(vec3 axis, float angle) { | 1 | 1 |
clKfWm | afl_ext | 2023-12-09T21:45:07 | // afl_ext 2017-2023
// MIT License
// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!
#define NormalizedMouse (iMouse.xy / iResolution.xy) // normalize mouse coords
// settings for the shader
#define STEP_SIZE_SCALE 500.0 // lower means more steps
#define CloudsFl... | mit | [
1525,
1592,
1621,
1621,
2317
] | [
[
993,
1070,
1130,
1130,
1523
],
[
1525,
1592,
1621,
1621,
2317
],
[
2319,
2340,
2366,
2366,
2454
],
[
2456,
2479,
2500,
2500,
2569
],
[
2571,
2589,
2611,
2611,
3773
],
[
3775,
3807,
3... | // Helper function that generates camera ray based on UV and mouse
| vec3 getRay(vec2 fragCoord) { |
vec2 uv = ((fragCoord.xy / iResolution.xy) * 2.0 - 1.0) * vec2(iResolution.x / iResolution.y, 1.0);
// for fisheye, uncomment following line and comment the next one
//vec3 proj = normalize(vec3(uv.x, uv.y, 1.0) + vec3(uv.x, uv.y, -1.0) * pow(length(uv), 2.0) * 0.05);
vec3 proj = normalize(vec3(uv.x, uv.y, 1... | // Helper function that generates camera ray based on UV and mouse
vec3 getRay(vec2 fragCoord) { | 1 | 1 |
clKfWm | afl_ext | 2023-12-09T21:45:07 | // afl_ext 2017-2023
// MIT License
// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!
#define NormalizedMouse (iMouse.xy / iResolution.xy) // normalize mouse coords
// settings for the shader
#define STEP_SIZE_SCALE 500.0 // lower means more steps
#define CloudsFl... | mit | [
2319,
2340,
2366,
2366,
2454
] | [
[
993,
1070,
1130,
1130,
1523
],
[
1525,
1592,
1621,
1621,
2317
],
[
2319,
2340,
2366,
2366,
2454
],
[
2456,
2479,
2500,
2500,
2569
],
[
2571,
2589,
2611,
2611,
3773
],
[
3775,
3807,
3... | // Standard 2d noise
| float rand2dTime(vec2 co){ |
co *= iTime;
return fract(sin(dot(co.xy,vec2(12.9898,78.233))) * 43758.5453);
} | // Standard 2d noise
float rand2dTime(vec2 co){ | 1 | 1 |
clKfWm | afl_ext | 2023-12-09T21:45:07 | // afl_ext 2017-2023
// MIT License
// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!
#define NormalizedMouse (iMouse.xy / iResolution.xy) // normalize mouse coords
// settings for the shader
#define STEP_SIZE_SCALE 500.0 // lower means more steps
#define CloudsFl... | mit | [
2456,
2479,
2500,
2500,
2569
] | [
[
993,
1070,
1130,
1130,
1523
],
[
1525,
1592,
1621,
1621,
2317
],
[
2319,
2340,
2366,
2366,
2454
],
[
2456,
2479,
2500,
2500,
2569
],
[
2571,
2589,
2611,
2611,
3773
],
[
3775,
3807,
3... | // Hash for 3d vectors
| float rand3d(vec3 p){ |
return fract(4768.1232345456 * sin((p.x+p.y*43.0+p.z*137.0)));
} | // Hash for 3d vectors
float rand3d(vec3 p){ | 1 | 1 |
clKfWm | afl_ext | 2023-12-09T21:45:07 | // afl_ext 2017-2023
// MIT License
// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!
#define NormalizedMouse (iMouse.xy / iResolution.xy) // normalize mouse coords
// settings for the shader
#define STEP_SIZE_SCALE 500.0 // lower means more steps
#define CloudsFl... | mit | [
2571,
2589,
2611,
2611,
3773
] | [
[
993,
1070,
1130,
1130,
1523
],
[
1525,
1592,
1621,
1621,
2317
],
[
2319,
2340,
2366,
2366,
2454
],
[
2456,
2479,
2500,
2500,
2569
],
[
2571,
2589,
2611,
2611,
3773
],
[
3775,
3807,
3... | // 3D value noise
| float noise3d(vec3 x){ |
vec3 p = floor(x);
vec3 fr = fract(x);
vec3 LBZ = p + vec3(0.0, 0.0, 0.0);
vec3 LTZ = p + vec3(0.0, 1.0, 0.0);
vec3 RBZ = p + vec3(1.0, 0.0, 0.0);
vec3 RTZ = p + vec3(1.0, 1.0, 0.0);
vec3 LBF = p + vec3(0.0, 0.0, 1.0);
vec3 LTF = p + vec3(0.0, 1.0, 1.0);
vec3 RBF = p + vec3(1.0, 0.... | // 3D value noise
float noise3d(vec3 x){ | 1 | 1 |
clKfWm | afl_ext | 2023-12-09T21:45:07 | // afl_ext 2017-2023
// MIT License
// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!
#define NormalizedMouse (iMouse.xy / iResolution.xy) // normalize mouse coords
// settings for the shader
#define STEP_SIZE_SCALE 500.0 // lower means more steps
#define CloudsFl... | mit | [
3775,
3807,
3834,
3834,
3915
] | [
[
993,
1070,
1130,
1130,
1523
],
[
1525,
1592,
1621,
1621,
2317
],
[
2319,
2340,
2366,
2366,
2454
],
[
2456,
2479,
2500,
2500,
2569
],
[
2571,
2589,
2611,
2611,
3773
],
[
3775,
3807,
3... | // 3D simplex noise, cool trick
| float supernoise3d(vec3 p){ |
float a = noise3d(p);
float b = noise3d(p + 10.5);
return (a + b) * 0.5;
} | // 3D simplex noise, cool trick
float supernoise3d(vec3 p){ | 1 | 2 |
clKfWm | afl_ext | 2023-12-09T21:45:07 | // afl_ext 2017-2023
// MIT License
// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!
#define NormalizedMouse (iMouse.xy / iResolution.xy) // normalize mouse coords
// settings for the shader
#define STEP_SIZE_SCALE 500.0 // lower means more steps
#define CloudsFl... | mit | [
4801,
4870,
4894,
4894,
5105
] | [
[
993,
1070,
1130,
1130,
1523
],
[
1525,
1592,
1621,
1621,
2317
],
[
2319,
2340,
2366,
2366,
2454
],
[
2456,
2479,
2500,
2500,
2569
],
[
2571,
2589,
2611,
2611,
3773
],
[
3775,
3807,
3... | // Pretty self explanatory FBM with some precisely adjusted behavior
| float cloudsFBM(vec3 p){ |
float a = 0.0;
float w = 0.5;
for(int i=0;i<CLOUDS_FBM_STEPS;i++){
float x = abs(0.5 - supernoise3d(p))*2.0;
a += x * w;
p = p * 2.9;
w *= 0.60;
}
return a;
} | // Pretty self explanatory FBM with some precisely adjusted behavior
float cloudsFBM(vec3 p){ | 1 | 1 |
clKfWm | afl_ext | 2023-12-09T21:45:07 | // afl_ext 2017-2023
// MIT License
// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!
#define NormalizedMouse (iMouse.xy / iResolution.xy) // normalize mouse coords
// settings for the shader
#define STEP_SIZE_SCALE 500.0 // lower means more steps
#define CloudsFl... | mit | [
5221,
5393,
5424,
5424,
6194
] | [
[
993,
1070,
1130,
1130,
1523
],
[
1525,
1592,
1621,
1621,
2317
],
[
2319,
2340,
2366,
2366,
2454
],
[
2456,
2479,
2500,
2500,
2569
],
[
2571,
2589,
2611,
2611,
3773
],
[
3775,
3807,
3... | // this function probes the clouds densite at a point
// returns XY
// X = coverage of clouds at this point,
// Y = cloud color at this point, basically incoming radiance
| vec2 cloudsDensity3D(vec3 pos){ |
float h = getHeightOverSurface(pos);
pos -= vec3(0,planetradius,0);
// make sure the clouds look like clouds by making the density
// scale with height between the layers, make it a height coefficent
// this coeff is 1.0 in between the layers, and 0.0 at the edges
float measurement = (Cloud... | // this function probes the clouds densite at a point
// returns XY
// X = coverage of clouds at this point,
// Y = cloud color at this point, basically incoming radiance
vec2 cloudsDensity3D(vec3 pos){ | 1 | 1 |
clKfWm | afl_ext | 2023-12-09T21:45:07 | // afl_ext 2017-2023
// MIT License
// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!
#define NormalizedMouse (iMouse.xy / iResolution.xy) // normalize mouse coords
// settings for the shader
#define STEP_SIZE_SCALE 500.0 // lower means more steps
#define CloudsFl... | mit | [
7849,
8201,
8257,
8257,
8618
] | [
[
993,
1070,
1130,
1130,
1523
],
[
1525,
1592,
1621,
1621,
2317
],
[
2319,
2340,
2366,
2366,
2454
],
[
2456,
2479,
2500,
2500,
2569
],
[
2571,
2589,
2611,
2611,
3773
],
[
3775,
3807,
3... | // very native rendering for the ground, shadow is basically clouds sampled directly above
// this doesnt look that great, but at least look like something...
// by adjusting the direction and smoothstepping the coverage, really nice sun shadows can be achieved
// but with so high clouds coverage no light will peek thr... | vec3 renderGround(vec3 point, float dist, float random){ |
float shadow = raymarchClouds(
point + vec3(0.0, CloudsFloor, 0.0),
point + vec3(0.0, CloudsCeil, 0.0),
random
).x;
vec3 color = vec3(0.2, 0.2, 0.2) * vec3(0.8 + 0.2 * shadow);
float fogIntensity = 1.0 - 1.0 / (0.001 * dist);
return mix(color, FOG... | // very native rendering for the ground, shadow is basically clouds sampled directly above
// this doesnt look that great, but at least look like something...
// by adjusting the direction and smoothstepping the coverage, really nice sun shadows can be achieved
// but with so high clouds coverage no light will peek thr... | 1 | 1 |
clKfWm | afl_ext | 2023-12-09T21:45:07 | // afl_ext 2017-2023
// MIT License
// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!
#define NormalizedMouse (iMouse.xy / iResolution.xy) // normalize mouse coords
// settings for the shader
#define STEP_SIZE_SCALE 500.0 // lower means more steps
#define CloudsFl... | mit | [
8625,
8713,
8806,
8806,
9094
] | [
[
993,
1070,
1130,
1130,
1523
],
[
1525,
1592,
1621,
1621,
2317
],
[
2319,
2340,
2366,
2366,
2454
],
[
2456,
2479,
2500,
2500,
2569
],
[
2571,
2589,
2611,
2611,
3773
],
[
3775,
3807,
3... | // Straightforward, render raymarch, apply fog, alpha blend with the background, return
| vec3 renderClouds(vec3 pointStart, vec3 pointEnd, vec3 background, float dist, float random){ |
vec4 clouds = raymarchClouds(
pointStart,
pointEnd,
random
);
vec3 color = mix(background, clouds.xyz, clouds.a);
float fogIntensity = 1.0 - 1.0 / (0.0001 * dist);
return mix(color, FOG_COLOR, clamp(fogIntensity, 0.0, 1.0));
} | // Straightforward, render raymarch, apply fog, alpha blend with the background, return
vec3 renderClouds(vec3 pointStart, vec3 pointEnd, vec3 background, float dist, float random){ | 1 | 1 |
clKfWm | afl_ext | 2023-12-09T21:45:07 | // afl_ext 2017-2023
// MIT License
// Use your mouse to move the camera around! Press the Left Mouse Button on the image to look around!
#define NormalizedMouse (iMouse.xy / iResolution.xy) // normalize mouse coords
// settings for the shader
#define STEP_SIZE_SCALE 500.0 // lower means more steps
#define CloudsFl... | mit | [
9097,
9187,
9218,
9218,
9649
] | [
[
993,
1070,
1130,
1130,
1523
],
[
1525,
1592,
1621,
1621,
2317
],
[
2319,
2340,
2366,
2366,
2454
],
[
2456,
2479,
2500,
2500,
2569
],
[
2571,
2589,
2611,
2611,
3773
],
[
3775,
3807,
3... | // Great tonemapping function from my other shader: https://www.shadertoy.com/view/XsGfWV
| vec3 aces_tonemap(vec3 color) { |
mat3 m1 = mat3(
0.59719, 0.07600, 0.02840,
0.35458, 0.90834, 0.13383,
0.04823, 0.01566, 0.83777
);
mat3 m2 = mat3(
1.60475, -0.10208, -0.00327,
-0.53108, 1.10813, -0.07276,
-0.07367, -0.00605, 1.07602
);
vec3 v = m1 * color;
vec3 a = v * (v + 0.0245786) - 0.000090537;
vec3 b... | // Great tonemapping function from my other shader: https://www.shadertoy.com/view/XsGfWV
vec3 aces_tonemap(vec3 color) { | 1 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.