Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uniform sampler2D texture;
- uniform float width; //x resolution of the image
- void main()
- {
- float pixeltopixeldistance = 1.0f / width;
- //odd pixel?
- bool thisrow = fract(gl_TexCoord[0].x * width / 2.0f) < 0.5f;
- vec2 otherpixel;
- if(!thisrow) otherpixel = texture2D(texture, gl_TexCoord[0].xy - vec2(pixeltopixeldistance,0)).rg; //color to the left
- else otherpixel = texture2D(texture, gl_TexCoord[0].xy + vec2(pixeltopixeldistance,0)).rg; //color to the right
- vec2 color = texture2D(texture, gl_TexCoord[0].xy);
- vec2 result = vec2(min(color, otherpixel)); //, min(min(color.g, colorL.g) , colorR.g));
- gl_FragColor = vec4(min(color, otherpixel),0,1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement