1 <?xml version=
"1.0" encoding=
"UTF-8"?>
3 Curvature shader from the bsnes project.
6 <shader language=
"GLSL">
7 <fragment filter=
"linear"><![CDATA[
8 uniform sampler2D rubyTexture;
9 uniform vec2 rubyInputSize;
10 uniform vec2 rubyTextureSize;
12 // Tweak this parameter for more / less distortion
13 #define distortion
0.15
15 vec2 radialDistortion(vec2 coord) {
16 coord *= rubyTextureSize / rubyInputSize;
17 vec2 cc = coord - vec2(
0.5);
18 float dist = dot(cc, cc) * distortion;
19 return (coord + cc * (
1.0 + dist) * dist) * rubyInputSize / rubyTextureSize;
23 gl_FragColor = texture2D(rubyTexture, radialDistortion(gl_TexCoord[
0].xy));