added more effects

This commit is contained in:
itsmattkc
2018-11-04 11:57:53 +11:00
parent 9c87a4459a
commit d44309c2cd
10 changed files with 324 additions and 133 deletions
+1
View File
@@ -873,6 +873,7 @@ bool Effect::valueHasChanged(double timecode) {
void Effect::delete_texture() {
if (texture != NULL) {
texture->destroy();
delete texture;
texture = NULL;
}
+31
View File
@@ -0,0 +1,31 @@
#version 110
uniform float amount;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
void main(void) {
float x = vTexCoord.x;
float y = vTexCoord.y;
float r = sqrt(pow(x - 0.5, 2.0) + pow(y - 0.5, 2.0));
float a = atan(y - 0.5, x - 0.5);
float rn = pow(r, (amount*0.1))/0.5;
//float a = atan(x - 0.5, y - 0.5);
x = rn * cos(a) + 0.5;
y = rn * sin(a) + 0.5;
if (y < 0.0 || y > 1.0 || x < 0.0 || x > 1.0) {
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
} else {
vec4 textureColor = texture2D(myTexture, vec2(x, y));
gl_FragColor = vec4(
textureColor.r,
textureColor.g,
textureColor.b,
textureColor.a
);
}
}
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Bulge" category="Distort">
<row name="Amount">
<field type="double" min="0" default="25" id="amount"/>
</row>
<shader vert="common.vert" frag="bulge.frag"/>
</effect>
+74
View File
@@ -0,0 +1,74 @@
#version 110
uniform float temperature;
uniform float tint;
uniform float exposure;
uniform float contrast;
uniform float highlights;
uniform float shadows;
uniform float whites;
uniform float blacks;
uniform float saturation;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
void main(void) {
vec4 textureColor = texture2D(myTexture, vTexCoord);
vec3 rgb = textureColor.rgb;
// temperature
float temp = temperature * 0.01;
float redTemp = (temp <= 66.0) ? 1.0 : min(1.0, max(0.0,
(1.2929361861 * pow(temp - 60.0, -0.1332047592))
));
float greenTemp = min(1.0, max(0.0,
(temp <= 66.0) ? (0.3900815788 * log(temp) - 0.6318414438) : (1.1298908609 * pow(temp - 60.0, -0.0755148492))
));
float blueTemp = (temp >= 66.0) ? 1.0 : min(1.0, max(0.0,
(0.5432067891 * log(temp - 10.0) - 1.1962540891)
));
rgb *= vec3(redTemp, greenTemp, blueTemp);
// tint
rgb.g *= ((tint*0.01)+1.0);
// exposure
rgb *= pow(2.0, exposure*0.01);
// contrast
float contr_val = (contrast*0.01);
rgb = (rgb*contr_val)-((contr_val-1.0)*0.5);
// shadows/highlights
//float luma = 0.33*rgb.r + 0.5*rgb.g + 0.16*rgb.b;
if (rgb.r < 0.5 && rgb.g < 0.5 && rgb.b < 0.5) {
float shadow_val = 1.0-(shadows*0.01);
rgb = vec3(pow(rgb.r*2.0, shadow_val)*0.5, pow(rgb.g*2.0, shadow_val)*0.5, pow(rgb.b*2.0, shadow_val)*0.5);
} else if (rgb.r > 0.5 && rgb.g > 0.5 && rgb.b > 0.5) {
float highlight_val = 1.0-(highlights*0.01);
rgb = vec3((pow((rgb.r-0.5)*2.0, highlight_val)*0.5)+0.5, (pow((rgb.g-0.5)*2.0, highlight_val)*0.5)+0.5, (pow((rgb.b-0.5)*2.0, highlight_val)*0.5)+0.5);
}
// whites
rgb *= (whites*0.01);
// blacks
float black_val = 2.0-(blacks*0.01);
rgb = (rgb*black_val)-(black_val-1.0);
// saturation
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
vec3 intensity = vec3(dot(rgb, W));
rgb = mix(intensity, rgb, saturation*0.01);
gl_FragColor = vec4(
rgb.r,
rgb.g,
rgb.b,
textureColor.a
);
}
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Color Correction" category="Color">
<row name="Temperature">
<field type="double" min="2000" default="6600" max="40000" id="temperature"/>
</row>
<row name="Tint">
<field type="double" min="-100" default="0" id="tint"/>
</row>
<row name="Exposure">
<field type="double" default="0" id="exposure"/>
</row>
<row name="Contrast">
<field type="double" min="0" default="100" id="contrast"/>
</row>
<row name="Highlights">
<field type="double" default="0" max="100" id="highlights"/>
</row>
<row name="Shadows">
<field type="double" default="0" max="100" id="shadows"/>
</row>
<row name="Whites (Brightness)">
<field type="double" min="0" default="100" id="whites"/>
</row>
<row name="Blacks (Darkness)">
<field type="double" min="0" default="100" max="200" id="blacks"/>
</row>
<row name="Saturation">
<field type="double" min="0" default="100" id="saturation"/>
</row>
<shader vert="common.vert" frag="colorcorrection.frag"/>
</effect>
+14
View File
@@ -0,0 +1,14 @@
#version 110
uniform sampler2D myTexture;
varying vec2 vTexCoord;
void main(void) {
vec4 textureColor = texture2D(myTexture, vec2(vTexCoord.x, vTexCoord.y));
gl_FragColor = vec4(
textureColor.r,
textureColor.g,
textureColor.b,
textureColor.a
);
}
+23
View File
@@ -0,0 +1,23 @@
#version 110
uniform bool horiz;
uniform bool vert;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
void main(void) {
float x = vTexCoord.x;
float y = vTexCoord.y;
if (horiz) x = 1.0 - x;
if (vert) y = 1.0 - y;
vec4 textureColor = texture2D(myTexture, vec2(x, y));
gl_FragColor = vec4(
textureColor.r,
textureColor.g,
textureColor.b,
textureColor.a
);
}
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Flip" category="Distort">
<row name="Horizontal">
<field type="bool" default="1" id="horiz"/>
</row>
<row name="Vertical">
<field type="bool" default="0" id="vert"/>
</row>
<shader vert="common.vert" frag="flip.frag"/>
</effect>