25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

40 lines
1016 B

  1. [vert.glsl]
  2. #version 120
  3. attribute vec4 in_Position;
  4. varying vec2 pass_TexCoord;
  5. void main()
  6. {
  7. gl_Position = in_Position;
  8. pass_TexCoord = vec2(0.5, 0.5) + 0.5 * in_Position.xy;
  9. }
  10. [frag.glsl]
  11. #version 120
  12. varying vec2 pass_TexCoord;
  13. uniform sampler2D texture;
  14. uniform vec2 radius;
  15. void main(void)
  16. {
  17. vec4 total = vec4(0.0);
  18. vec2 p = pass_TexCoord;
  19. float mask = 2.0-p.x*(6.0-p.x*6.0)*p.y*(6.0-p.y*6.0);
  20. float b = radius.x+radius.y*mask;
  21. total += texture2D(texture,vec2(p.x-b*4.0,p.y))*0.04;
  22. total += texture2D(texture,vec2(p.x-b*3.0,p.y))*0.08;
  23. total += texture2D(texture,vec2(p.x-b*2.0,p.y))*0.12;
  24. total += texture2D(texture,vec2(p.x-b ,p.y))*0.16;
  25. total += texture2D(texture,vec2(p.x ,p.y))*0.20;
  26. total += texture2D(texture,vec2(p.x+b ,p.y))*0.16;
  27. total += texture2D(texture,vec2(p.x+b*2.0,p.y))*0.12;
  28. total += texture2D(texture,vec2(p.x+b*3.0,p.y))*0.08;
  29. total += texture2D(texture,vec2(p.x+b*4.0,p.y))*0.04;
  30. gl_FragColor = total;
  31. }