Last active
February 9, 2021 08:13
-
-
Save companje/60a671fcb08e5e1591ad3afb673cd8a9 to your computer and use it in GitHub Desktop.
Chromatic Aberration with blueScaler and yellowDecrease
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
#define PROCESSING_TEXTURE_SHADER | |
uniform sampler2D texture; | |
varying vec4 vertTexCoord; | |
//downscale the blue channel to correct | |
//for chromatic aberration of fish eye lens | |
const float blueScaler = 1 - (1 / 600.); | |
void main() { | |
//also decrease the amount of yellow towards outside | |
const float yellowDecrease = .3 * length(vertTexCoord.st-.5); | |
gl_FragColor.rg = texture2D(texture, vertTexCoord.st).rg - yellowDecrease; | |
gl_FragColor.b = texture2D(texture, ((vertTexCoord.st-.5)*blueScaler)+.5).b; | |
} |
Author
companje
commented
Feb 9, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment