From 2a867a0434f9c0f5c23da5249e5149623cac909c Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 30 Dec 2018 12:40:20 +0800 Subject: =?UTF-8?q?*=E6=B7=BB=E5=8A=A0sample?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- samples/post-processing/shaders/rgb-split.jsl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 samples/post-processing/shaders/rgb-split.jsl (limited to 'samples/post-processing/shaders/rgb-split.jsl') diff --git a/samples/post-processing/shaders/rgb-split.jsl b/samples/post-processing/shaders/rgb-split.jsl new file mode 100644 index 0000000..fcfb9f2 --- /dev/null +++ b/samples/post-processing/shaders/rgb-split.jsl @@ -0,0 +1,24 @@ +#VERTEX_SHADER +Vertex vert(Vertex v) +{ + //v.xy += vec2(50 * sin(jin_Time.x * 2), 50 * cos(jin_Time.x * 2)); + return v; +} +#END_VERTEX_SHADER +#FRAGMENT_SHADER +Color frag(Color col, Texture tex, Vertex v) +{ + float t = jin_Time.x; + float a = abs(sin(t)) * 3.14; + vec2 p = vec2(0.5*cos(a) + 0.5, 0.5*sin(a) + 0.5); + vec2 dir = v.uv - p; + float d = .7 * length(dir); + normalize(dir); + vec2 value = d * dir * 200 * abs(sin(t * 3)); + + vec4 c1 = texel(tex, v.uv - value / jin_RenderTargetSize.x); + vec4 c2 = texel(tex, v.uv); + vec4 c3 = texel(tex, v.uv + value / jin_RenderTargetSize.y); + return vec4(c1.r, c2.g, c3.b, c1.a + c2.a + c3.b); +} +#END_FRAGMENT_SHADER \ No newline at end of file -- cgit v1.1-26-g67d0