This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.iquilezles.org/www/articles/palettes/palettes.htm | |
// As t runs from 0 to 1 (our normalized palette index or domain), | |
//the cosine oscilates c times with a phase of d. | |
//The result is scaled and biased by a and b to meet the desired constrast and brightness. | |
vec3 cosPalette( float t, vec3 a, vec3 b, vec3 c, vec3 d ) | |
{ | |
return a + b*cos( 6.28318*(c*t+d) ); | |
} | |
void main () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// these are color palettes, basically you have a variable in and it changes color smoothly based on that variable | |
// Function from Iñigo Quiles | |
// https://www.shadertoy.com/view/MsS3Wc | |
// NOTE this is already built into the force | |
vec3 hsb2rgb( in vec3 c ){ | |
vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0), | |
6.0)-3.0)-1.0, | |
0.0, | |
1.0 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.iquilezles.org/www/articles/palettes/palettes.htm | |
// to see this function graphed out go to: https://www.desmos.com/calculator/rz7abjujdj | |
vec3 cosPalette( float t , vec3 brightness, vec3 contrast, vec3 osc, vec3 phase) | |
{ | |
return brightness + contrast*cos( 6.28318*(osc*t+phase) ); | |
} | |
void main() { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
vec2 pos = ((gl_FragCoord.xy/resolution) - 0.5)*2.0; // origin is in center | |
// who remembers SOH CAH TOA ? | |
// tan, given an angle will return the ratio | |
// so if we only have the ratio of position | |
// we use atan to get the angle | |
float angle = atan(pos.y,pos.x); | |
float r = sin(angle + time); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float getBPMVis(float bpm){ | |
// this function can be found graphed out here :https://www.desmos.com/calculator/rx86e6ymw7 | |
float bps = 60./bpm; // beats per second | |
float bpmVis = tan((time*PI)/bps); | |
// multiply it by PI so that tan has a regular spike every 1 instead of PI | |
// divide by the beat per second so there are that many spikes per second | |
bpmVis = clamp(bpmVis,0.,10.); | |
// tan goes to infinity so lets clamp it at 10 | |
bpmVis = abs(bpmVis)/20.; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float getBPMVis(float bpm){ | |
// this function can be found graphed out here :https://www.desmos.com/calculator/rx86e6ymw7 | |
float bps = 60./bpm; // beats per second | |
float bpmVis = tan((time*PI)/bps); | |
// multiply it by PI so that tan has a regular spike every 1 instead of PI | |
// divide by the beat per second so there are that many spikes per second | |
bpmVis = clamp(bpmVis,0.,10.); | |
// tan goes to infinity so lets clamp it at 10 | |
bpmVis = abs(bpmVis)/20.; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define some constants | |
const int steps = 128; // This is the maximum amount a ray can march. | |
const float smallNumber = 0.001; | |
const float maxDist = 10.; // This is the maximum distance a ray can travel. | |
float fOpUnionStairs(float a, float b, float r, float n) { | |
float s = r/n; | |
float u = b-r; | |
return min(min(a,b), 0.5 * (u + a + abs ((mod (u - a + s, 2.0 * s)) - s))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int steps = 16; | |
const float smallNumber = 0.001; | |
const float maxDist = 2.; | |
// Repeat in three dimensions | |
vec3 pMod3(inout vec3 p, vec3 size) { | |
vec3 c = floor((p + size*0.5)/size); | |
p = mod(p + size*0.5, size) - size*0.5; | |
return c; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define some constants | |
const int steps = 128; // This is the maximum amount a ray can march. | |
const float smallNumber = 0.0001; | |
const float maxDist = 30.; // This is the maximum distance a ray can travel. | |
float smin( float a, float b, float k ) | |
{ | |
float h = clamp( 0.5+0.5*(b-a)/k, 0.0, 1.0 ); | |
return mix( b, a, h ) - k*h*(1.0-h); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef GL_ES | |
precision highp float; | |
#endif | |
uniform float time; | |
uniform vec2 resolution; | |
uniform vec2 mouse; | |
uniform vec3 spectrum; | |
uniform sampler2D myPic; |