-
-
Save LatestBright/e5399d57e405575aea8f9d8785edd09f to your computer and use it in GitHub Desktop.
This file contains 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
// Author:Cameron Saunders 3178885 | |
//Course:ShaderArt | |
// Title: Mixed Gradient/Emotions | |
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
//PI needs to be declared | |
#define PI 3.14159265359 | |
uniform vec2 u_resolution; | |
uniform vec2 u_mouse; | |
uniform float u_time; | |
//Pick 2 Colors variables to Mix | |
vec3 colorA = vec3(0.912,0.328,0.551); | |
vec3 colorB = vec3(0.767,0.090,1.000); | |
//Determine the points at which the Grandient will occur | |
float plot(vec2 st, float pct){ | |
return smoothstep(pct-0.194, pct, st.y) - | |
smoothstep(pct, pct+-1.110, st.y); | |
} | |
void main() { | |
//Normalize Canvas | |
vec2 st = gl_FragCoord.xy/u_resolution.xy; | |
//declare color variable | |
vec3 color = vec3(0.297,0.320,0.910); | |
//Normalize Mouse posistion | |
vec2 mouseXY = u_mouse / u_resolution; | |
vec3 pct = vec3(st.x); | |
//Determine Posistion and Color variables for each | |
//shaping fnction | |
pct.r = smoothstep(-1.008,1.600,st.x); | |
pct.g = sin(st.x*PI); | |
pct.b = pow(st.x,0.460); | |
//Mix vec3 selected Colors A and B | |
color = mix(colorA,colorB,pct); | |
color = mix(color,vec3(1.000,0.047,0.009),plot(st,pct.r)); | |
color = mix(color,vec3(1.000,0.470,0.002),plot(st,pct.g)); | |
//Alter where gradient happens using "smoothstep" | |
//and GLSL shaping functions. | |
//Alter Color Brightness | |
gl_FragColor = vec4(color,2.072); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment