README.md edited online with Bitbucket
[gdash.git] / shaders / Curvature.shader
blobec1293cb12542c5aa15bc24e434322ddbeac55d6
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 Curvature shader from the bsnes project.
4 Author unknown.
5 -->
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;
22 void main(void) {
23 gl_FragColor = texture2D(rubyTexture, radialDistortion(gl_TexCoord[0].xy));
25 ]]></fragment>
26 </shader>