diff options
author | chai <chaifix@163.com> | 2018-12-30 12:40:20 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-30 12:40:20 +0800 |
commit | 2a867a0434f9c0f5c23da5249e5149623cac909c (patch) | |
tree | 3999807a4ea481201211e151ca2fb24008020e9d /samples/post-processing/shaders/noise.jsl | |
parent | 48173231d90de6bfc193260eab6369f7c88ca742 (diff) |
*添加sample
Diffstat (limited to 'samples/post-processing/shaders/noise.jsl')
-rw-r--r-- | samples/post-processing/shaders/noise.jsl | 21 |
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 |