Professional Documents
Culture Documents
Create
Draw GUI
sh_shader
_
varying vec2 v_vTexcoord; varying vec4 v_vColour; uniform float time; uniform
vec3 rep1; uniform vec3 rep2; uniform vec3 new1; uniform vec3 new2; float
rand(vec2 co) { return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
} vec3 screen(vec3 a, vec3 b, float w) { return mix(a, vec3(1.0) - (vec3(1.0) -
a) * (vec3(1.0) - b), w); } void main() { vec2 uv = v_vTexcoord; highp float
magnitude = 0.001; vec2 offsetUV = uv; offsetUV.x = uv.x +
rand(vec2(time*0.03,uv.y*0.42)) * 0.001; offsetUV.x += sin(rand(vec2(time*0.2,
uv.y)))*magnitude; vec4 offsetColor = vec4(vec3(texture2D(gm_BaseTexture,
offsetUV)), 1); //---------------------------------------------------------------
--------- vec3 new = vec3( offsetColor.r * 255.0, offsetColor.g * 255.0,
offsetColor.b * 255.0 ); if (new == rep1) {new = new1;} if (new == rep2) {new =
new2;} vec4 swapedColor = vec4( new.r / 255.0, new.g / 255.0, new.b / 255.0, 1 );
//------------------------------------------------------------------------ float
flicker = 20.0; float freq = sin(pow(mod(time, flicker)+flicker, 1.9));
gl_FragColor = vec4(1.0,1.0,1.0,1.0); gl_FragColor *= vec4(rand(uv+mod(time,
freq)), rand(uv+mod(time+.1, freq)), rand(uv), 1.0); gl_FragColor.rgb = screen(
swapedColor.rgb, gl_FragColor.rgb, 0.2 ); }
Plain Text
sh_blur
varying vec2 v_vTexcoord; varying vec4 v_vColour; uniform vec3 size; const int
Quality = 10; const int Directions = 16; const float Pi = 6.28318530718; void
main() { vec2 radius = size.z / size.xy; vec2 p = ( gl_FragCoord.xy * 2.0 -
size.xy ) / min( size.x, size.y ); float l = 2.0; vec4 Color = texture2D(
gm_BaseTexture, v_vTexcoord ); for( float d = 0.0; d < Pi; d += Pi / float(
Directions ) ) { for( float i = 1.0 / float( Quality ); i <= 1.0; i += 1.0 /
float( Quality ) ) { Color += texture2D( gm_BaseTexture, v_vTexcoord + vec2( cos(
d ), sin( d ) ) * radius * i * l ); } } Color /= float( Quality ) * float(
Directions ) + 1.0; gl_FragColor = Color * v_vColour; }
Plain Text