• NFT
  • Explore
  • Challenge
Sign in Sign up
Create Art arrow_drop_down
settings
Templates Resources
help CANCEL
Save as...
xxxxxxxxxx
27
 
1
precision highp float;
2
​
3
uniform vec2 resolution;
4
uniform float time;
5
uniform vec2 mouse;
6
uniform sampler2D backbuffer;
7
uniform sampler2D channel0;
8
uniform vec2 channelSize0;
9
​
10
void main(void) {
11
    vec2 uv = (gl_FragCoord.xy * 2.0 - resolution.xy) / min(resolution.x, resolution.y);
12
    uv = gl_FragCoord.xy / resolution.xy;
13
    
14
    vec2 ratio = vec2(
15
      min((resolution.x / resolution.y) / (channelSize0.x / channelSize0.y), 1.0),
16
      min((resolution.y / resolution.x) / (channelSize0.y / channelSize0.x), 1.0)
17
    );
18
​
19
    uv = vec2(
20
      uv.x * ratio.x + (1.0 - ratio.x) * 0.5,
21
      uv.y * ratio.y + (1.0 - ratio.y) * 0.5
22
    );
23
    
24
    vec3 color = texture2D(channel0, uv).xyz;
25
​
26
    gl_FragColor = vec4(color, 1.0);
27
}
autorenew