Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uniform sampler2D tex;
- uniform float time = 0.0;
- uniform float width = 240;
- uniform float height = 240;
- float sum = 1.0/442.0;
- float weights[4] = float[](70.0, 56.0, 28.0, 8.0, 1.0);
- float offsets[4] = float[](0, 1, 2, 3, 4);
- /*
- input unnormalised values.
- returns pixel value of the pixel dx and dy relatively to the processed one
- */
- vec4 getPixel(float dx, float dy)
- {
- return texture2D(tex, gl_TexCoord[0].st + vec2(dx/width, dy/height));
- }
- void main()
- {
- /*
- -1 -1 -1
- -1 8 -1
- -1 -1 -1
- */
- vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
- for(int i=1; i<=4; i++){
- color += getPixel(0, offsets[i])*weight[i]*sum;
- color += getPixel(0, -offsets[i])*weight[i]*sum;
- color += getPixel(offsets[i], 0)*weight[i]*sum;
- color += getPixel(-offsets[i], 0)*weight[i]*sum;
- }
- color += getPixel(0, 0)*weight[0]*sum;
- gl_FragColor = color;
- }
Add Comment
Please, Sign In to add comment