Parcourir la source

initial

master
Anish Lakhwara il y a 10 mois
révision
0bf035e7bb
6 fichiers modifiés avec 108 ajouts et 0 suppressions
  1. +18
    -0
      fence/art-of-code-example.frag
  2. +28
    -0
      fence/example.frag
  3. BIN
      fence/kynd functions.png
  4. +28
    -0
      fence/mod_with_number_first.frag
  5. +19
    -0
      fence/scratch.frag
  6. +15
    -0
      simplest.frag

+ 18
- 0
fence/art-of-code-example.frag Voir le fichier

@@ -0,0 +1,18 @@
#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;

void main() {
vec3 color = vec3(0);
vec2 st = (gl_FragCoord.xy-.5*u_resolution.xy)/u_resolution.y;

float m = smoothstep(0.05, 0.0, abs(st.x));
color += m;

gl_FragColor = vec4(color,1.0);
}


+ 28
- 0
fence/example.frag Voir le fichier

@@ -0,0 +1,28 @@
#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;

// Plot a line on Y using a value between 0.0-1.0
float plot(vec2 st, float pct){
return smoothstep( pct-0.02, pct, st.y) -
smoothstep( pct, pct+0.02, st.y);
}

void main() {
vec2 st = gl_FragCoord.xy/u_resolution;

float y = st.x;

vec3 color = vec3(y);

// Plot a line
float pct = plot(st,y);
color = (1.0-pct)*color+pct*vec3(0.0,1.0,0.0);

gl_FragColor = vec4(color,1.0);
}


BIN
fence/kynd functions.png Voir le fichier

Avant Après
Largeur: 1920  |  Hauteur: 1080  |  Taille: 22 KiB

+ 28
- 0
fence/mod_with_number_first.frag Voir le fichier

@@ -0,0 +1,28 @@
#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;

// Plot a line on Y using a value between 0.0-1.0
float plot(vec2 st, float pct){
return smoothstep( pct-0.02, pct, st.y) -
smoothstep( pct, pct+0.02, st.y);
}

void main() {
vec2 st = gl_FragCoord.xy/u_resolution;

float y = mod(13.5, st.x);

vec3 color = vec3(y);

// Plot a line
float pct = plot(st,y);
color = (1.0-pct)*color+pct*vec3(0.0,1.0,0.0);

gl_FragColor = vec4(color,1.0);
}


+ 19
- 0
fence/scratch.frag Voir le fichier

@@ -0,0 +1,19 @@
#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;

void main() {
vec3 color = vec3(0);
vec2 st = (gl_FragCoord.xy-.5*u_resolution.xy)/u_resolution.y;
st *= u_time;

float m = .5 - abs(sin(st.x));
color += m;

gl_FragColor = vec4(color,1.0);
}


+ 15
- 0
simplest.frag Voir le fichier

@@ -0,0 +1,15 @@
#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;

void main() {
// make a vector that puts all x and y values between 0.0 - 1.0 so we can use it as a color
vec2 st = gl_FragCoord.xy/u_resolution;
// use time to change the blue hue of the screen
gl_FragColor = vec4(st.x,st.y,abs(sin(u_time)),1.0);
}


Chargement…
Annuler
Enregistrer