| @@ -37,13 +37,17 @@ mat4 cluster = mat4(12.0, 5.0, 6.0, 13.0, | |||||
| 11.0, 3.0, 2.0, 8.0, | 11.0, 3.0, 2.0, 8.0, | ||||
| 15.0, 10.0, 9.0, 14.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() | void main() | ||||
| { | { | ||||
| vec4 col = pass_Color; | vec4 col = pass_Color; | ||||
| #if defined GL_ES | #if defined GL_ES | ||||
| int dx = int(mod(gl_FragCoord.x, 4.0)); | int dx = int(mod(gl_FragCoord.x, 4.0)); | ||||
| int dy = int(mod(gl_FragCoord.y, 4.0)); | int dy = int(mod(gl_FragCoord.y, 4.0)); | ||||
| /* Cluster */ | |||||
| float t; | float t; | ||||
| if (dx == 0) | if (dx == 0) | ||||
| { | { | ||||
| @@ -65,6 +69,7 @@ void main() | |||||
| float t = cluster[int(mod(gl_FragCoord.x, 4.0))] | float t = cluster[int(mod(gl_FragCoord.x, 4.0))] | ||||
| [int(mod(gl_FragCoord.y, 4.0))]; | [int(mod(gl_FragCoord.y, 4.0))]; | ||||
| #endif | #endif | ||||
| t += rand(gl_FragCoord.xy) - 0.5; | |||||
| t = (t + 0.5) / 17.0; | t = (t + 0.5) / 17.0; | ||||
| col.x += fract(t - col.x) - t; | col.x += fract(t - col.x) - t; | ||||
| col.y += fract(t - col.y) - t; | col.y += fract(t - col.y) - t; | ||||