-
Notifications
You must be signed in to change notification settings - Fork 223
/
I.shader
37 lines (31 loc) · 848 Bytes
/
I.shader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//620 chars
//Apply material with shader to quad.
//Compiled in Unity 2018.1.0f2
//Author: Przemyslaw Zaworski
Shader "I"
{
Subshader
{
Pass
{
Cull Off
CGPROGRAM
#pragma vertex V
#pragma fragment P
#define l lerp
half k(half3 x)
{
half3 p=x-frac(x), f=x-p, n={1,0,0}, t={1,9,57}; f*=f*(3-2*f);
#define h(m) frac(cos(dot(m,t))*1e5)
return l(l(l(h(p),h(p+n.xyy),f.x),l(h(p+n.yxy),h(p+n.xxy),f.x),f.y),l(l(h(p+n.yyx),h(p+n.xyx),f.x),l(h(p+n.yxx),h(p+1),f.x),f.y),f.z);
}
void V(uint i:SV_VertexID,out half4 c:POSITION) {c=half4((i<<1&2)*2-1.,1-2.*(i&2),1,1);}
void P(half4 u:POSITION,out half s:COLOR)
{
u = half4(9*u.xy/_ScreenParams,_Time.g,0);
for (half i;i<1;i+=.02,u.y-=.1,u.w=(k(u)+k(u+9.5))/2,s=l(s,u.w,smoothstep(0,1,(u.w-i)/fwidth(u.w)))){}
}
ENDCG
}
}
}