Merge pull request #880 from cgvirus/master
Crop and vignette Inverse Feature added
This commit is contained in:
@@ -5,6 +5,7 @@ uniform float top;
|
||||
uniform float right;
|
||||
uniform float bottom;
|
||||
uniform float feather;
|
||||
uniform bool invert;
|
||||
|
||||
uniform mediump float amount_val;
|
||||
uniform sampler2D myTexture;
|
||||
@@ -25,10 +26,18 @@ void main(void) {
|
||||
if (bottom > 0.0) alpha = alpha * clamp((((1.0-vTexCoord.y)+(0.5/f))-(bottom*0.01))*f, 0.0, 1.0); // bottom
|
||||
}
|
||||
|
||||
gl_FragColor = vec4(
|
||||
textureColor.r*alpha,
|
||||
textureColor.g*alpha,
|
||||
textureColor.b*alpha,
|
||||
if (invert)
|
||||
{gl_FragColor = vec4(
|
||||
textureColor.r*(1.0 - alpha),
|
||||
textureColor.g*(1.0 - alpha),
|
||||
textureColor.b*(1.0 - alpha),
|
||||
1.0 - alpha
|
||||
);}
|
||||
else{
|
||||
gl_FragColor = vec4(
|
||||
textureColor.r*(alpha),
|
||||
textureColor.g*(alpha),
|
||||
textureColor.b*(alpha),
|
||||
alpha
|
||||
);
|
||||
);}
|
||||
}
|
||||
@@ -16,4 +16,7 @@
|
||||
<field type="double" min="0" default="0" id="feather"/>
|
||||
</row>
|
||||
<shader vert="common.vert" frag="crop.frag"/>
|
||||
<row name="Invert">
|
||||
<field type="bool" default="0" id="invert"/>
|
||||
</row>
|
||||
</effect>
|
||||
@@ -7,6 +7,7 @@ uniform float centerX;
|
||||
uniform float centerY;
|
||||
uniform bool circular;
|
||||
uniform vec2 resolution;
|
||||
uniform bool invert;
|
||||
// uniform vec2 lensRadius; // 0.45, 0.38
|
||||
|
||||
varying vec2 vTexCoord;
|
||||
@@ -24,6 +25,11 @@ void main(void) {
|
||||
}
|
||||
float dist = distance(vignetteCoord, vec2(0.5 + centerX*0.01, 0.5 + centerY*0.01));
|
||||
float size = (lensRadiusX*0.01);
|
||||
c *= smoothstep(size, size*0.99*(1.0-lensRadiusY*0.01), dist);
|
||||
|
||||
if (invert)
|
||||
{c *= 1.0 - smoothstep(size, size*0.99*(1.0-lensRadiusY*0.01), dist);}
|
||||
else
|
||||
{c *= smoothstep(size, size*0.99*(1.0-lensRadiusY*0.01), dist);}
|
||||
|
||||
gl_FragColor = c;
|
||||
}
|
||||
@@ -13,5 +13,8 @@
|
||||
<field type="double" default="0" id="centerX"/>
|
||||
<field type="double" default="0" id="centerY"/>
|
||||
</row>
|
||||
<row name="Invert">
|
||||
<field type="bool" default="0" id="invert"/>
|
||||
</row>
|
||||
<shader vert="common.vert" frag="vignette.frag"/>
|
||||
</effect>
|
||||
Reference in New Issue
Block a user