Browse Source

core: add some noise to the gradient effect.

legacy
Sam Hocevar sam 12 years ago
parent
commit
6c2fa45b71
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      src/gradient.lolfx

+ 6
- 1
src/gradient.lolfx View File

@@ -37,13 +37,17 @@ mat4 cluster = mat4(12.0, 5.0, 6.0, 13.0,
11.0, 3.0, 2.0, 8.0,
15.0, 10.0, 9.0, 14.0);

float rand(vec2 p)
{
return fract(sin(dot(p, vec2(12.9898, 78.2333))) * 123.4567);
}

void main()
{
vec4 col = pass_Color;
#if defined GL_ES
int dx = int(mod(gl_FragCoord.x, 4.0));
int dy = int(mod(gl_FragCoord.y, 4.0));
/* Cluster */
float t;
if (dx == 0)
{
@@ -65,6 +69,7 @@ void main()
float t = cluster[int(mod(gl_FragCoord.x, 4.0))]
[int(mod(gl_FragCoord.y, 4.0))];
#endif
t += rand(gl_FragCoord.xy) - 0.5;
t = (t + 0.5) / 17.0;
col.x += fract(t - col.x) - t;
col.y += fract(t - col.y) - t;


Loading…
Cancel
Save