/usr/share/psychtoolbox-3/PsychOpenGL/PsychGLSLShaders/StereoCrosstalkReductionShader.frag.txt is in psychtoolbox-3-common 3.0.12.20160126.dfsg1-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | /* vim: syntax=glsl
* StereoCrosstalkReductionShader.frag.txt
*
* A fragment shader that receives a stereo input image pair and computes
* a corrected stereo output image for one stereo channel in which stereo
* crosstalk is suppressed to some degree.
*
* 'Image1' is the primary stereo input image, which should be written back
* as output image. 'Image2' is the unrelated input image for the other eye,
* whose influence onto the output image should be reduced, ie., Image2 is
* the reason for ghosting in the eye related to 'Image1'.
*
* This shader combines both input images into a new output image with
* the aim of reducing the ghosting. The shader will get called by Screens
* image processing pipeline twice, once for the left eye, once for the right
* eye, with reversed roles for Image1 and Image2, to achieve suppression for
* both eyes.
*
* Ghost suppression is achieved by subtraction of the contrast of
* the suppressed image (scaled by a contrast gain) from the target
* image.
*
* background luminance / color level (set by backGroundClr uniform)
* should not be zero as then there is no way to invert contrast w.r.t.
* the background.
*
* (c) 2014 by Diederick Niehorster, licensed under MIT license.
*/
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect Image1;
uniform sampler2DRect Image2;
uniform vec3 crosstalkGain;
uniform vec3 backGroundClr;
void main()
{
vec2 inpos = gl_TexCoord[0].st;
/* Get current input image pixel color values for both input images
* at current location inpos: */
vec4 targetimage = texture2DRect(Image1, inpos);
vec4 suppressedimage = texture2DRect(Image2, inpos);
/* Get contrast in suppressed image and scale by gain: */
suppressedimage.rgb -= backGroundClr;
suppressedimage.rgb *= -crosstalkGain;
/* Write output pixel color corresponding to a de-ghosted Image1,
* sum of target image and suppressed image */
gl_FragColor.rgb = targetimage.rgb + suppressedimage.rgb;
gl_FragColor.a = targetimage.a;
}
|