parent
7e3b61bd30
commit
1706a896e7
@ -0,0 +1,9 @@
|
||||
varying highp vec2 textureCoordinate;
|
||||
|
||||
uniform sampler2D inputImageTexture;
|
||||
uniform lowp float brightness;
|
||||
|
||||
void main() {
|
||||
lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
|
||||
gl_FragColor = vec4((textureColor.rgb + vec3(brightness)), textureColor.w);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
varying highp vec2 textureCoordinate;
|
||||
|
||||
uniform sampler2D inputImageTexture;
|
||||
uniform lowp float contrast;
|
||||
|
||||
void main() {
|
||||
lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
|
||||
gl_FragColor = vec4(((textureColor.rgb - vec3(0.5)) * contrast + vec3(0.5)), textureColor.w);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
varying highp vec2 textureCoordinate;
|
||||
|
||||
uniform sampler2D inputImageTexture;
|
||||
uniform highp float exposure;
|
||||
|
||||
void main() {
|
||||
highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
|
||||
gl_FragColor = vec4(textureColor.rgb * pow(2.0, exposure), textureColor.w);
|
||||
}
|
@ -1,10 +1,8 @@
|
||||
#extension GL_OES_EGL_image_external : require
|
||||
|
||||
precision mediump float;
|
||||
|
||||
varying mediump vec2 textureCoordinate;
|
||||
|
||||
uniform samplerExternalOES inputImageTexture;
|
||||
uniform sampler2D inputImageTexture;
|
||||
|
||||
void main() {
|
||||
vec3 centralColor = texture2D(inputImageTexture, textureCoordinate).rgb;
|
@ -0,0 +1,11 @@
|
||||
#extension GL_OES_EGL_image_external : require
|
||||
|
||||
precision mediump float;
|
||||
|
||||
varying mediump vec2 textureCoordinate;
|
||||
|
||||
uniform samplerExternalOES inputImageTexture;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = texture2D(inputImageTexture, textureCoordinate);
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
precision highp float;
|
||||
|
||||
varying highp vec2 textureCoordinate;
|
||||
|
||||
uniform sampler2D inputImageTexture;
|
||||
uniform mediump float hueAdjust;
|
||||
const highp vec4 kRGBToYPrime = vec4 (0.299, 0.587, 0.114, 0.0);
|
||||
const highp vec4 kRGBToI = vec4 (0.595716, -0.274453, -0.321263, 0.0);
|
||||
const highp vec4 kRGBToQ = vec4 (0.211456, -0.522591, 0.31135, 0.0);
|
||||
|
||||
const highp vec4 kYIQToR = vec4 (1.0, 0.9563, 0.6210, 0.0);
|
||||
const highp vec4 kYIQToG = vec4 (1.0, -0.2721, -0.6474, 0.0);
|
||||
const highp vec4 kYIQToB = vec4 (1.0, -1.1070, 1.7046, 0.0);
|
||||
|
||||
void main () {
|
||||
// Sample the input pixel
|
||||
highp vec4 color = texture2D(inputImageTexture, textureCoordinate);
|
||||
|
||||
// Convert to YIQ
|
||||
highp float YPrime = dot (color, kRGBToYPrime);
|
||||
highp float I = dot (color, kRGBToI);
|
||||
highp float Q = dot (color, kRGBToQ);
|
||||
|
||||
// Calculate the hue and chroma
|
||||
highp float hue = atan (Q, I);
|
||||
highp float chroma = sqrt (I * I + Q * Q);
|
||||
|
||||
// Make the user's adjustments
|
||||
hue += (-hueAdjust); //why negative rotation?
|
||||
|
||||
// Convert back to YIQ
|
||||
Q = chroma * sin (hue);
|
||||
I = chroma * cos (hue);
|
||||
|
||||
// Convert back to RGB
|
||||
highp vec4 yIQ = vec4 (YPrime, I, Q, 0.0);
|
||||
color.r = dot (yIQ, kYIQToR);
|
||||
color.g = dot (yIQ, kYIQToG);
|
||||
color.b = dot (yIQ, kYIQToB);
|
||||
|
||||
// Save the result
|
||||
gl_FragColor = color;
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
varying highp vec2 textureCoordinate;
|
||||
|
||||
uniform sampler2D inputImageTexture;
|
||||
uniform sampler2D inputImageTexture2; // lookup texture\n" +
|
||||
|
||||
void main() {
|
||||
|
||||
lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);\n" +
|
||||
|
||||
mediump float blueColor = textureColor.b * 63.0;
|
||||
|
||||
mediump vec2 quad1;
|
||||
quad1.y = floor(floor(blueColor) / 8.0);
|
||||
quad1.x = floor(blueColor) - (quad1.y * 8.0);
|
||||
|
||||
mediump vec2 quad2;\n" +
|
||||
quad2.y = floor(ceil(blueColor) / 8.0);\n" +
|
||||
quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n" +
|
||||
|
||||
highp vec2 texPos1;
|
||||
texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
|
||||
texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
|
||||
|
||||
highp vec2 texPos2;\n" +
|
||||
texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
|
||||
texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
|
||||
|
||||
lowp vec4 newColor1 = texture2D(inputImageTexture2, texPos1);
|
||||
lowp vec4 newColor2 = texture2D(inputImageTexture2, texPos2);
|
||||
|
||||
lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));
|
||||
gl_FragColor = vec4(newColor.rgb, textureColor.w);
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
varying highp vec2 textureCoordinate;
|
||||
|
||||
uniform sampler2D inputImageTexture;
|
||||
uniform lowp float saturation;
|
||||
|
||||
// Values from \"Graphics Shaders: Theory and Practice\" by Bailey and Cunningham
|
||||
const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);
|
||||
|
||||
void main() {
|
||||
lowp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
|
||||
lowp float luminance = dot(textureColor.rgb, luminanceWeighting);
|
||||
lowp vec3 greyScaleColor = vec3(luminance);
|
||||
|
||||
gl_FragColor = vec4(mix(greyScaleColor, textureColor.rgb, saturation), textureColor.w);
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
precision highp float;
|
||||
|
||||
varying highp vec2 textureCoordinate;
|
||||
varying highp vec2 leftTextureCoordinate;
|
||||
varying highp vec2 rightTextureCoordinate;
|
||||
varying highp vec2 topTextureCoordinate;
|
||||
varying highp vec2 bottomTextureCoordinate;
|
||||
|
||||
varying highp float centerMultiplier;
|
||||
varying highp float edgeMultiplier;
|
||||
|
||||
uniform sampler2D inputImageTexture;
|
||||
|
||||
void main() {
|
||||
mediump vec3 textureColor = texture2D(inputImageTexture, textureCoordinate).rgb;
|
||||
mediump vec3 leftTextureColor = texture2D(inputImageTexture, leftTextureCoordinate).rgb;
|
||||
mediump vec3 rightTextureColor = texture2D(inputImageTexture, rightTextureCoordinate).rgb;
|
||||
mediump vec3 topTextureColor = texture2D(inputImageTexture, topTextureCoordinate).rgb;
|
||||
mediump vec3 bottomTextureColor = texture2D(inputImageTexture, bottomTextureCoordinate).rgb;
|
||||
|
||||
gl_FragColor = vec4((textureColor * centerMultiplier - (leftTextureColor * edgeMultiplier + rightTextureColor * edgeMultiplier + topTextureColor * edgeMultiplier + bottomTextureColor * edgeMultiplier)), texture2D(inputImageTexture, bottomTextureCoordinate).w);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
attribute vec4 position;
|
||||
attribute vec4 inputTextureCoordinate;
|
||||
|
||||
varying vec2 textureCoordinate;
|
||||
|
||||
void main() {
|
||||
textureCoordinate = inputTextureCoordinate.xy;
|
||||
gl_Position = position;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
attribute vec4 position;
|
||||
attribute vec4 inputTextureCoordinate;
|
||||
|
||||
uniform float imageWidthFactor;
|
||||
uniform float imageHeightFactor;
|
||||
uniform float sharpness;
|
||||
|
||||
varying vec2 textureCoordinate;
|
||||
varying vec2 leftTextureCoordinate;
|
||||
varying vec2 rightTextureCoordinate;
|
||||
varying vec2 topTextureCoordinate;
|
||||
varying vec2 bottomTextureCoordinate;
|
||||
|
||||
varying float centerMultiplier;
|
||||
varying float edgeMultiplier;
|
||||
|
||||
void main() {
|
||||
gl_Position = position;
|
||||
|
||||
mediump vec2 widthStep = vec2(imageWidthFactor, 0.0);
|
||||
mediump vec2 heightStep = vec2(0.0, imageHeightFactor);
|
||||
|
||||
textureCoordinate = inputTextureCoordinate.xy;
|
||||
leftTextureCoordinate = inputTextureCoordinate.xy - widthStep;
|
||||
rightTextureCoordinate = inputTextureCoordinate.xy + widthStep;
|
||||
topTextureCoordinate = inputTextureCoordinate.xy + heightStep;
|
||||
bottomTextureCoordinate = inputTextureCoordinate.xy - heightStep;
|
||||
|
||||
centerMultiplier = 1.0 + 4.0 * sharpness;
|
||||
edgeMultiplier = sharpness;
|
||||
}
|
Loading…
Reference in New Issue