Created
November 4, 2016 19:57
-
-
Save iche033/55bc0b64a5ab01baae26fb2e6fb78b0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The input texture, which is set up by the Ogre Compositor infrastructure. | |
uniform sampler2D RT; | |
// Mapping of undistorted to distorted uv coordinates. | |
uniform sampler2D distortionMap; | |
// Scale the input texture if necessary to crop black border | |
uniform vec3 scale; | |
void main() | |
{ | |
// vec2 scaleCenter = vec2(0.5, 0.5); | |
// vec2 inputUV = (gl_TexCoord[0].xy - scaleCenter) * scale.xy + scaleCenter; | |
vec2 inputUV = gl_TexCoord[0].xy; | |
vec4 mapUV = texture2D(distortionMap, inputUV); | |
if (mapUV.x < 0.0 || mapUV.y < 0.0) | |
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); | |
else | |
gl_FragColor = texture2D(RT, mapUV.xy); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment