mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-21 23:31:30 +11:00
Add new shaders
This commit is contained in:
parent
c6ba89cd0d
commit
085760643b
274
procedural/iq-image-audrey-hepburn.slang
Normal file
274
procedural/iq-image-audrey-hepburn.slang
Normal file
|
@ -0,0 +1,274 @@
|
|||
#version 450
|
||||
|
||||
layout(std140, set = 0, binding = 0) uniform UBO
|
||||
{
|
||||
mat4 MVP;
|
||||
vec4 OutputSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 SourceSize;
|
||||
uint FrameCount;
|
||||
} global;
|
||||
|
||||
#pragma stage vertex
|
||||
layout(location = 0) in vec4 Position;
|
||||
layout(location = 1) in vec2 TexCoord;
|
||||
layout(location = 0) out vec2 vTexCoord;
|
||||
const vec2 madd = vec2(0.5, 0.5);
|
||||
void main()
|
||||
{
|
||||
gl_Position = global.MVP * Position;
|
||||
vTexCoord = gl_Position.xy;
|
||||
}
|
||||
|
||||
#pragma stage fragment
|
||||
layout(location = 0) in vec2 vTexCoord;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
float iGlobalTime = float(global.FrameCount)*0.025;
|
||||
vec2 iResolution = global.OutputSize.xy;
|
||||
|
||||
// Created by inigo quilez - iq/2013
|
||||
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
|
||||
|
||||
// These are 316 gaussian points (201 brushes by using local symmetry) forming the picture
|
||||
// of Audrey Hepburn. They pack down to 800 bytes (34 bits per point) before huffman/arithmetic
|
||||
// compression.
|
||||
//
|
||||
// The points were chosen by (very quickly) runing this
|
||||
//
|
||||
// http://www.iquilezles.org/www/articles/genetic/genetic.htm
|
||||
//
|
||||
// with some importance sampling for the eyes, nouse and mouth.
|
||||
|
||||
float brush( float col, vec2 p, in vec4 b, float an )
|
||||
{
|
||||
p += an*cos( iGlobalTime + 100.0*b.yz );
|
||||
|
||||
vec2 dd = p - b.yz;
|
||||
col = mix( col, b.x, exp( -b.w*b.w*dot(dd,dd) ) );
|
||||
if( abs(b.z-0.5)<0.251 )
|
||||
{
|
||||
dd.x = p.x - 1.0 + b.y;
|
||||
col = mix( col, b.x, exp( -b.w*b.w*dot(dd,dd) ) );
|
||||
}
|
||||
return col;
|
||||
}
|
||||
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
{
|
||||
vec2 uv = fragCoord.xy / iResolution.y;
|
||||
uv.x -= 0.5*(iResolution.x / iResolution.y - 1.0);
|
||||
|
||||
float an = smoothstep( 0.0, 1.0, cos(iGlobalTime) );
|
||||
|
||||
float col = 0.0;
|
||||
|
||||
col = brush( col, uv, vec4(1.000,0.371,0.379,11.770), an );
|
||||
col = brush( col, uv, vec4(0.992,0.545,0.551,8.359), an );
|
||||
col = brush( col, uv, vec4(0.749,0.623,0.990,36.571), an );
|
||||
col = brush( col, uv, vec4(1.000,0.510,0.395,11.315), an );
|
||||
col = brush( col, uv, vec4(1.000,0.723,0.564,15.170), an );
|
||||
col = brush( col, uv, vec4(0.953,0.729,0.750,14.629), an );
|
||||
col = brush( col, uv, vec4(0.706,0.982,0.033,16.254), an );
|
||||
col = brush( col, uv, vec4(1.000,0.855,0.652,26.256), an );
|
||||
col = brush( col, uv, vec4(1.000,0.664,0.623,81.920), an );
|
||||
col = brush( col, uv, vec4(0.000,0.881,0.750,8.031), an );
|
||||
col = brush( col, uv, vec4(0.686,0.682,0.900,27.676), an );
|
||||
col = brush( col, uv, vec4(1.000,0.189,0.684,18.618), an );
|
||||
col = brush( col, uv, vec4(0.000,0.904,0.750,8.031), an );
|
||||
col = brush( col, uv, vec4(1.000,0.422,0.195,44.522), an );
|
||||
col = brush( col, uv, vec4(1.000,0.779,0.750,16.787), an );
|
||||
col = brush( col, uv, vec4(1.000,0.645,0.330,14.222), an );
|
||||
col = brush( col, uv, vec4(1.000,0.197,0.648,22.505), an );
|
||||
col = brush( col, uv, vec4(0.702,0.512,0.393,35.310), an );
|
||||
col = brush( col, uv, vec4(1.000,0.744,0.621,14.949), an );
|
||||
col = brush( col, uv, vec4(0.671,0.885,0.092,24.675), an );
|
||||
col = brush( col, uv, vec4(0.000,0.344,0.750,8.031), an );
|
||||
col = brush( col, uv, vec4(1.000,0.760,0.465,40.960), an );
|
||||
col = brush( col, uv, vec4(0.008,0.908,0.311,8.031), an );
|
||||
col = brush( col, uv, vec4(0.016,0.959,0.750,10.039), an );
|
||||
col = brush( col, uv, vec4(0.004,0.930,0.750,12.800), an );
|
||||
col = brush( col, uv, vec4(1.000,0.555,0.250,19.883), an );
|
||||
col = brush( col, uv, vec4(1.000,0.770,1.018,15.876), an );
|
||||
col = brush( col, uv, vec4(0.000,0.828,0.756,36.571), an );
|
||||
col = brush( col, uv, vec4(0.580,0.566,0.424,89.043), an );
|
||||
col = brush( col, uv, vec4(0.988,0.162,0.691,40.157), an );
|
||||
col = brush( col, uv, vec4(0.000,0.314,0.750,8.031), an );
|
||||
col = brush( col, uv, vec4(0.000,0.947,0.125,32.000), an );
|
||||
col = brush( col, uv, vec4(0.914,0.844,0.725,52.513), an );
|
||||
col = brush( col, uv, vec4(1.000,0.313,0.762,42.667), an );
|
||||
col = brush( col, uv, vec4(0.996,0.676,0.689,85.333), an );
|
||||
col = brush( col, uv, vec4(0.980,0.346,0.559,24.675), an );
|
||||
col = brush( col, uv, vec4(1.000,0.553,0.250,18.789), an );
|
||||
col = brush( col, uv, vec4(0.004,0.258,0.248,8.031), an );
|
||||
col = brush( col, uv, vec4(1.000,0.420,0.742,30.567), an );
|
||||
col = brush( col, uv, vec4(0.906,0.543,0.250,22.756), an );
|
||||
col = brush( col, uv, vec4(0.863,0.674,0.322,20.078), an );
|
||||
col = brush( col, uv, vec4(0.753,0.357,0.686,78.769), an );
|
||||
col = brush( col, uv, vec4(0.906,0.795,0.705,37.236), an );
|
||||
col = brush( col, uv, vec4(0.933,0.520,0.365,38.642), an );
|
||||
col = brush( col, uv, vec4(0.996,0.318,0.488,14.734), an );
|
||||
col = brush( col, uv, vec4(0.337,0.486,0.281,81.920), an );
|
||||
col = brush( col, uv, vec4(0.965,0.691,0.516,16.650), an );
|
||||
col = brush( col, uv, vec4(0.808,0.582,0.973,52.513), an );
|
||||
col = brush( col, uv, vec4(0.012,0.240,0.928,8.063), an );
|
||||
col = brush( col, uv, vec4(1.000,0.496,0.217,31.508), an );
|
||||
col = brush( col, uv, vec4(0.000,0.658,0.953,34.133), an );
|
||||
col = brush( col, uv, vec4(0.871,0.582,0.172,62.061), an );
|
||||
col = brush( col, uv, vec4(0.855,0.346,0.342,17.504), an );
|
||||
col = brush( col, uv, vec4(0.878,0.787,0.648,28.845), an );
|
||||
col = brush( col, uv, vec4(0.000,0.984,0.111,35.310), an );
|
||||
col = brush( col, uv, vec4(0.855,0.514,0.965,66.065), an );
|
||||
col = brush( col, uv, vec4(0.561,0.613,0.350,81.920), an );
|
||||
col = brush( col, uv, vec4(0.992,0.818,0.902,21.558), an );
|
||||
col = brush( col, uv, vec4(0.914,0.746,0.615,40.157), an );
|
||||
col = brush( col, uv, vec4(0.557,0.580,0.125,60.235), an );
|
||||
col = brush( col, uv, vec4(0.475,0.547,0.414,70.621), an );
|
||||
col = brush( col, uv, vec4(0.843,0.680,0.793,20.277), an );
|
||||
col = brush( col, uv, vec4(1.000,0.230,0.758,56.889), an );
|
||||
col = brush( col, uv, vec4(1.000,0.299,0.691,68.267), an );
|
||||
col = brush( col, uv, vec4(0.737,0.518,0.100,68.267), an );
|
||||
col = brush( col, uv, vec4(0.996,0.227,0.514,41.796), an );
|
||||
col = brush( col, uv, vec4(0.929,0.850,0.770,62.061), an );
|
||||
col = brush( col, uv, vec4(0.682,0.834,0.111,30.118), an );
|
||||
col = brush( col, uv, vec4(0.996,0.854,0.793,58.514), an );
|
||||
col = brush( col, uv, vec4(0.490,0.736,0.889,19.321), an );
|
||||
col = brush( col, uv, vec4(0.980,0.465,0.725,16.126), an );
|
||||
col = brush( col, uv, vec4(0.992,0.484,1.010,23.273), an );
|
||||
col = brush( col, uv, vec4(0.008,0.949,0.727,23.540), an );
|
||||
col = brush( col, uv, vec4(0.012,0.086,0.086,8.031), an );
|
||||
col = brush( col, uv, vec4(1.000,0.121,0.750,44.522), an );
|
||||
col = brush( col, uv, vec4(0.427,0.617,0.891,27.676), an );
|
||||
col = brush( col, uv, vec4(0.804,0.693,0.633,78.769), an );
|
||||
col = brush( col, uv, vec4(0.012,0.711,0.084,13.745), an );
|
||||
col = brush( col, uv, vec4(0.082,0.584,0.338,107.789), an );
|
||||
col = brush( col, uv, vec4(0.929,0.613,0.268,19.692), an );
|
||||
col = brush( col, uv, vec4(0.200,0.549,0.420,128.000), an );
|
||||
col = brush( col, uv, vec4(1.000,0.402,0.717,26.947), an );
|
||||
col = brush( col, uv, vec4(0.000,0.551,0.168,45.511), an );
|
||||
col = brush( col, uv, vec4(0.992,0.627,0.621,56.889), an );
|
||||
col = brush( col, uv, vec4(0.902,0.361,0.748,40.960), an );
|
||||
col = brush( col, uv, vec4(0.984,0.344,0.754,38.642), an );
|
||||
col = brush( col, uv, vec4(0.902,0.203,0.818,51.200), an );
|
||||
col = brush( col, uv, vec4(1.000,0.230,0.803,52.513), an );
|
||||
col = brush( col, uv, vec4(0.922,0.738,0.691,47.628), an );
|
||||
col = brush( col, uv, vec4(0.000,0.385,0.797,43.574), an );
|
||||
col = brush( col, uv, vec4(0.000,0.725,0.305,62.061), an );
|
||||
col = brush( col, uv, vec4(0.000,0.150,0.750,45.511), an );
|
||||
col = brush( col, uv, vec4(1.000,0.742,0.408,47.628), an );
|
||||
col = brush( col, uv, vec4(0.000,0.645,0.643,60.235), an );
|
||||
col = brush( col, uv, vec4(1.000,0.645,0.438,35.310), an );
|
||||
col = brush( col, uv, vec4(0.510,0.564,0.789,18.450), an );
|
||||
col = brush( col, uv, vec4(0.863,0.211,0.781,30.567), an );
|
||||
col = brush( col, uv, vec4(0.106,0.508,0.328,89.043), an );
|
||||
col = brush( col, uv, vec4(0.012,0.410,0.875,14.629), an );
|
||||
col = brush( col, uv, vec4(1.000,0.871,0.877,48.762), an );
|
||||
col = brush( col, uv, vec4(1.000,0.258,0.779,37.926), an );
|
||||
col = brush( col, uv, vec4(0.000,0.436,0.807,28.845), an );
|
||||
col = brush( col, uv, vec4(0.918,0.861,0.836,49.951), an );
|
||||
col = brush( col, uv, vec4(1.000,0.291,0.770,40.960), an );
|
||||
col = brush( col, uv, vec4(0.000,0.750,0.283,27.676), an );
|
||||
col = brush( col, uv, vec4(0.965,0.596,0.572,28.055), an );
|
||||
col = brush( col, uv, vec4(0.902,0.803,0.953,24.976), an );
|
||||
col = brush( col, uv, vec4(0.957,0.498,0.600,16.126), an );
|
||||
col = brush( col, uv, vec4(0.914,0.322,0.432,15.634), an );
|
||||
col = brush( col, uv, vec4(0.008,0.025,0.621,17.809), an );
|
||||
col = brush( col, uv, vec4(0.000,0.916,0.713,56.889), an );
|
||||
col = brush( col, uv, vec4(0.914,0.547,0.971,47.628), an );
|
||||
col = brush( col, uv, vec4(0.000,0.207,0.432,37.926), an );
|
||||
col = brush( col, uv, vec4(0.875,0.176,0.793,46.545), an );
|
||||
col = brush( col, uv, vec4(0.000,0.646,0.668,41.796), an );
|
||||
col = brush( col, uv, vec4(1.000,0.721,0.691,51.200), an );
|
||||
col = brush( col, uv, vec4(0.451,0.559,0.754,49.951), an );
|
||||
col = brush( col, uv, vec4(0.969,0.846,0.750,58.514), an );
|
||||
col = brush( col, uv, vec4(0.000,0.900,0.146,36.571), an );
|
||||
col = brush( col, uv, vec4(1.000,0.613,0.635,85.333), an );
|
||||
col = brush( col, uv, vec4(0.596,0.807,0.150,58.514), an );
|
||||
col = brush( col, uv, vec4(0.898,0.330,0.760,40.157), an );
|
||||
col = brush( col, uv, vec4(0.694,0.594,0.012,51.200), an );
|
||||
col = brush( col, uv, vec4(0.698,0.592,0.055,53.895), an );
|
||||
col = brush( col, uv, vec4(0.902,0.268,0.773,39.385), an );
|
||||
col = brush( col, uv, vec4(0.925,0.838,0.660,58.514), an );
|
||||
col = brush( col, uv, vec4(0.843,0.670,0.242,28.444), an );
|
||||
col = brush( col, uv, vec4(0.243,0.465,0.285,85.333), an );
|
||||
col = brush( col, uv, vec4(0.816,0.588,0.674,44.522), an );
|
||||
col = brush( col, uv, vec4(0.008,0.283,0.115,8.031), an );
|
||||
col = brush( col, uv, vec4(0.247,0.414,0.691,60.235), an );
|
||||
col = brush( col, uv, vec4(1.000,0.104,0.781,60.235), an );
|
||||
col = brush( col, uv, vec4(0.000,0.619,0.660,60.235), an );
|
||||
col = brush( col, uv, vec4(0.584,0.650,0.994,46.545), an );
|
||||
col = brush( col, uv, vec4(0.000,0.219,0.393,36.571), an );
|
||||
col = brush( col, uv, vec4(1.000,0.307,0.645,97.524), an );
|
||||
col = brush( col, uv, vec4(0.953,0.639,0.771,38.642), an );
|
||||
col = brush( col, uv, vec4(0.000,0.238,0.357,34.712), an );
|
||||
col = brush( col, uv, vec4(0.922,0.713,0.352,53.895), an );
|
||||
col = brush( col, uv, vec4(0.965,0.387,0.748,43.574), an );
|
||||
col = brush( col, uv, vec4(0.000,0.898,0.633,41.796), an );
|
||||
col = brush( col, uv, vec4(0.941,0.352,0.488,14.734), an );
|
||||
col = brush( col, uv, vec4(0.933,0.439,0.725,30.567), an );
|
||||
col = brush( col, uv, vec4(0.310,0.541,0.906,47.628), an );
|
||||
col = brush( col, uv, vec4(0.941,0.502,0.689,24.094), an );
|
||||
col = brush( col, uv, vec4(0.094,0.527,0.330,85.333), an );
|
||||
col = brush( col, uv, vec4(0.000,0.090,0.688,55.351), an );
|
||||
col = brush( col, uv, vec4(0.000,0.652,0.713,75.852), an );
|
||||
col = brush( col, uv, vec4(0.949,0.320,0.623,107.789), an );
|
||||
col = brush( col, uv, vec4(0.890,0.775,0.750,22.505), an );
|
||||
col = brush( col, uv, vec4(0.012,0.918,0.490,14.322), an );
|
||||
col = brush( col, uv, vec4(1.000,0.871,0.967,58.514), an );
|
||||
col = brush( col, uv, vec4(0.000,0.324,0.676,64.000), an );
|
||||
col = brush( col, uv, vec4(0.008,0.141,0.248,8.031), an );
|
||||
col = brush( col, uv, vec4(0.000,0.633,0.707,75.852), an );
|
||||
col = brush( col, uv, vec4(0.910,0.385,0.207,44.522), an );
|
||||
col = brush( col, uv, vec4(0.012,0.703,0.182,31.508), an );
|
||||
col = brush( col, uv, vec4(0.000,0.617,0.703,73.143), an );
|
||||
col = brush( col, uv, vec4(0.890,0.352,0.225,45.511), an );
|
||||
col = brush( col, uv, vec4(0.933,0.826,0.604,44.522), an );
|
||||
col = brush( col, uv, vec4(0.914,0.777,0.574,25.924), an );
|
||||
col = brush( col, uv, vec4(0.631,0.781,0.182,68.267), an );
|
||||
col = brush( col, uv, vec4(1.000,0.873,0.916,48.762), an );
|
||||
col = brush( col, uv, vec4(0.694,0.520,0.113,81.920), an );
|
||||
col = brush( col, uv, vec4(0.000,0.900,0.926,58.514), an );
|
||||
col = brush( col, uv, vec4(0.184,0.598,0.344,146.286), an );
|
||||
col = brush( col, uv, vec4(0.863,0.678,0.250,35.310), an );
|
||||
col = brush( col, uv, vec4(0.090,0.566,0.332,78.769), an );
|
||||
col = brush( col, uv, vec4(0.420,0.445,0.301,56.889), an );
|
||||
col = brush( col, uv, vec4(0.973,0.617,0.516,18.124), an );
|
||||
col = brush( col, uv, vec4(0.000,0.191,0.500,39.385), an );
|
||||
col = brush( col, uv, vec4(0.000,0.240,0.326,31.508), an );
|
||||
col = brush( col, uv, vec4(0.000,0.264,0.322,55.351), an );
|
||||
col = brush( col, uv, vec4(0.000,0.604,0.699,70.621), an );
|
||||
col = brush( col, uv, vec4(0.000,0.113,0.604,43.574), an );
|
||||
col = brush( col, uv, vec4(0.894,0.760,0.697,49.951), an );
|
||||
col = brush( col, uv, vec4(0.914,0.725,0.383,55.351), an );
|
||||
col = brush( col, uv, vec4(0.000,0.199,0.467,48.762), an );
|
||||
col = brush( col, uv, vec4(0.000,0.904,0.660,52.513), an );
|
||||
col = brush( col, uv, vec4(0.922,0.611,0.191,45.511), an );
|
||||
col = brush( col, uv, vec4(0.059,0.789,0.869,30.118), an );
|
||||
col = brush( col, uv, vec4(0.976,0.641,0.213,40.960), an );
|
||||
col = brush( col, uv, vec4(0.918,0.402,0.742,47.628), an );
|
||||
col = brush( col, uv, vec4(0.945,0.717,0.582,40.157), an );
|
||||
col = brush( col, uv, vec4(0.000,0.299,0.672,58.514), an );
|
||||
col = brush( col, uv, vec4(0.000,0.719,0.666,48.762), an );
|
||||
col = brush( col, uv, vec4(0.882,0.697,0.271,58.514), an );
|
||||
col = brush( col, uv, vec4(0.929,0.752,0.436,64.000), an );
|
||||
col = brush( col, uv, vec4(1.000,0.867,0.813,56.889), an );
|
||||
col = brush( col, uv, vec4(0.643,0.588,0.090,64.000), an );
|
||||
col = brush( col, uv, vec4(0.012,0.063,0.922,10.952), an );
|
||||
col = brush( col, uv, vec4(0.878,0.186,0.750,31.508), an );
|
||||
col = brush( col, uv, vec4(0.953,0.648,0.613,120.471), an );
|
||||
col = brush( col, uv, vec4(0.973,0.180,0.576,45.511), an );
|
||||
col = brush( col, uv, vec4(0.741,0.943,0.076,52.513), an );
|
||||
col = brush( col, uv, vec4(0.059,0.545,0.332,89.043), an );
|
||||
col = brush( col, uv, vec4(0.094,0.295,0.734,85.333), an );
|
||||
col = brush( col, uv, vec4(0.008,0.676,0.721,85.333), an );
|
||||
col = brush( col, uv, vec4(0.550,0.350,0.650,85.000), an );
|
||||
|
||||
fragColor = vec4(col,col,col,1.0);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
//just some shit to wrap shadertoy's stuff
|
||||
vec2 FragmentCoord = vTexCoord.xy*global.OutputSize.xy;
|
||||
FragmentCoord.y = -FragmentCoord.y;
|
||||
mainImage(FragColor,FragmentCoord);
|
||||
}
|
243
procedural/mattz-gabor-to-the-power-of-2.slang
Normal file
243
procedural/mattz-gabor-to-the-power-of-2.slang
Normal file
|
@ -0,0 +1,243 @@
|
|||
#version 450
|
||||
|
||||
layout(std140, set = 0, binding = 0) uniform UBO
|
||||
{
|
||||
mat4 MVP;
|
||||
vec4 OutputSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 SourceSize;
|
||||
uint FrameCount;
|
||||
} global;
|
||||
|
||||
#pragma stage vertex
|
||||
layout(location = 0) in vec4 Position;
|
||||
layout(location = 1) in vec2 TexCoord;
|
||||
layout(location = 0) out vec2 vTexCoord;
|
||||
const vec2 madd = vec2(0.5, 0.5);
|
||||
void main()
|
||||
{
|
||||
gl_Position = global.MVP * Position;
|
||||
vTexCoord = gl_Position.xy;
|
||||
}
|
||||
|
||||
#pragma stage fragment
|
||||
layout(location = 0) in vec2 vTexCoord;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
float iGlobalTime = float(global.FrameCount)*0.025;
|
||||
vec2 iResolution = global.OutputSize.xy;
|
||||
|
||||
/* Gabor^2, by mattz.
|
||||
License: Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
|
||||
|
||||
Goal: render the face of Zsa Zsa Gabor using the basis function proposed by Dennis Gabor.
|
||||
|
||||
Original image: http://www.instyle.com/celebrity/gallery-vintage-photos-zsa-zsa-gabor
|
||||
Gabor filter: https://en.wikipedia.org/wiki/Gabor_filter
|
||||
More about Dennis: https://en.wikipedia.org/wiki/Dennis_Gabor
|
||||
More about Zsa Zsa: https://en.wikipedia.org/wiki/Zsa_Zsa_Gabor
|
||||
|
||||
Fitting these 128 basis functions took several days (!) on my Macbook Pro (CPU only, no GPU).
|
||||
|
||||
See https://mzucker.github.io/2016/08/01/gabor-2.html for more details.
|
||||
|
||||
There was probably a faster way of doing it.
|
||||
|
||||
*/
|
||||
|
||||
const vec4 scl = vec4(0.00391389432485, 0.0122958616579, 0.00782778864971, 0.00391389432485);
|
||||
|
||||
float cnt = 0.0;
|
||||
|
||||
float gabor(vec2 p, vec4 q) {
|
||||
|
||||
// Here we decode the vec4 q into 8 individual parameters:
|
||||
//
|
||||
// q0 = (x, a, l, s)
|
||||
// q1 = (y, p, t, h)
|
||||
//
|
||||
// with parameters given by
|
||||
//
|
||||
// x: function center x coordinate
|
||||
// y: function center y coordinate
|
||||
// a: Gabor function spatial angle/orientation
|
||||
// p: Gabor function phase offset
|
||||
// l: Spatial wavelength
|
||||
// s: Filter width perpendicular to sinusoidal component
|
||||
// t: Filter width parallel to sinusoidal component
|
||||
// h: Amplitude
|
||||
//
|
||||
vec4 q0 = floor(q*0.001953125)*scl;
|
||||
vec4 q1 = mod(q, 512.0)*scl;
|
||||
|
||||
float cr = cos(q0.y);
|
||||
float sr = sin(q0.y);
|
||||
|
||||
vec2 st = vec2(q0.w, q1.z);
|
||||
|
||||
// Rotate and translate point
|
||||
p = mat2(cr, -sr, sr, cr) * (p - vec2(q0.x, q1.x));
|
||||
|
||||
// Handle appearing at the start of filter
|
||||
q1.w *= smoothstep(cnt, cnt+0.5, iGlobalTime*32.0);
|
||||
++cnt;
|
||||
|
||||
// amplitude * gaussian * sinusoid
|
||||
return q1.w * exp(dot(vec2(-0.5), p*p/(st*st))) * cos(p.x*6.2831853/q0.z+q1.y);
|
||||
|
||||
}
|
||||
|
||||
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
|
||||
|
||||
vec2 p = (fragCoord.xy - 0.5*iResolution.xy) * 1.2 / iResolution.y;
|
||||
p.y = -p.y;
|
||||
p += 1.0;
|
||||
|
||||
float k = 0.0;
|
||||
|
||||
k += gabor(p, vec4(138752.,150667.,261821.,93447.));
|
||||
k += gabor(p, vec4(226145.,131739.,77399.,33587.));
|
||||
k += gabor(p, vec4(63748.,240999.,76311.,23447.));
|
||||
k += gabor(p, vec4(150173.,43128.,50197.,22225.));
|
||||
k += gabor(p, vec4(116939.,73605.,57898.,7679.));
|
||||
k += gabor(p, vec4(51.,227699.,261732.,68280.));
|
||||
k += gabor(p, vec4(50687.,129029.,38508.,17512.));
|
||||
k += gabor(p, vec4(117913.,117281.,32319.,32324.));
|
||||
k += gabor(p, vec4(96910.,174542.,26669.,26719.));
|
||||
k += gabor(p, vec4(117600.,70656.,17940.,16010.));
|
||||
k += gabor(p, vec4(108871.,58049.,51302.,47654.));
|
||||
k += gabor(p, vec4(167609.,91829.,28204.,28213.));
|
||||
k += gabor(p, vec4(90467.,245116.,36375.,7167.));
|
||||
k += gabor(p, vec4(82369.,164365.,30329.,30267.));
|
||||
k += gabor(p, vec4(225089.,129997.,6684.,4095.));
|
||||
k += gabor(p, vec4(205005.,127709.,12815.,12982.));
|
||||
k += gabor(p, vec4(175993.,130600.,23563.,11978.));
|
||||
k += gabor(p, vec4(30069.,10115.,23055.,2559.));
|
||||
k += gabor(p, vec4(137435.,215947.,14350.,14446.));
|
||||
k += gabor(p, vec4(226165.,115949.,47659.,18501.));
|
||||
k += gabor(p, vec4(71368.,123529.,23052.,12515.));
|
||||
k += gabor(p, vec4(102042.,215281.,7176.,2857.));
|
||||
k += gabor(p, vec4(68218.,214988.,25632.,25694.));
|
||||
k += gabor(p, vec4(115954.,5782.,40979.,2930.));
|
||||
k += gabor(p, vec4(123338.,133796.,77334.,23039.));
|
||||
k += gabor(p, vec4(203913.,117.,38944.,33329.));
|
||||
k += gabor(p, vec4(227964.,132231.,189988.,12174.));
|
||||
k += gabor(p, vec4(63649.,26205.,10763.,10940.));
|
||||
k += gabor(p, vec4(97912.,45398.,12810.,1739.));
|
||||
k += gabor(p, vec4(106690.,166508.,16387.,2559.));
|
||||
k += gabor(p, vec4(54873.,146884.,58426.,58402.));
|
||||
k += gabor(p, vec4(178346.,81559.,14341.,2559.));
|
||||
k += gabor(p, vec4(185649.,144747.,16391.,1535.));
|
||||
k += gabor(p, vec4(120084.,199932.,10249.,4361.));
|
||||
k += gabor(p, vec4(100115.,63452.,18981.,18968.));
|
||||
k += gabor(p, vec4(180941.,96255.,18962.,18500.));
|
||||
k += gabor(p, vec4(63718.,126911.,34827.,11485.));
|
||||
k += gabor(p, vec4(61203.,92616.,23582.,18498.));
|
||||
k += gabor(p, vec4(172754.,196259.,16390.,6559.));
|
||||
k += gabor(p, vec4(177015.,230484.,25173.,24616.));
|
||||
k += gabor(p, vec4(157875.,57828.,4618.,4837.));
|
||||
k += gabor(p, vec4(105263.,51711.,17997.,17939.));
|
||||
k += gabor(p, vec4(167049.,203925.,24612.,15906.));
|
||||
k += gabor(p, vec4(144087.,67302.,14874.,14931.));
|
||||
k += gabor(p, vec4(150391.,43665.,53778.,4032.));
|
||||
k += gabor(p, vec4(207569.,22528.,15906.,8795.));
|
||||
k += gabor(p, vec4(137039.,173193.,27653.,2559.));
|
||||
k += gabor(p, vec4(206047.,207878.,18958.,7797.));
|
||||
k += gabor(p, vec4(228200.,131090.,5678.,5799.));
|
||||
k += gabor(p, vec4(113976.,64789.,7689.,6396.));
|
||||
k += gabor(p, vec4(83114.,62975.,15903.,13894.));
|
||||
k += gabor(p, vec4(117517.,132261.,12814.,11335.));
|
||||
k += gabor(p, vec4(149162.,180114.,75786.,4971.));
|
||||
k += gabor(p, vec4(219290.,259568.,7701.,3469.));
|
||||
k += gabor(p, vec4(9233.,249362.,21102.,14898.));
|
||||
k += gabor(p, vec4(12348.,105446.,15436.,10340.));
|
||||
k += gabor(p, vec4(147344.,213862.,14917.,14877.));
|
||||
k += gabor(p, vec4(205125.,182142.,82962.,5368.));
|
||||
k += gabor(p, vec4(161978.,187391.,5644.,5760.));
|
||||
k += gabor(p, vec4(88210.,61601.,16388.,2047.));
|
||||
k += gabor(p, vec4(78650.,114304.,15885.,2047.));
|
||||
k += gabor(p, vec4(115065.,71687.,15886.,7819.));
|
||||
k += gabor(p, vec4(93059.,235007.,12814.,10350.));
|
||||
k += gabor(p, vec4(196884.,27136.,12303.,5338.));
|
||||
k += gabor(p, vec4(171860.,258580.,24079.,15418.));
|
||||
k += gabor(p, vec4(183655.,243097.,21510.,2559.));
|
||||
k += gabor(p, vec4(191277.,128656.,12293.,3583.));
|
||||
k += gabor(p, vec4(157553.,43644.,22026.,2014.));
|
||||
k += gabor(p, vec4(76369.,27135.,14370.,10903.));
|
||||
k += gabor(p, vec4(194876.,76800.,7683.,3357.));
|
||||
k += gabor(p, vec4(150218.,45734.,3076.,2201.));
|
||||
k += gabor(p, vec4(230711.,259797.,3613.,3813.));
|
||||
k += gabor(p, vec4(143536.,47519.,32771.,2435.));
|
||||
k += gabor(p, vec4(73356.,64451.,16409.,6741.));
|
||||
k += gabor(p, vec4(228480.,129023.,2581.,2683.));
|
||||
k += gabor(p, vec4(193434.,117680.,17930.,4095.));
|
||||
k += gabor(p, vec4(71419.,126168.,4112.,2190.));
|
||||
k += gabor(p, vec4(94887.,188293.,41993.,4095.));
|
||||
k += gabor(p, vec4(221843.,258986.,4634.,4788.));
|
||||
k += gabor(p, vec4(254463.,215580.,25241.,24612.));
|
||||
k += gabor(p, vec4(36217.,144383.,23056.,9348.));
|
||||
k += gabor(p, vec4(110799.,84416.,10835.,10767.));
|
||||
k += gabor(p, vec4(92864.,216574.,22019.,2047.));
|
||||
k += gabor(p, vec4(21781.,110203.,209421.,13785.));
|
||||
k += gabor(p, vec4(42162.,246368.,12299.,11902.));
|
||||
k += gabor(p, vec4(178010.,28532.,27661.,2559.));
|
||||
k += gabor(p, vec4(75445.,144528.,29199.,3583.));
|
||||
k += gabor(p, vec4(66694.,194418.,24581.,5119.));
|
||||
k += gabor(p, vec4(230325.,1590.,13360.,7865.));
|
||||
k += gabor(p, vec4(92351.,97505.,5635.,2956.));
|
||||
k += gabor(p, vec4(75010.,124415.,12335.,7234.));
|
||||
k += gabor(p, vec4(97906.,169101.,54817.,5119.));
|
||||
k += gabor(p, vec4(106161.,83324.,3589.,2713.));
|
||||
k += gabor(p, vec4(113835.,235844.,9225.,3708.));
|
||||
k += gabor(p, vec4(208627.,241050.,10768.,10482.));
|
||||
k += gabor(p, vec4(168661.,177062.,8706.,2559.));
|
||||
k += gabor(p, vec4(181467.,127455.,17938.,7786.));
|
||||
k += gabor(p, vec4(197869.,146292.,28173.,2559.));
|
||||
k += gabor(p, vec4(117558.,187903.,9736.,3285.));
|
||||
k += gabor(p, vec4(222982.,25466.,20483.,3071.));
|
||||
k += gabor(p, vec4(235759.,128791.,8256.,8275.));
|
||||
k += gabor(p, vec4(29057.,162597.,13888.,8215.));
|
||||
k += gabor(p, vec4(190357.,256223.,13345.,4260.));
|
||||
k += gabor(p, vec4(119069.,231138.,8715.,6737.));
|
||||
k += gabor(p, vec4(170876.,121183.,16906.,10329.));
|
||||
k += gabor(p, vec4(154320.,242687.,6147.,3239.));
|
||||
k += gabor(p, vec4(115981.,136703.,12808.,6807.));
|
||||
k += gabor(p, vec4(120081.,193574.,9734.,2257.));
|
||||
k += gabor(p, vec4(134533.,188242.,26635.,1665.));
|
||||
k += gabor(p, vec4(138043.,77525.,7686.,2271.));
|
||||
k += gabor(p, vec4(130835.,198313.,5122.,1988.));
|
||||
k += gabor(p, vec4(102193.,56831.,6148.,1687.));
|
||||
k += gabor(p, vec4(111902.,152880.,20531.,7206.));
|
||||
k += gabor(p, vec4(174288.,78489.,3075.,3151.));
|
||||
k += gabor(p, vec4(96671.,127941.,6669.,4272.));
|
||||
k += gabor(p, vec4(210122.,17650.,13840.,13455.));
|
||||
k += gabor(p, vec4(203063.,194037.,33825.,33307.));
|
||||
k += gabor(p, vec4(149725.,95402.,11796.,11817.));
|
||||
k += gabor(p, vec4(66297.,11373.,17922.,2559.));
|
||||
k += gabor(p, vec4(179440.,110836.,5633.,1319.));
|
||||
k += gabor(p, vec4(43681.,262028.,25090.,3071.));
|
||||
k += gabor(p, vec4(101192.,233983.,8200.,8304.));
|
||||
k += gabor(p, vec4(202536.,155036.,12293.,2559.));
|
||||
k += gabor(p, vec4(197017.,107008.,8719.,2338.));
|
||||
k += gabor(p, vec4(163006.,200413.,3076.,2203.));
|
||||
k += gabor(p, vec4(122700.,196047.,6149.,5280.));
|
||||
k += gabor(p, vec4(138048.,193231.,17925.,1322.));
|
||||
k += gabor(p, vec4(205566.,243712.,10761.,9529.));
|
||||
|
||||
// Don't add speckles in preview!
|
||||
if (iResolution.y >= 200.0) {
|
||||
// borrowed Dave Hoskins' hash from https://www.shadertoy.com/view/4djSRW
|
||||
p = fract(p * vec2(443.8975,397.2973));
|
||||
p += dot(p.xy, p.yx+19.19);
|
||||
k += 0.12 * (fract(p.x * p.y)*2.0 - 1.0);
|
||||
}
|
||||
|
||||
fragColor.xyz = vec3(0.5*k + 0.5);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
//just some shit to wrap shadertoy's stuff
|
||||
vec2 FragmentCoord = vTexCoord.xy*global.OutputSize.xy;
|
||||
FragmentCoord.y = -FragmentCoord.y;
|
||||
mainImage(FragColor,FragmentCoord);
|
||||
}
|
Loading…
Reference in a new issue