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/noise.jsl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 samples/post-processing/shaders/noise.jsl (limited to 'samples/post-processing/shaders/noise.jsl') diff --git a/samples/post-processing/shaders/noise.jsl b/samples/post-processing/shaders/noise.jsl new file mode 100644 index 0000000..a2ba383 --- /dev/null +++ b/samples/post-processing/shaders/noise.jsl @@ -0,0 +1,21 @@ +#VERTEX_SHADER +Vertex vert(Vertex v) +{ + return v; +} +#END_VERTEX_SHADER +#FRAGMENT_SHADER + +float random(vec2 n, float offset ){ + return .5 - fract(sin(dot(n.xy + vec2(offset, 0.), vec2(12.9898, 78.233)))* 43758.5453); +} + +Color frag(Color col, Texture texture, Vertex v) +{ + float amount = 0.1; + float speed = 0.5; + vec4 color = texture2D(texture, v.uv.xy); + color += vec4(vec3(amount * random(v.uv.xy, .00001 * speed * jin_Time.x)), 1.); + return color; +} +#END_FRAGMENT_SHADER \ No newline at end of file -- cgit v1.1-26-g67d0