Guest User

Untitled

a guest
Dec 18th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. ivec2 itexSize =textureSize(rbga_tex,0);
  2. vec2 texSize = vec2(itexSize);
  3. vec2 texelSize = 1.0 / (texSize / 2.0);
  4. vec2 pixel = uv * texSize + 0.5;
  5. pixel = (floor(pixel) / texSize) - vec2(texelSize/2.0);
  6.  
  7. //bilinear filtering:
  8. float sc = 4.0;
  9. vec3 ts = texture(rbga_tex, pixel ).rgb * 0.25; // center
  10. vec3 tr = texture(rbga_tex, pixel + vec2(texelSize.x * sc, 0.0) ).rgb * 0.25;
  11. vec3 bl = texture(rbga_tex, pixel + vec2(0.0, texelSize.y * sc) ).rgb * 0.25;
  12. vec3 br = texture(rbga_tex, pixel + vec2(texelSize.x, texelSize.y) * sc).rgb * 0.25;
  13.  
  14. vec3 tex1 = (ts + tr + bl + br) ;
  15.  
  16.  
  17. // calculate and write U...
  18.  
  19. // calculate and write V...
Add Comment
Please, Sign In to add comment