Advertisement
mivebe

Ex: 7 - Mouse tracking light

Nov 21st, 2023
1,614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #version 300 es
  2. #ifdef GL_ES
  3. precision mediump float;
  4. #endif
  5.  
  6. uniform float u_time;
  7. uniform vec2 u_mouse;
  8. uniform vec2 u_resolution;
  9. out vec4 outColor;
  10.  
  11. void main() {
  12.     vec2 coord = gl_FragCoord.xy / u_resolution.xy;
  13.     float aspect = u_resolution.x / u_resolution.y;
  14.     float asd = max(u_resolution.x, u_resolution.y) - min(u_resolution.x, u_resolution.y);
  15.    
  16.     coord.x -= u_mouse.x / u_resolution.x;
  17.     coord.y -= u_mouse.y / u_resolution.y;
  18.    
  19.     vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
  20.    
  21.     color += 0.1 * (sin(u_time * 2.0) + 0.01 / (pow(coord.x, 2.0) * aspect + pow(coord.y, 2.0) / aspect));
  22.     outColor = vec4(vec3(color), 1.0);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement