aboutsummaryrefslogtreecommitdiff
path: root/samples/post-processing/shaders/noise.jsl
blob: a2ba383725828c436ea1f4c6afeb89c6bcada414 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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