Last active
July 30, 2022 21:21
Revisions
-
CharStiles revised this gist
Jul 30, 2022 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,6 @@ void main() { // angle is going through a cos and so is the length, so we see the // blue channel oscillating in both dimensions the polar coordinates give us // please play around with these numbers to get a better palette vec3 brightness = vec3(0.8); vec3 contrast = vec3(0.2); vec3 osc = vec3(r); -
CharStiles revised this gist
Nov 7, 2021 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -26,11 +26,10 @@ void main() { // the distance (aka length) from the center put in a cos, time moves the // circles in. float b = cos(angle+ cos(length(pos*ringFrequency *3.))); // this combines what we learned in the red and green channels // angle is going through a cos and so is the length, so we see the // blue channel oscillating in both dimensions the polar coordinates give us // please play around with these numbers to get a better palette vec3 brightness = vec3(0.5); vec3 brightness = vec3(0.8); -
CharStiles revised this gist
Nov 7, 2021 . 1 changed file with 7 additions and 8 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -14,9 +14,7 @@ void main() { // 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); // sin returns a number from -1 to 1, and colors are from 0 to 1, so thats @@ -35,11 +33,12 @@ void main() { // here the music effects the place where the phase of the cosine starts // please play around with these numbers to get a better palette vec3 brightness = vec3(0.5); vec3 brightness = vec3(0.8); vec3 contrast = vec3(0.2); vec3 osc = vec3(r); vec3 phase = vec3(g, cos(time/23.), sin(time/31.)); vec3 color = cosPalette(b, brightness, contrast, osc, phase); gl_FragColor = vec4(color,1.); -
CharStiles revised this gist
Jul 17, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ vec3 cosPalette( float t , vec3 brightness, vec3 contrast, vec3 osc, vec3 phase) 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 -
CharStiles revised this gist
Jun 5, 2021 . 1 changed file with 0 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,3 @@ // 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) -
CharStiles renamed this gist
Jun 5, 2021 . 1 changed file with 2 additions and 26 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,27 +11,6 @@ vec3 cosPalette( float t , vec3 brightness, vec3 contrast, vec3 osc, vec3 phase) return brightness + contrast*cos( 6.28318*(osc*t+phase) ); } void main() { vec2 pos = uv(); // origin is in center @@ -49,9 +28,8 @@ void main() { // why you only see red on the screen half the time. the angle goes around // the screen, adding time moves it clockwise float ringFrequency = 5.; // making this number bigger will increase frequency float g = cos(length(pos*ringFrequency) - time); // the distance (aka length) from the center put in a cos, time moves the // circles in. @@ -66,11 +44,9 @@ void main() { // the numbers that divide time are pretty arbitrary, as long as they are not the same and are somewhere between 10-100 id say it gives the desired effect vec3 osc = vec3(r,cos(time/20.),cos(time/31.)); vec3 phase = vec3(b,0.5,0.1); vec3 color = cosPalette(g, brightness, contrast, osc, phase); gl_FragColor = vec4(color,1.); } -
CharStiles revised this gist
Sep 19, 2020 . 1 changed file with 11 additions and 13 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,13 +5,9 @@ //The result is scaled and biased by a and b to meet the desired constrast and brightness. // 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) ); } @@ -59,17 +55,19 @@ void main() { // the distance (aka length) from the center put in a cos, time moves the // circles in. float b = cos(angle+ cos(length(pos*15.)) + bands.y ); // this combines what we learned in the red and green channels // angle is going through a cos and so is the length, so we see the // blue channel oscillating in both dimensions the polar coordinates give us // here the music effects the place where the phase of the cosine starts // please play around with these numbers to get a better palette vec3 brightness = vec3(0.5); vec3 contrast = vec3(0.3,0.13,0.19); // the numbers that divide time are pretty arbitrary, as long as they are not the same and are somewhere between 10-100 id say it gives the desired effect vec3 osc = vec3(r,cos(time/20.),cos(time/31.)); vec3 phase = vec3(b,0.5,0.1); vec3 color = cosPalette(g, brightness, contrast, osc, phase); gl_FragColor = vec4(color,1.); // now play it to a bpm bop like I feel love by Donna Summer -
CharStiles revised this gist
Sep 19, 2020 . 1 changed file with 8 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,8 +5,14 @@ //The result is scaled and biased by a and b to meet the desired constrast and brightness. // 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 ) { // please play around with these numbers to get a better palette vec3 brightness = vec3(0.3); vec3 contrast = vec3(0.5); vec3 osc = vec3(0.5,1.0,0.0); vec3 phase = vec3(0.4,0.9,0.2); return brightness + contrast*cos( 6.28318*(osc*t+phase) ); } float getBPMVis(float bpm){ -
CharStiles revised this gist
Sep 19, 2020 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,10 @@ // i copied and pasted these functions from the sticker sheet // 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. // 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 a, vec3 b, vec3 c, vec3 d){ return a+ b * cos(t * b + c); } -
CharStiles revised this gist
Sep 19, 2020 . 1 changed file with 4 additions and 21 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,25 +1,8 @@ // i copied and pasted these functions from the sticker sheet vec3 cosPalette(float t, vec3 a, vec3 b, vec3 c, vec3 d){ return a+ b * cos(t * b + c); } float getBPMVis(float bpm){ @@ -71,7 +54,7 @@ void main() { // blue channel oscillating in both dimensions the polar coordinates give us // here the music effects the place where the phase of the cosine starts vec3 color = 1.-cosPalette(r*b*g); // i thought it looked too light so i inverted the colors by adding 1- at the // beginning. Ill be honest this combo was randomly decided. -
CharStiles created this gist
Jul 5, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,84 @@ // i copied and pasted these functions from the sticker sheet // to read more about turbo: https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html // in short, its good for colorblindness, getting more deatil (based on human perception), high contrast // but still smooth interpretation of the in-value vec3 turboPalette(float x){ // t can be any floating point number that changes, like time or pos.x; float m = 1.0; // it repeats every 1 unit, because thats the turbo function's range float t = m - abs(mod(x*20. , (2.*m)) - m); // this line turns an increasing value into a triangle wave, linear interpolation of length 1 up // linear interpolation of length 1 down. like this: /\/\/\/\/\/\/\/\/\/\/\/\/\/ // you use const whenever the varible is just using plain old data that wont change // its more efficient const vec3 c0 = vec3(0.1140890109226559, 0.06288340699912215, 0.2248337216805064); const vec3 c1 = vec3(6.716419496985708, 3.182286745507602, 7.571581586103393); const vec3 c2 = vec3(-66.09402360453038, -4.9279827041226, -10.09439367561635); const vec3 c3 = vec3(228.7660791526501, 25.04986699771073, -91.54105330182436); const vec3 c4 = vec3(-334.8351565777451, -69.31749712757485, 288.5858850615712); const vec3 c5 = vec3(218.7637218434795, 67.52150567819112, -305.2045772184957); const vec3 c6 = vec3(-52.88903478218835, .5452736712, 110.5174647748972); return c0+t*(c1+t*(c2+t*(c3+t*(c4+t*(c5+t*c6))))); // this is magic, dont worry about it. } 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.; // tan goes up and down but we only want it to go up // (so it looks like a spike) so we take the absolute value // dividing by 20 makes the tan function more spiking than smoothly going // up and down, check out the desmos link to see what i mean bpmVis = 1.+(bpmVis*0.1); // we want to multiply by this number, but its too big // by itself (it would be too stroby) so we want the number to multiply // by to be between 1.0 and 1.05 so its a subtle effect return bpmVis; } void main() { vec2 pos = uv(); // 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/abs(pos.x+0.01)); // we take the absolute value of x and add a small number to avoid // dividing by zero which is undefined behavior float r = sin(angle + time); // sin returns a number from -1 to 1, and colors are from 0 to 1, so thats // why you only see red on the screen half the time. the angle goes around // the screen, adding time moves it clockwise float bpmVis = getBPMVis(128.); float ringFrequency = 5.; // making this number bigger will increase frequency float g = cos(length(pos*ringFrequency *bpmVis) - time); // the distance (aka length) from the center put in a cos, time moves the // circles in. float b = cos(angle+ cos(length(pos*15.)) + bands.y * 5.); // this combines what we learned in the red and green channels // angle is going through a cos and so is the length, so we see the // blue channel oscillating in both dimensions the polar coordinates give us // here the music effects the place where the phase of the cosine starts vec3 color = 1.-turboPalette(r*b*g); // i thought it looked too light so i inverted the colors by adding 1- at the // beginning. Ill be honest this combo was randomly decided. color = vec3(r,g,b) / color; gl_FragColor = vec4(color,1.); // now play it to a bpm bop like I feel love by Donna Summer //https://www.youtube.com/watch?v=Nm-ISatLDG0 }