1
- //652 chars
2
- //Apply material with shader to quad.
3
- //Compiled in Unity 2018.1.0f2
4
- //Author: Przemyslaw Zaworski
5
-
6
- Shader "I"
7
- {
8
- Subshader
9
- {
10
- Pass
11
- {
12
- Cull Off
1
+ //635 chars
2
+ //Apply material with shader to quad.
3
+ //Compiled in Unity 2018.1.0f2
4
+ //Author: Przemyslaw Zaworski
5
+
6
+ Shader "I"
7
+ {
8
+ Subshader
9
+ {
10
+ Pass
11
+ {
12
+ Cull Off
13
13
CGPROGRAM
14
- #pragma vertex V
15
- #pragma fragment P
16
-
17
- #define l lerp
18
-
19
- float f (float3 x)
20
- {
21
- float3 p = floor (x),f = smoothstep (0 ,1 ,frac (x)),n = {1 ,0 ,0 };
22
- #define h (m) frac (sin (dot (m,float3 (1 ,13 ,57 )))*1e5)
23
- 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);
24
- }
25
-
26
- void V (uint i:SV_VertexID ,out float4 c:SV_POSITION ) {c=float4 (((i<<1 )&2 )*2 .-1 ,-2 .*(i&2 )+1 ,.1 ,1 );}
27
-
28
- void P (float4 u:SV_POSITION , out float4 s:COLOR )
29
- {
30
- u = float4 (9 *u.xy/_ScreenParams ,_Time .g,0 );
31
- for (float i=0 ;i<1 ;i+=.02 ,u.y-=.1 ,u.w=(f (u)+f (u+9.5 ))*.5 ,s=l (s,u.w,smoothstep (0 ,1 ,(u.w-i)/fwidth (u.w)))){}
32
- }
33
-
34
- ENDCG
35
- }
36
- }
14
+ #pragma vertex V
15
+ #pragma fragment P
16
+
17
+ #define l lerp
18
+
19
+ half f (half3 x)
20
+ {
21
+ half3 p = floor (x),f = smoothstep (0 ,1 ,frac (x)),n = {1 ,0 ,0 };
22
+ #define h (m) frac (sin (dot (m,half3 (1 ,13 ,57 )))*1e5)
23
+ 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);
24
+ }
25
+
26
+ void V (uint i:SV_VertexID ,out half4 c:POSITION ) {c=half4 (((i<<1 )&2 )*2 .-1 ,-2 .*(i&2 )+1 ,.1 ,1 );}
27
+
28
+ void P (half4 u:POSITION , out half s:COLOR )
29
+ {
30
+ u = half4 (9 *u.xy/_ScreenParams ,_Time .g,0 );
31
+ for (half i=0 ;i<1 ;i+=.02 ,u.y-=.1 ,u.w=(f (u)+f (u+9.5 ))*.5 ,s=l (s,u.w,smoothstep (0 ,1 ,(u.w-i)/fwidth (u.w)))){}
32
+ }
33
+
34
+ ENDCG
35
+ }
36
+ }
37
37
}
0 commit comments