HandTriangles.shader 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License. See LICENSE in the project root for license information.
  3. /// <summary>
  4. /// Note, this shader is generated from a tool and is not formated for user readability.
  5. /// </summary>
  6. Shader "SDK/HandTriangles" {
  7. Properties {
  8. _scTime("SCTime",Range(0,3)) = 1.0
  9. [Header(Colors)]
  10. _Intensity_("Intensity", Range(0,5)) = 5
  11. _Fill_Color_("Fill Color", Color) = (0.317647,0.317647,0.317647,1)
  12. _Line_Color_("Line Color", Color) = (0.717647,0.717647,0.717647,1)
  13. [Toggle(USE_ALBEDO_TEXTURE)] USE_ALBEDO_TEXTURE("USE ALBEDO TEXTURE", Float) = 1
  14. [NoScaleOffset] _Color_Map_("Color Map", 2D) = "" {}
  15. _Vary_UV_("Vary UV", Range(0,1)) = 0.71
  16. _Vary_Color_("Vary Color", Range(0,1)) = 0.7
  17. _Desaturated_Intensity_("Desaturated Intensity", Range(0,1)) = 0
  18. [Header(Edges)]
  19. _Edge_Width_("Edge Width", Range(0,10)) = 1
  20. _Filter_Width_("Filter Width", Range(1,5)) = 1.5
  21. [Header(Pulse)]
  22. [Toggle] _Pulse_Enabled_("Pulse Enabled", Float) = 1
  23. _Pulse_("Pulse", Range(0,1)) = 0.346
  24. _Pulse_Width_("Pulse Width", Range(0,5)) = 1
  25. _Pulse_Outer_Size_("Pulse Outer Size", Range(0,2)) = 1.05
  26. _Pulse_Lead_Fuzz_("Pulse Lead Fuzz", Range(0,1)) = 0.67
  27. _Pulse_Tail_Fuzz_("Pulse Tail Fuzz", Range(0,1)) = 0.8
  28. _Pulse_Vary_("Pulse Vary", Range(0,1)) = 0.075
  29. _Pulse_Line_Fuzz_("Pulse Line Fuzz", Range(0.01,1)) = 0.2
  30. _Pulse_Noise_Frequency_("Pulse Noise Frequency", Range(0,2000)) = 777
  31. _Pulse_Origin_("Pulse Origin", Vector) = (0.5, 0, 0, 0)
  32. _Pulse_Color_Width_("Pulse Color Width", Range(0,1)) = 1
  33. _Pulse_Amplify_Leading_("Pulse Amplify Leading", Range(0,2)) = 0
  34. [Header(AutoPulse)]
  35. [Toggle] _Auto_Pulse_("Auto Pulse", Float) = 1
  36. _Period_("Period", Float) = 2.7
  37. [Header(Edge Timing)]
  38. _Line_End_Time_("Line End Time", Range(0,1)) = 0.5
  39. _Fill_Start_Time_("Fill Start Time", Range(0,1)) = 0.5
  40. [Header(Wrist Fade)]
  41. _Wrist_Fade_Start_("Wrist Fade Start", Range(0,1)) = 0.1
  42. _Wrist_Fade_End_("Wrist Fade End", Range(0,1)) = 0.16
  43. [Header(Flip V For Hydrogen)]
  44. [Toggle] _Flip_V_("Flip V", Float) = 0
  45. [Header(Fly)]
  46. _Max_Hover_("Max Hover", Range(0,1)) = 0.004
  47. _Max_In_Angle_("Max In Angle", Range(0,2)) = 0.6
  48. _Max_Out_Angle_("Max Out Angle", Range(0,2)) = 0.4
  49. }
  50. SubShader {
  51. Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
  52. Blend One One
  53. ZWrite Off
  54. Tags {"DisableBatching" = "True"}
  55. LOD 100
  56. Pass
  57. {
  58. CGPROGRAM
  59. #pragma vertex vertex_main
  60. #pragma fragment fragment_main
  61. #pragma geometry geometry_main
  62. #pragma multi_compile _ USE_ALBEDO_TEXTURE
  63. #include "UnityCG.cginc"
  64. float _Edge_Width_;
  65. float _Filter_Width_;
  66. bool _Flip_V_;
  67. float _Wrist_Fade_Start_;
  68. float _Wrist_Fade_End_;
  69. float _Intensity_;
  70. float4 _Fill_Color_;
  71. float4 _Line_Color_;
  72. //bool USE_ALBEDO_TEXTURE;
  73. sampler2D _Color_Map_;
  74. float _Vary_UV_;
  75. float _Vary_Color_;
  76. float _Desaturated_Intensity_;
  77. float _Line_End_Time_;
  78. float _Fill_Start_Time_;
  79. float _Max_Hover_;
  80. float _Max_In_Angle_;
  81. float _Max_Out_Angle_;
  82. bool _Pulse_Enabled_;
  83. float _Pulse_;
  84. float _Pulse_Width_;
  85. float _Pulse_Outer_Size_;
  86. float _Pulse_Lead_Fuzz_;
  87. float _Pulse_Tail_Fuzz_;
  88. float _Pulse_Vary_;
  89. float _Pulse_Line_Fuzz_;
  90. float _Pulse_Noise_Frequency_;
  91. float4 _Pulse_Origin_;
  92. float _Pulse_Color_Width_;
  93. float _Pulse_Amplify_Leading_;
  94. bool _Auto_Pulse_;
  95. float _Period_;
  96. struct VertexInput {
  97. float4 vertex : POSITION;
  98. float2 uv0 : TEXCOORD0;
  99. UNITY_VERTEX_INPUT_INSTANCE_ID
  100. };
  101. struct VertexOutput {
  102. float4 pos : SV_POSITION;
  103. float3 posWorld : TEXCOORD8;
  104. float2 uv : TEXCOORD0;
  105. UNITY_VERTEX_INPUT_INSTANCE_ID
  106. UNITY_VERTEX_OUTPUT_STEREO
  107. };
  108. struct FragmentInput {
  109. float4 pos : SV_POSITION;
  110. float3 posWorld : TEXCOORD8;
  111. float4 extra1 : TEXCOORD4;
  112. float4 extra2 : TEXCOORD5;
  113. float4 extra3 : TEXCOORD2;
  114. UNITY_VERTEX_OUTPUT_STEREO
  115. };
  116. #define Double_Sided 0
  117. #define Alpha_Blend 2
  118. #define No_Depth_Write 1
  119. #ifndef Geo_Max_Out_Vertices
  120. #define Geo_Max_Out_Vertices 16
  121. #endif
  122. FragmentInput vxOut[Geo_Max_Out_Vertices];
  123. int stripVxCount[Geo_Max_Out_Vertices];
  124. int vxOutCount;
  125. int stripCount;
  126. #define HUX_VIEW_TO_WORLD_DIR(V) (mul(transpose(UNITY_MATRIX_V), float4(V,0)).xyz)
  127. VertexOutput vertex_main(VertexInput v)
  128. {
  129. VertexOutput o;
  130. UNITY_SETUP_INSTANCE_ID(v);
  131. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  132. UNITY_TRANSFER_INSTANCE_ID(v, o);
  133. o.pos = UnityObjectToClipPos(v.vertex);
  134. float4 posWorld = mul(unity_ObjectToWorld, v.vertex);
  135. o.posWorld = posWorld.xyz;
  136. o.uv = v.uv0;
  137. return o;
  138. }
  139. #ifndef HUX_GEO_SET_UV
  140. #define HUX_GEO_SET_UV(A)
  141. #endif
  142. #ifndef HUX_GEO_SET_NORMAL
  143. #define HUX_GEO_SET_NORMAL(A)
  144. #endif
  145. #ifndef HUX_GEO_SET_TANGENT
  146. #define HUX_GEO_SET_TANGENT(A)
  147. #endif
  148. #ifndef HUX_GEO_SET_COLOR
  149. #define HUX_GEO_SET_COLOR(A)
  150. #endif
  151. #define HUX_GEO_SET_EXTRA1(A) vxOut[vxOutCount].extra1=A;
  152. #ifndef HUX_GEO_SET_EXTRA1
  153. #define HUX_GEO_SET_EXTRA1(A)
  154. #endif
  155. #define HUX_GEO_SET_EXTRA2(A) vxOut[vxOutCount].extra2=A;
  156. #ifndef HUX_GEO_SET_EXTRA2
  157. #define HUX_GEO_SET_EXTRA2(A)
  158. #endif
  159. #define HUX_GEO_SET_EXTRA3(A) vxOut[vxOutCount].extra3=A;
  160. #ifndef HUX_GEO_SET_EXTRA3
  161. #define HUX_GEO_SET_EXTRA3(A)
  162. #endif
  163. //BLOCK_BEGIN Emit_Triangle 177
  164. void emitVertex_Bid177(float3 P, float4 extra1, float4 C, float4 extra3)
  165. {
  166. vxOut[vxOutCount].posWorld=P; vxOut[vxOutCount].pos=mul(unity_MatrixVP, float4(P,1.0f));;
  167. HUX_GEO_SET_EXTRA1(extra1);
  168. HUX_GEO_SET_EXTRA2(C);
  169. HUX_GEO_SET_EXTRA3(extra3);
  170. vxOutCount+=1; stripVxCount[stripCount]+=1;
  171. }
  172. void Emit_Triangle_B177(
  173. bool Previous,
  174. float3 P1,
  175. float3 P2,
  176. float3 P3,
  177. float4 Extra1_1,
  178. float4 Extra1_2,
  179. float4 Extra1_3,
  180. float4 Color,
  181. float Wrist_1,
  182. float Wrist_2,
  183. float Wrist_3,
  184. float Transition,
  185. out bool Next )
  186. {
  187. float2 uv;
  188. float t = Transition>0.0 ? 1.0 : 0.0;
  189. float3 p2 = P1 + (P2-P1)*t;
  190. float3 p3 = P1 + (P3-P1)*t;
  191. uv = float2(0,0);
  192. emitVertex_Bid177(P1,Extra1_1,Color*Wrist_1,float4(1.0,0.0,0.0,0.0));
  193. uv = float2(1,0);
  194. emitVertex_Bid177(p2,Extra1_2,Color*Wrist_2,float4(0.0,1.0,0.0,0.0));
  195. uv = float2(0,1);
  196. emitVertex_Bid177(p3,Extra1_3,Color*Wrist_3,float4(0.0,0.0,1.0,0.0));
  197. stripCount+=1; stripVxCount[stripCount]=0;
  198. Next = Previous;
  199. }
  200. //BLOCK_END Emit_Triangle
  201. //BLOCK_BEGIN Fly 164
  202. float3 Rotate_Bid164(float A, float3 Center, float3 Axis, float3 XYZ)
  203. {
  204. float cosA = cos(A);
  205. float sinA = sin(A);
  206. float3 v = XYZ - Center;
  207. float ux = Axis.x;
  208. float uy = Axis.y;
  209. float uz = Axis.z;
  210. float r00 = cosA + ux*ux*(1-cosA);
  211. float r10 = uy*ux*(1-cosA)+uz*sinA;
  212. float r20 = uz*ux*(1-cosA)-uy*sinA;
  213. float r01 = ux*uy*(1-cosA)-uz*sinA;
  214. float r11 = cosA+uy*uy*(1-cosA);
  215. float r21 = uz*uy*(1-cosA)+ux*sinA;
  216. float r02 = ux*uz*(1-cosA)+uy*sinA;
  217. float r12 = uy*uz*(1-cosA)-ux*sinA;
  218. float r22 = cosA+uz*uz*(1-cosA);
  219. float rot_x = dot(v,float3(r00,r10,r20));
  220. float rot_y = dot(v,float3(r01,r11,r21));
  221. float rot_z = dot(v,float3(r02,r12,r22));
  222. return float3(rot_x,rot_y,rot_z) + Center;
  223. }
  224. void Fly_B164(
  225. float3 P0,
  226. float3 P1,
  227. float3 P2,
  228. float Transition,
  229. float Max_Hover,
  230. float Max_In_Angle,
  231. float Max_Out_Angle,
  232. float2 UV0,
  233. float2 UV1,
  234. float2 UV2,
  235. float2 PulseOrigin,
  236. float3 Nearest_P,
  237. bool Fading_Out,
  238. out float3 Q0,
  239. out float3 Q1,
  240. out float3 Q2 )
  241. {
  242. float3 N = normalize(cross(P1-P0,P2-P1));
  243. float k01 = dot(normalize((UV0+UV1)*0.5-PulseOrigin),normalize(UV1-UV0));
  244. float k12 = dot(normalize((UV1+UV2)*0.5-PulseOrigin),normalize(UV2-UV1));
  245. float k20 = dot(normalize((UV0+UV2)*0.5-PulseOrigin),normalize(UV2-UV0));
  246. float3 pulseDir = normalize( normalize(P1-P0)*k01+normalize(P2-P1)*k12 + normalize(P2-P0)*k20);
  247. float3 axis = normalize(cross(N,pulseDir));
  248. float3 center = Nearest_P; //(P0+P1+P2)/3.0;
  249. float angle, k;
  250. if (Fading_Out) {
  251. //float t = Transition<0.5 ? 2.0*(0.5-Transition)*(0.5-Transition) : 2.0*(0.5-Transition)*(0.5-Transition)+0.5;
  252. float t = smoothstep(0,1,Transition);
  253. angle = -Max_Out_Angle * (1.0-t);
  254. k = (1-t) * Max_Hover;
  255. } else {
  256. float t = smoothstep(0,1,Transition);
  257. // float t = Transition*Transition;
  258. angle = Max_In_Angle * (1.0-t);
  259. k = (1-Transition) * Max_Hover;
  260. }
  261. float3 p0 = Rotate_Bid164(angle,center,axis,P0);
  262. float3 p1 = Rotate_Bid164(angle,center,axis,P1);
  263. float3 p2 = Rotate_Bid164(angle,center,axis,P2);
  264. if (false) { ///(!Fading_Out) {
  265. float t = (Transition);
  266. p0 = Nearest_P + (p0-Nearest_P)*t;
  267. p1 = Nearest_P + (p1-Nearest_P)*t;
  268. p2 = Nearest_P + (p2-Nearest_P)*t;
  269. }
  270. Q0 = p0 + N * k;
  271. Q1 = p1 + N * k;
  272. Q2 = p2 + N * k;
  273. }
  274. //BLOCK_END Fly
  275. //BLOCK_BEGIN Find_Nearest 163
  276. void Find_Nearest_B163(
  277. float2 UV1,
  278. float2 UV2,
  279. float2 UV3,
  280. float2 Pulse_Origin,
  281. float Transition,
  282. bool FadingOut,
  283. float3 P1,
  284. float3 P2,
  285. float3 P3,
  286. out float4 Extra1_1,
  287. out float4 Extra1_2,
  288. out float4 Extra1_3,
  289. out float3 Nearest_P )
  290. {
  291. float d1 = distance(UV1,Pulse_Origin);
  292. float d2 = distance(UV2,Pulse_Origin);
  293. float d3 = distance(UV3,Pulse_Origin);
  294. Extra1_1 = float4(0.0,0.0,0.0,Transition);
  295. Extra1_2 = float4(0.0,0.0,0.0,Transition);
  296. Extra1_3 = float4(0.0,0.0,0.0,Transition);
  297. if (FadingOut) {
  298. if (d1>d2 && d1>d3) {
  299. Extra1_1.x=1.0;
  300. Nearest_P = P1;
  301. } else if (d2>d3) {
  302. Extra1_2.x=1.0;
  303. Nearest_P = P2;
  304. } else {
  305. Extra1_3.x=1.0;
  306. Nearest_P = P3;
  307. }
  308. } else {
  309. if (d1<d2 && d1<d3) {
  310. Nearest_P = P1;
  311. Extra1_1.x=1.0;
  312. } else if (d2<d3) {
  313. Extra1_2.x=1.0;
  314. Nearest_P = P2;
  315. } else {
  316. Extra1_3.x=1.0;
  317. Nearest_P = P3;
  318. }
  319. }
  320. }
  321. //BLOCK_END Find_Nearest
  322. //BLOCK_BEGIN Average 153
  323. void Average_B153(
  324. float2 A2,
  325. float2 B2,
  326. float2 C2,
  327. float3 P1,
  328. float3 P2,
  329. float3 P3,
  330. float Wrist_Start,
  331. float Wrist_End,
  332. out float2 Average,
  333. out float Wrist_1,
  334. out float Wrist_2,
  335. out float Wrist_3 )
  336. {
  337. Average = (A2 + B2 + C2) * (1.0/3.0);
  338. Wrist_1 = saturate((A2.y-Wrist_Start)/(Wrist_End-Wrist_Start));
  339. Wrist_2 = saturate((B2.y-Wrist_Start)/(Wrist_End-Wrist_Start));
  340. Wrist_3 = saturate((C2.y-Wrist_Start)/(Wrist_End-Wrist_Start));
  341. }
  342. //BLOCK_END Average
  343. //BLOCK_BEGIN Pulse 160
  344. float ramp_Bid160(float start, float end, float x)
  345. {
  346. // return saturate((x-start)/(end-start));
  347. return smoothstep(start,end,x);
  348. }
  349. void Pulse_B160(
  350. float Distance,
  351. float Noise,
  352. bool Pulse_Enabled,
  353. float Pulse,
  354. float Pulse_Width,
  355. float Pulse_Outer_Size,
  356. float Pulse_Lead_Fuzz,
  357. float Pulse_Tail_Fuzz,
  358. float Pulse_Vary,
  359. float Pulse_Saturation,
  360. out float Transition,
  361. out bool FadingOut,
  362. out float Saturation,
  363. out float Fade_Color )
  364. {
  365. Transition = 1.0;
  366. Saturation = 1.0;
  367. Fade_Color = 1.0;
  368. if (Pulse_Enabled) {
  369. float d = Distance - Pulse_Vary*Noise;
  370. float totalSize = Pulse_Outer_Size+Pulse_Vary+Pulse_Width;
  371. float pulseFront = Pulse * totalSize;
  372. float edge1 = pulseFront-Pulse_Width*0.5*Pulse_Lead_Fuzz;
  373. float fadeIn = saturate(1.0-ramp_Bid160(edge1,pulseFront,d));
  374. float fadeOut = saturate(1.0-ramp_Bid160(pulseFront-Pulse_Width,pulseFront-Pulse_Width+Pulse_Width*0.5*Pulse_Tail_Fuzz,d));
  375. Saturation = saturate(smoothstep(edge1-Pulse_Saturation,edge1,d));
  376. float clip = 1.0-step(Pulse_Outer_Size,d);
  377. Transition= saturate(fadeIn-fadeOut)*clip;
  378. FadingOut = fadeOut>0.0;
  379. Fade_Color = 1.0-fadeOut;
  380. }
  381. }
  382. //BLOCK_END Pulse
  383. //BLOCK_BEGIN Flip_V_For_Hydrogen 154
  384. void Flip_V_For_Hydrogen_B154(
  385. bool Flip_V,
  386. float2 UV_1,
  387. float2 UV_2,
  388. float2 UV_3,
  389. out float2 Out_UV_1,
  390. out float2 Out_UV_2,
  391. out float2 Out_UV_3 )
  392. {
  393. Out_UV_1 = Flip_V ? float2(UV_1.x,1.0-UV_1.y) : UV_1;
  394. Out_UV_2 = Flip_V ? float2(UV_2.x,1.0-UV_2.y) : UV_2;
  395. Out_UV_3 = Flip_V ? float2(UV_3.x,1.0-UV_3.y) : UV_3;
  396. }
  397. //BLOCK_END Flip_V_For_Hydrogen
  398. //BLOCK_BEGIN Cell_Noise_2D 150
  399. float2 mod289_Bid150(float2 x)
  400. {
  401. return x - floor(x * (1.0 / 289.0)) * 289.0;
  402. }
  403. float2 permute_Bid150(float2 x)
  404. {
  405. return mod289_Bid150(((x*float2(33.0,35.0))+1.0)*x);
  406. }
  407. float2 permuteB_Bid150(float2 x)
  408. {
  409. return mod289_Bid150(((x*float2(37.0,34.0))-1.0)*x);
  410. }
  411. void Cell_Noise_2D_B150(
  412. float2 XY,
  413. float Frequency,
  414. float Seed,
  415. out float Result )
  416. {
  417. float2 P = XY * float2(Frequency,Frequency)+float2(Seed,Seed);
  418. float2 Pi = floor(P);
  419. Pi = mod289_Bid150(Pi); // To avoid truncation effects in permutation
  420. float2 ix = Pi.xy;
  421. float2 iy = Pi.yx;
  422. float2 i = permute_Bid150(permuteB_Bid150(ix) + iy);
  423. Result = frac(i.x*(1.0/41.0)+i.y*(1.0/42.0));
  424. //Result = lerp(Out_Min, Out_Max, r);
  425. }
  426. //BLOCK_END Cell_Noise_2D
  427. //BLOCK_BEGIN Pt_Sample_Texture 157
  428. void Pt_Sample_Texture_B157(
  429. float2 UV,
  430. float Noise,
  431. sampler2D Texture,
  432. float Vary_UV,
  433. float Map_Intensity,
  434. out float4 Color )
  435. {
  436. float2 xy = UV + float2(Noise-0.5,Noise-0.5)*Vary_UV;
  437. Color = tex2D(Texture,xy,float2(0,0),float2(0,0))*Map_Intensity;
  438. }
  439. //BLOCK_END Pt_Sample_Texture
  440. //BLOCK_BEGIN AutoPulse 149
  441. void AutoPulse_B149(
  442. float Pulse,
  443. bool Auto_Pulse,
  444. float Period,
  445. float Time,
  446. out float Result )
  447. {
  448. if (Auto_Pulse) {
  449. Result = frac(Time/Period);
  450. } else {
  451. Result = Pulse;
  452. }
  453. }
  454. //BLOCK_END AutoPulse
  455. //BLOCK_BEGIN Cell_Noise_2D 151
  456. float2 mod289_Bid151(float2 x)
  457. {
  458. return x - floor(x * (1.0 / 289.0)) * 289.0;
  459. }
  460. float2 permute_Bid151(float2 x)
  461. {
  462. return mod289_Bid151(((x*float2(33.0,35.0))+1.0)*x);
  463. }
  464. float2 permuteB_Bid151(float2 x)
  465. {
  466. return mod289_Bid151(((x*float2(37.0,34.0))-1.0)*x);
  467. }
  468. void Cell_Noise_2D_B151(
  469. float2 XY,
  470. float Frequency,
  471. float Seed,
  472. out float Result )
  473. {
  474. float2 P = XY * float2(Frequency,Frequency)+float2(Seed,Seed);
  475. float2 Pi = floor(P);
  476. Pi = mod289_Bid151(Pi); // To avoid truncation effects in permutation
  477. float2 ix = Pi.xy;
  478. float2 iy = Pi.yx;
  479. float2 i = permute_Bid151(permuteB_Bid151(ix) + iy);
  480. Result = frac(i.x*(1.0/41.0)+i.y*(1.0/42.0));
  481. //Result = lerp(Out_Min, Out_Max, r);
  482. }
  483. //BLOCK_END Cell_Noise_2D
  484. float _scTime;
  485. [maxvertexcount(Geo_Max_Out_Vertices)]
  486. void geometry_main(triangle VertexOutput vxIn[3], inout TriangleStream<FragmentInput> triStream)
  487. {
  488. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(vxIn[0]);
  489. //huxEye = _WorldSpaceCameraPos;
  490. //workaround for Unity's auto updater in 5.6
  491. vxOutCount=0;
  492. stripCount=0;
  493. stripVxCount[0]=0;
  494. float2 Out_UV_1_Q154;
  495. float2 Out_UV_2_Q154;
  496. float2 Out_UV_3_Q154;
  497. Flip_V_For_Hydrogen_B154(_Flip_V_,vxIn[0].uv,vxIn[1].uv,vxIn[2].uv,Out_UV_1_Q154,Out_UV_2_Q154,Out_UV_3_Q154);
  498. float Result_Q149;
  499. AutoPulse_B149(_Pulse_,_Auto_Pulse_,_Period_, _scTime,Result_Q149);
  500. // To_XYZW
  501. float X_Q166;
  502. float Y_Q166;
  503. float Z_Q166;
  504. float W_Q166;
  505. X_Q166=_Pulse_Origin_.x;
  506. Y_Q166=_Pulse_Origin_.y;
  507. Z_Q166=_Pulse_Origin_.z;
  508. W_Q166=_Pulse_Origin_.w;
  509. float2 Average_Q153;
  510. float Wrist_1_Q153;
  511. float Wrist_2_Q153;
  512. float Wrist_3_Q153;
  513. Average_B153(Out_UV_1_Q154,Out_UV_2_Q154,Out_UV_3_Q154,vxIn[0].posWorld,vxIn[1].posWorld,vxIn[2].posWorld,_Wrist_Fade_Start_,_Wrist_Fade_End_,Average_Q153,Wrist_1_Q153,Wrist_2_Q153,Wrist_3_Q153);
  514. // From_XY
  515. float2 Vec2_Q167 = float2(X_Q166,Y_Q166);
  516. float Result_Q150;
  517. Cell_Noise_2D_B150(Average_Q153,_Pulse_Noise_Frequency_,111,Result_Q150);
  518. // Distance2
  519. float Distance_Q159 = distance(Average_Q153,Vec2_Q167);
  520. float Result_Q151;
  521. Cell_Noise_2D_B151(Average_Q153,_Pulse_Noise_Frequency_,333,Result_Q151);
  522. float Transition_Q160;
  523. bool FadingOut_Q160;
  524. float Saturation_Q160;
  525. float Fade_Color_Q160;
  526. Pulse_B160(Distance_Q159,Result_Q150,_Pulse_Enabled_,Result_Q149,_Pulse_Width_,_Pulse_Outer_Size_,_Pulse_Lead_Fuzz_,_Pulse_Tail_Fuzz_,_Pulse_Vary_,_Pulse_Color_Width_,Transition_Q160,FadingOut_Q160,Saturation_Q160,Fade_Color_Q160);
  527. float4 Color_Q157;
  528. #if defined(USE_ALBEDO_TEXTURE)
  529. Pt_Sample_Texture_B157(Average_Q153,Result_Q151,_Color_Map_,_Vary_UV_,1,Color_Q157);
  530. #else
  531. Color_Q157 = float4(1,1,1,1);
  532. #endif
  533. float4 Extra1_1_Q163;
  534. float4 Extra1_2_Q163;
  535. float4 Extra1_3_Q163;
  536. float3 Nearest_P_Q163;
  537. Find_Nearest_B163(Out_UV_1_Q154,Out_UV_2_Q154,Out_UV_3_Q154,Vec2_Q167,Transition_Q160,FadingOut_Q160,vxIn[0].posWorld,vxIn[1].posWorld,vxIn[2].posWorld,Extra1_1_Q163,Extra1_2_Q163,Extra1_3_Q163,Nearest_P_Q163);
  538. // Color
  539. float4 Result_Q161;
  540. float k = max(Color_Q157.r,max(Color_Q157.g,Color_Q157.b))*_Desaturated_Intensity_;
  541. Result_Q161 = lerp(float4(k,k,k,1),Color_Q157,float4(Saturation_Q160,Saturation_Q160,Saturation_Q160,Saturation_Q160))*(1.0-_Vary_Color_*Result_Q150)*Fade_Color_Q160;
  542. Result_Q161.rgb *= _Intensity_;
  543. float3 Q0_Q164;
  544. float3 Q1_Q164;
  545. float3 Q2_Q164;
  546. Fly_B164(vxIn[0].posWorld,vxIn[1].posWorld,vxIn[2].posWorld,Transition_Q160,_Max_Hover_,_Max_In_Angle_,_Max_Out_Angle_,Out_UV_1_Q154,Out_UV_2_Q154,Out_UV_3_Q154,Vec2_Q167,Nearest_P_Q163,FadingOut_Q160,Q0_Q164,Q1_Q164,Q2_Q164);
  547. bool Next_Q177;
  548. Emit_Triangle_B177(false,Q0_Q164,Q1_Q164,Q2_Q164,Extra1_1_Q163,Extra1_2_Q163,Extra1_3_Q163,Result_Q161,Wrist_1_Q153,Wrist_2_Q153,Wrist_3_Q153,Transition_Q160,Next_Q177);
  549. bool Root = Next_Q177;
  550. int vxix=0;
  551. int strip=0;
  552. [unroll]
  553. while (strip<stripCount) {
  554. int i=0;
  555. [unroll]
  556. while (i<stripVxCount[strip]) {
  557. //UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(vxOut[vxix]);
  558. UNITY_TRANSFER_VERTEX_OUTPUT_STEREO(vxIn[0],vxOut[vxix]);
  559. triStream.Append(vxOut[vxix]);
  560. i+=1; vxix+=1;
  561. }
  562. triStream.RestartStrip();
  563. strip+=1;
  564. }
  565. }
  566. //BLOCK_BEGIN Transition 171
  567. void Transition_B171(
  568. half Fuzz,
  569. half4 Fill_Color_Base,
  570. half4 Line_Color_Base,
  571. half4 V,
  572. half4 Transition,
  573. half Tip_Bump,
  574. half Line_End_Time,
  575. half Fill_Start_Time,
  576. out half4 Fill_Color,
  577. out half4 Line_Color )
  578. {
  579. float fillProgress = saturate((Transition.w-Fill_Start_Time)/(1.0-Fill_Start_Time));
  580. //float t = Transition.w*2.0;
  581. //float3 d = (V.xyz-float3(0.5,0.5,0.5))*2.0;
  582. //float fillTransition = max(0.0,t-1.0);
  583. Fill_Color.rgb = Fill_Color_Base.rgb * fillProgress; //* sqrt(dot(d,d))
  584. Fill_Color.a = fillProgress;
  585. float lineProgress = saturate(Transition.w/Line_End_Time);
  586. float Edge = 1.0-lineProgress;
  587. float k = Transition.x*(1.0-Fuzz)+Fuzz;
  588. float k2 = saturate(smoothstep(Edge, Edge+Fuzz, k));
  589. float lineFade = (1.0+Tip_Bump*sqrt(Edge))*k2; //lineProgress;
  590. Line_Color = Line_Color_Base * lineFade;
  591. }
  592. //BLOCK_END Transition
  593. //BLOCK_BEGIN Edges 168
  594. void Edges_B168(
  595. half Edge_Width,
  596. half Filter_Width,
  597. half4 Edges,
  598. out half inLine )
  599. {
  600. float3 fw = Filter_Width*fwidth(Edges.xyz)*max(Edge_Width,1.0);
  601. float3 a = smoothstep(float3(0.0,0.0,0.0),fw,Edges.xyz);
  602. inLine = (1.0-min(a.x,min(a.y,a.z)))*min(Edge_Width,1.0);
  603. }
  604. //BLOCK_END Edges
  605. //BLOCK_BEGIN Split_Color_Alpha 172
  606. void Split_Color_Alpha_B172(
  607. half4 Vector4,
  608. out half4 Color,
  609. out half Alpha )
  610. {
  611. Color = Vector4;
  612. Alpha = Vector4.w;
  613. }
  614. //BLOCK_END Split_Color_Alpha
  615. fixed4 fragment_main(FragmentInput fragInput) : SV_Target
  616. {
  617. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(fragInput);
  618. float4 result;
  619. half inLine_Q168;
  620. Edges_B168(_Edge_Width_,_Filter_Width_,fragInput.extra3,inLine_Q168);
  621. half4 Color_Q172;
  622. half Alpha_Q172;
  623. Split_Color_Alpha_B172(fragInput.extra2,Color_Q172,Alpha_Q172);
  624. // Multiply_Colors
  625. half4 Product_Q170 = _Fill_Color_ * Color_Q172;
  626. // Scale_Color
  627. half4 Result_Q169 = Alpha_Q172 * _Line_Color_;
  628. half4 Fill_Color_Q171;
  629. half4 Line_Color_Q171;
  630. Transition_B171(_Pulse_Line_Fuzz_,Product_Q170,Result_Q169,fragInput.extra3,fragInput.extra1,_Pulse_Amplify_Leading_,_Line_End_Time_,_Fill_Start_Time_,Fill_Color_Q171,Line_Color_Q171);
  631. // Mix_Colors
  632. half4 Color_At_T_Q173 = lerp(Fill_Color_Q171, Line_Color_Q171,float4( inLine_Q168, inLine_Q168, inLine_Q168, inLine_Q168));
  633. float4 Out_Color = Color_At_T_Q173;
  634. float Clip_Threshold = 0.00;
  635. bool To_sRGB = false;
  636. result = Out_Color;
  637. float clipVal = (Out_Color.a<Clip_Threshold) ? -1 : 1;
  638. clip(clipVal);
  639. return result;
  640. }
  641. ENDCG
  642. }
  643. }
  644. FallBack "SDK/Standard"
  645. }