pixelisation_f.glsl 629 B

1234567891011121314151617181920212223242526
  1. uniform sampler2D sceneTex; // 0
  2. float vx_offset = 0.5;
  3. float rt_w = 500.0;
  4. float rt_h = 500.0;
  5. float pixel_w = 15.0;
  6. float pixel_h = 10.0;
  7. void main()
  8. {
  9. vec2 uv = gl_TexCoord[ 0 ].xy;
  10. vec3 tc = vec3( 1.0, 0.0, 0.0 );
  11. if( uv.x < ( vx_offset - 0.005 ) )
  12. {
  13. float dx = pixel_w * ( 1. / rt_w );
  14. float dy = pixel_h * ( 1. / rt_h );
  15. vec2 coord = vec2( dx * floor( uv.x/dx ), dy * floor( uv.y / dy ));
  16. tc = texture2D( sceneTex, coord ).rgb;
  17. }
  18. else if( uv.x >= ( vx_offset + 0.005 ) )
  19. {
  20. tc = texture2D( sceneTex, uv ).rgb;
  21. }
  22. gl_FragColor = vec4( tc, 1.0 );
  23. }