aboutsummaryrefslogtreecommitdiff
path: root/samples/post-processing/shaders/noise.jsl
diff options
context:
space:
mode:
Diffstat (limited to 'samples/post-processing/shaders/noise.jsl')
-rw-r--r--samples/post-processing/shaders/noise.jsl21
1 files changed, 21 insertions, 0 deletions
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