added and tweaked effects
This commit is contained in:
+1
-1
@@ -26,6 +26,6 @@ void main(void) {
|
||||
if (uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0) {
|
||||
gl_FragColor = texture2D(tex0, uv);
|
||||
} else {
|
||||
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
discard;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#version 110
|
||||
|
||||
uniform sampler2D sceneTex; // 0
|
||||
uniform float gamma_cent; // 0.6
|
||||
uniform float numColors; // 8.0
|
||||
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
void main() {
|
||||
float gamma = gamma_cent*0.01;
|
||||
vec4 color = texture2D(sceneTex, vTexCoord);
|
||||
vec3 c = color.rgb;
|
||||
c = pow(c, vec3(gamma, gamma, gamma));
|
||||
c = c * numColors;
|
||||
c = floor(c);
|
||||
c = c / numColors;
|
||||
c = pow(c, vec3(1.0/gamma));
|
||||
gl_FragColor = vec4(c, color.a);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<effect name="Posterize" category="Stylize">
|
||||
<row name="Colors">
|
||||
<field type="double" min="0" default="8" id="numColors"/>
|
||||
</row>
|
||||
<row name="Gamma">
|
||||
<field type="double" min="0" default="60" id="gamma_cent"/>
|
||||
</row>
|
||||
<shader vert="common.vert" frag="posterize.frag"/>
|
||||
</effect>
|
||||
@@ -0,0 +1,34 @@
|
||||
#version 110
|
||||
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
uniform float speed;
|
||||
uniform float intensity;
|
||||
uniform float frequency;
|
||||
uniform float xoff;
|
||||
uniform float yoff;
|
||||
uniform bool reverse;
|
||||
uniform bool stretch;
|
||||
|
||||
uniform vec2 resolution; // Screen resolution
|
||||
uniform float time; // time in seconds
|
||||
uniform sampler2D tex0; // scene buffer
|
||||
|
||||
void main(void) {
|
||||
vec2 texCoord = vTexCoord;
|
||||
vec2 center = vec2(1.0);
|
||||
|
||||
if (!stretch) {
|
||||
texCoord.x *= (resolution.x/resolution.y);
|
||||
center.x += (resolution.x/resolution.y)/2.0;
|
||||
}
|
||||
|
||||
center += vec2(xoff, yoff)*0.01;
|
||||
|
||||
float real_time = (reverse) ? -time : time;
|
||||
|
||||
vec2 p = 2.0 * texCoord - center;
|
||||
float len = length(p);
|
||||
vec2 uv = vTexCoord + (p/len)*cos((frequency*0.01)*(len*12.0-real_time*(speed*0.05)))*(intensity*0.0005);
|
||||
gl_FragColor = texture2D(tex0,uv);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<effect name="Ripple" category="Distort">
|
||||
<row name="Speed">
|
||||
<field type="double" min="0" default="100" id="speed"/>
|
||||
</row>
|
||||
<row name="Intensity">
|
||||
<field type="double" min="0" default="100" id="intensity"/>
|
||||
</row>
|
||||
<row name="Frequency">
|
||||
<field type="double" min="0" default="100" id="frequency"/>
|
||||
</row>
|
||||
<row name="Reverse">
|
||||
<field type="bool" default="0" id="reverse"/>
|
||||
</row>
|
||||
<row name="Stretch">
|
||||
<field type="bool" default="0" id="stretch"/>
|
||||
</row>
|
||||
<row name="Center">
|
||||
<field type="double" default="0" id="xoff"/>
|
||||
<field type="double" default="0" id="yoff"/>
|
||||
</row>
|
||||
<shader vert="common.vert" frag="ripple.frag"/>
|
||||
</effect>
|
||||
@@ -0,0 +1,45 @@
|
||||
#version 110
|
||||
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
uniform vec2 resolution; // Screen resolution
|
||||
uniform sampler2D tex0; // scene buffer
|
||||
|
||||
uniform float xoff;
|
||||
uniform float yoff;
|
||||
uniform float scale;
|
||||
uniform bool tile;
|
||||
uniform bool hide_edges;
|
||||
uniform bool stretch;
|
||||
|
||||
void main(void) {
|
||||
vec2 texCoord = vTexCoord;
|
||||
|
||||
vec2 offset = vec2(1.0);
|
||||
|
||||
if (!stretch) {
|
||||
if (resolution.x > resolution.y) {
|
||||
offset.x = (resolution.x/resolution.y);
|
||||
texCoord.x *= offset.x;
|
||||
} else {
|
||||
offset.y = (resolution.y/resolution.x);
|
||||
texCoord.y *= offset.y;
|
||||
}
|
||||
}
|
||||
|
||||
vec2 p = 2.0 * texCoord - offset;
|
||||
vec2 adj_tc = 2.0 * vTexCoord - 1.0;
|
||||
float r = dot(p,p);
|
||||
if (r > 1.0) discard;
|
||||
float f = (1.0-sqrt(1.0-r))/(r);
|
||||
vec2 uv;
|
||||
uv.x = (adj_tc.x*(1.5-scale*0.01))*f+0.5-(xoff*0.01);
|
||||
uv.y = (adj_tc.y*(1.5-scale*0.01))*f+0.5-(yoff*0.01);
|
||||
if (tile) {
|
||||
uv.x = mod(uv.x, 1.0);
|
||||
uv.y = mod(uv.y, 1.0);
|
||||
} else if (hide_edges && (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0)) {
|
||||
discard;
|
||||
}
|
||||
gl_FragColor = vec4(texture2D(tex0,uv));
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<effect name="Sphere" category="Distort">
|
||||
<row name="Center">
|
||||
<field type="double" default="0" id="xoff"/>
|
||||
<field type="double" default="0" id="yoff"/>
|
||||
</row>
|
||||
<row name="Scale">
|
||||
<field type="double" default="75" max="150" id="scale"/>
|
||||
</row>
|
||||
<row name="Tile">
|
||||
<field type="bool" default="1" id="tile"/>
|
||||
</row>
|
||||
<row name="Hide Edges">
|
||||
<field type="bool" default="0" id="hide_edges"/>
|
||||
</row>
|
||||
<row name="Stretch">
|
||||
<field type="bool" default="1" id="stretch"/>
|
||||
</row>
|
||||
<shader vert="common.vert" frag="sphere.frag"/>
|
||||
</effect>
|
||||
+1
-1
@@ -19,7 +19,7 @@ void main(void) {
|
||||
}
|
||||
|
||||
if (y < 0.0 || y > 1.0 || x < 0.0 || x > 1.0) {
|
||||
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
discard;
|
||||
} else {
|
||||
vec4 textureColor = texture2D(myTexture, vec2(x, y));
|
||||
gl_FragColor = vec4(
|
||||
|
||||
Reference in New Issue
Block a user