app.hypergames.hypersdk 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/.github/workflows/check-sync.yml +0 -2
  2. package/CHANGELOG.md +9 -0
  3. package/dev-hypersdk/Assets/Editor/HyperSDKSyncTool.cs +0 -1
  4. package/package.json +1 -1
  5. package/upm-hypersdk/app.hypergames.hypersdk/Resources/DOTweenSettings.asset +0 -54
  6. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Fonts/LiberationSans - OFL.txt +0 -46
  7. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Fonts/LiberationSans.ttf +0 -0
  8. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat +0 -106
  9. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset +0 -348
  10. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat +0 -104
  11. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset +0 -7821
  12. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Resources/LineBreaking Following Characters.txt +0 -1
  13. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Resources/LineBreaking Leading Characters.txt +0 -1
  14. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset +0 -659
  15. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset +0 -81
  16. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Resources/TMP Settings.asset +0 -52
  17. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/SDFFunctions.hlsl +0 -178
  18. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_Bitmap-Custom-Atlas.shader +0 -145
  19. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_Bitmap-Mobile.shader +0 -155
  20. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_Bitmap.shader +0 -145
  21. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF Overlay.shader +0 -326
  22. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF SSD.shader +0 -321
  23. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF-HDRP LIT.shadergraph +0 -12074
  24. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF-HDRP UNLIT.shadergraph +0 -11759
  25. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF-Mobile Masking.shader +0 -258
  26. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF-Mobile Overlay.shader +0 -252
  27. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF-Mobile SSD.shader +0 -106
  28. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF-Mobile-2-Pass.shader +0 -389
  29. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF-Mobile.shader +0 -250
  30. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF-Surface-Mobile.shader +0 -139
  31. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF-Surface.shader +0 -159
  32. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF-URP Lit.shadergraph +0 -11932
  33. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF-URP Unlit.shadergraph +0 -11629
  34. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_SDF.shader +0 -326
  35. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMP_Sprite.shader +0 -131
  36. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMPro.cginc +0 -84
  37. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMPro_Mobile.cginc +0 -165
  38. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMPro_Properties.cginc +0 -80
  39. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Shaders/TMPro_Surface.cginc +0 -99
  40. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Sprites/EmojiOne Attribution.txt +0 -3
  41. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Sprites/EmojiOne.json +0 -156
  42. package/upm-hypersdk/app.hypergames.hypersdk/Resources/TextMesh Pro/Sprites/EmojiOne.png +0 -0
@@ -1,326 +0,0 @@
1
- Shader "TextMeshPro/Distance Field" {
2
-
3
- Properties {
4
- _FaceTex ("Face Texture", 2D) = "white" {}
5
- _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0
6
- _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0
7
- _FaceColor ("Face Color", Color) = (1,1,1,1)
8
- _FaceDilate ("Face Dilate", Range(-1,1)) = 0
9
-
10
- _OutlineColor ("Outline Color", Color) = (0,0,0,1)
11
- _OutlineTex ("Outline Texture", 2D) = "white" {}
12
- _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0
13
- _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0
14
- _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0
15
- _OutlineSoftness ("Outline Softness", Range(0,1)) = 0
16
-
17
- _Bevel ("Bevel", Range(0,1)) = 0.5
18
- _BevelOffset ("Bevel Offset", Range(-0.5,0.5)) = 0
19
- _BevelWidth ("Bevel Width", Range(-.5,0.5)) = 0
20
- _BevelClamp ("Bevel Clamp", Range(0,1)) = 0
21
- _BevelRoundness ("Bevel Roundness", Range(0,1)) = 0
22
-
23
- _LightAngle ("Light Angle", Range(0.0, 6.2831853)) = 3.1416
24
- _SpecularColor ("Specular", Color) = (1,1,1,1)
25
- _SpecularPower ("Specular", Range(0,4)) = 2.0
26
- _Reflectivity ("Reflectivity", Range(5.0,15.0)) = 10
27
- _Diffuse ("Diffuse", Range(0,1)) = 0.5
28
- _Ambient ("Ambient", Range(1,0)) = 0.5
29
-
30
- _BumpMap ("Normal map", 2D) = "bump" {}
31
- _BumpOutline ("Bump Outline", Range(0,1)) = 0
32
- _BumpFace ("Bump Face", Range(0,1)) = 0
33
-
34
- _ReflectFaceColor ("Reflection Color", Color) = (0,0,0,1)
35
- _ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1)
36
- _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ }
37
- _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0)
38
-
39
-
40
- _UnderlayColor ("Border Color", Color) = (0,0,0, 0.5)
41
- _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0
42
- _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0
43
- _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0
44
- _UnderlaySoftness ("Border Softness", Range(0,1)) = 0
45
-
46
- _GlowColor ("Color", Color) = (0, 1, 0, 0.5)
47
- _GlowOffset ("Offset", Range(-1,1)) = 0
48
- _GlowInner ("Inner", Range(0,1)) = 0.05
49
- _GlowOuter ("Outer", Range(0,1)) = 0.05
50
- _GlowPower ("Falloff", Range(1, 0)) = 0.75
51
-
52
- _WeightNormal ("Weight Normal", float) = 0
53
- _WeightBold ("Weight Bold", float) = 0.5
54
-
55
- _ShaderFlags ("Flags", float) = 0
56
- _ScaleRatioA ("Scale RatioA", float) = 1
57
- _ScaleRatioB ("Scale RatioB", float) = 1
58
- _ScaleRatioC ("Scale RatioC", float) = 1
59
-
60
- _MainTex ("Font Atlas", 2D) = "white" {}
61
- _TextureWidth ("Texture Width", float) = 512
62
- _TextureHeight ("Texture Height", float) = 512
63
- _GradientScale ("Gradient Scale", float) = 5.0
64
- _ScaleX ("Scale X", float) = 1.0
65
- _ScaleY ("Scale Y", float) = 1.0
66
- _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875
67
- _Sharpness ("Sharpness", Range(-1,1)) = 0
68
-
69
- _VertexOffsetX ("Vertex OffsetX", float) = 0
70
- _VertexOffsetY ("Vertex OffsetY", float) = 0
71
-
72
- _MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767)
73
- _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
74
- _MaskSoftnessX ("Mask SoftnessX", float) = 0
75
- _MaskSoftnessY ("Mask SoftnessY", float) = 0
76
-
77
- _StencilComp ("Stencil Comparison", Float) = 8
78
- _Stencil ("Stencil ID", Float) = 0
79
- _StencilOp ("Stencil Operation", Float) = 0
80
- _StencilWriteMask ("Stencil Write Mask", Float) = 255
81
- _StencilReadMask ("Stencil Read Mask", Float) = 255
82
-
83
- _CullMode ("Cull Mode", Float) = 0
84
- _ColorMask ("Color Mask", Float) = 15
85
- }
86
-
87
- SubShader {
88
-
89
- Tags
90
- {
91
- "Queue"="Transparent"
92
- "IgnoreProjector"="True"
93
- "RenderType"="Transparent"
94
- }
95
-
96
- Stencil
97
- {
98
- Ref [_Stencil]
99
- Comp [_StencilComp]
100
- Pass [_StencilOp]
101
- ReadMask [_StencilReadMask]
102
- WriteMask [_StencilWriteMask]
103
- }
104
-
105
- Cull [_CullMode]
106
- ZWrite Off
107
- Lighting Off
108
- Fog { Mode Off }
109
- ZTest [unity_GUIZTestMode]
110
- Blend One OneMinusSrcAlpha
111
- ColorMask [_ColorMask]
112
-
113
- Pass {
114
- CGPROGRAM
115
- #pragma target 3.0
116
- #pragma vertex VertShader
117
- #pragma fragment PixShader
118
- #pragma shader_feature __ BEVEL_ON
119
- #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER
120
- #pragma shader_feature __ GLOW_ON
121
-
122
- #pragma multi_compile __ UNITY_UI_CLIP_RECT
123
- #pragma multi_compile __ UNITY_UI_ALPHACLIP
124
-
125
- #include "UnityCG.cginc"
126
- #include "UnityUI.cginc"
127
- #include "TMPro_Properties.cginc"
128
- #include "TMPro.cginc"
129
-
130
- struct vertex_t
131
- {
132
- UNITY_VERTEX_INPUT_INSTANCE_ID
133
- float4 position : POSITION;
134
- float3 normal : NORMAL;
135
- fixed4 color : COLOR;
136
- float4 texcoord0 : TEXCOORD0;
137
- float2 texcoord1 : TEXCOORD1;
138
- };
139
-
140
- struct pixel_t
141
- {
142
- UNITY_VERTEX_INPUT_INSTANCE_ID
143
- UNITY_VERTEX_OUTPUT_STEREO
144
- float4 position : SV_POSITION;
145
- fixed4 color : COLOR;
146
- float2 atlas : TEXCOORD0; // Atlas
147
- float4 param : TEXCOORD1; // alphaClip, scale, bias, weight
148
- float4 mask : TEXCOORD2; // Position in object space(xy), pixel Size(zw)
149
- float3 viewDir : TEXCOORD3;
150
-
151
- #if (UNDERLAY_ON || UNDERLAY_INNER)
152
- float4 texcoord2 : TEXCOORD4; // u,v, scale, bias
153
- fixed4 underlayColor : COLOR1;
154
- #endif
155
-
156
- float4 textures : TEXCOORD5;
157
- };
158
-
159
- // Used by Unity internally to handle Texture Tiling and Offset.
160
- float4 _FaceTex_ST;
161
- float4 _OutlineTex_ST;
162
- float _UIMaskSoftnessX;
163
- float _UIMaskSoftnessY;
164
- int _UIVertexColorAlwaysGammaSpace;
165
-
166
- pixel_t VertShader(vertex_t input)
167
- {
168
- pixel_t output;
169
-
170
- UNITY_INITIALIZE_OUTPUT(pixel_t, output);
171
- UNITY_SETUP_INSTANCE_ID(input);
172
- UNITY_TRANSFER_INSTANCE_ID(input,output);
173
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
174
-
175
- float bold = step(input.texcoord0.w, 0);
176
-
177
- float4 vert = input.position;
178
- vert.x += _VertexOffsetX;
179
- vert.y += _VertexOffsetY;
180
-
181
- float4 vPosition = UnityObjectToClipPos(vert);
182
-
183
- float2 pixelSize = vPosition.w;
184
- pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
185
- float scale = rsqrt(dot(pixelSize, pixelSize));
186
- scale *= abs(input.texcoord0.w) * _GradientScale * (_Sharpness + 1);
187
- if (UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert)))));
188
-
189
- float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0;
190
- weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5;
191
-
192
- float bias =(.5 - weight) + (.5 / scale);
193
-
194
- float alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _OutlineSoftness * _ScaleRatioA);
195
-
196
- #if GLOW_ON
197
- alphaClip = min(alphaClip, 1.0 - _GlowOffset * _ScaleRatioB - _GlowOuter * _ScaleRatioB);
198
- #endif
199
-
200
- alphaClip = alphaClip / 2.0 - ( .5 / scale) - weight;
201
-
202
- #if (UNDERLAY_ON || UNDERLAY_INNER)
203
- float4 underlayColor = _UnderlayColor;
204
- underlayColor.rgb *= underlayColor.a;
205
-
206
- float bScale = scale;
207
- bScale /= 1 + ((_UnderlaySoftness*_ScaleRatioC) * bScale);
208
- float bBias = (0.5 - weight) * bScale - 0.5 - ((_UnderlayDilate * _ScaleRatioC) * 0.5 * bScale);
209
-
210
- float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth;
211
- float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight;
212
- float2 bOffset = float2(x, y);
213
- #endif
214
-
215
- // Generate UV for the Masking Texture
216
- float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
217
- float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy);
218
-
219
- // Support for texture tiling and offset
220
- float2 textureUV = input.texcoord1;
221
- float2 faceUV = TRANSFORM_TEX(textureUV, _FaceTex);
222
- float2 outlineUV = TRANSFORM_TEX(textureUV, _OutlineTex);
223
-
224
-
225
- if (_UIVertexColorAlwaysGammaSpace && !IsGammaSpace())
226
- {
227
- input.color.rgb = UIGammaToLinear(input.color.rgb);
228
- }
229
- output.position = vPosition;
230
- output.color = input.color;
231
- output.atlas = input.texcoord0;
232
- output.param = float4(alphaClip, scale, bias, weight);
233
- const half2 maskSoftness = half2(max(_UIMaskSoftnessX, _MaskSoftnessX), max(_UIMaskSoftnessY, _MaskSoftnessY));
234
- output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * maskSoftness + pixelSize.xy));
235
- output.viewDir = mul((float3x3)_EnvMatrix, _WorldSpaceCameraPos.xyz - mul(unity_ObjectToWorld, vert).xyz);
236
- #if (UNDERLAY_ON || UNDERLAY_INNER)
237
- output.texcoord2 = float4(input.texcoord0 + bOffset, bScale, bBias);
238
- output.underlayColor = underlayColor;
239
- #endif
240
- output.textures = float4(faceUV, outlineUV);
241
-
242
- return output;
243
- }
244
-
245
-
246
- fixed4 PixShader(pixel_t input) : SV_Target
247
- {
248
- UNITY_SETUP_INSTANCE_ID(input);
249
-
250
- float c = tex2D(_MainTex, input.atlas).a;
251
-
252
- #ifndef UNDERLAY_ON
253
- clip(c - input.param.x);
254
- #endif
255
-
256
- float scale = input.param.y;
257
- float bias = input.param.z;
258
- float weight = input.param.w;
259
- float sd = (bias - c) * scale;
260
-
261
- float outline = (_OutlineWidth * _ScaleRatioA) * scale;
262
- float softness = (_OutlineSoftness * _ScaleRatioA) * scale;
263
-
264
- half4 faceColor = _FaceColor;
265
- half4 outlineColor = _OutlineColor;
266
-
267
- faceColor.rgb *= input.color.rgb;
268
-
269
- faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y);
270
- outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y);
271
-
272
- faceColor = GetColor(sd, faceColor, outlineColor, outline, softness);
273
-
274
- #if BEVEL_ON
275
- float3 dxy = float3(0.5 / _TextureWidth, 0.5 / _TextureHeight, 0);
276
- float3 n = GetSurfaceNormal(input.atlas, weight, dxy);
277
-
278
- float3 bump = UnpackNormal(tex2D(_BumpMap, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y)).xyz;
279
- bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5));
280
- n = normalize(n- bump);
281
-
282
- float3 light = normalize(float3(sin(_LightAngle), cos(_LightAngle), -1.0));
283
-
284
- float3 col = GetSpecular(n, light);
285
- faceColor.rgb += col*faceColor.a;
286
- faceColor.rgb *= 1-(dot(n, light)*_Diffuse);
287
- faceColor.rgb *= lerp(_Ambient, 1, n.z*n.z);
288
-
289
- fixed4 reflcol = texCUBE(_Cube, reflect(input.viewDir, -n));
290
- faceColor.rgb += reflcol.rgb * lerp(_ReflectFaceColor.rgb, _ReflectOutlineColor.rgb, saturate(sd + outline * 0.5)) * faceColor.a;
291
- #endif
292
-
293
- #if UNDERLAY_ON
294
- float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z;
295
- faceColor += input.underlayColor * saturate(d - input.texcoord2.w) * (1 - faceColor.a);
296
- #endif
297
-
298
- #if UNDERLAY_INNER
299
- float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z;
300
- faceColor += input.underlayColor * (1 - saturate(d - input.texcoord2.w)) * saturate(1 - sd) * (1 - faceColor.a);
301
- #endif
302
-
303
- #if GLOW_ON
304
- float4 glowColor = GetGlowColor(sd, scale);
305
- faceColor.rgb += glowColor.rgb * glowColor.a;
306
- #endif
307
-
308
- // Alternative implementation to UnityGet2DClipping with support for softness.
309
- #if UNITY_UI_CLIP_RECT
310
- half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw);
311
- faceColor *= m.x * m.y;
312
- #endif
313
-
314
- #if UNITY_UI_ALPHACLIP
315
- clip(faceColor.a - 0.001);
316
- #endif
317
-
318
- return faceColor * input.color.a;
319
- }
320
- ENDCG
321
- }
322
- }
323
-
324
- Fallback "TextMeshPro/Mobile/Distance Field"
325
- CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI"
326
- }
@@ -1,131 +0,0 @@
1
- Shader "TextMeshPro/Sprite"
2
- {
3
- Properties
4
- {
5
- _MainTex ("Sprite Texture", 2D) = "white" {}
6
- _Color ("Tint", Color) = (1,1,1,1)
7
-
8
- _StencilComp ("Stencil Comparison", Float) = 8
9
- _Stencil ("Stencil ID", Float) = 0
10
- _StencilOp ("Stencil Operation", Float) = 0
11
- _StencilWriteMask ("Stencil Write Mask", Float) = 255
12
- _StencilReadMask ("Stencil Read Mask", Float) = 255
13
-
14
- _CullMode ("Cull Mode", Float) = 0
15
- _ColorMask ("Color Mask", Float) = 15
16
- _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
17
-
18
- [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
19
- }
20
-
21
- SubShader
22
- {
23
- Tags
24
- {
25
- "Queue"="Transparent"
26
- "IgnoreProjector"="True"
27
- "RenderType"="Transparent"
28
- "PreviewType"="Plane"
29
- "CanUseSpriteAtlas"="True"
30
- }
31
-
32
- Stencil
33
- {
34
- Ref [_Stencil]
35
- Comp [_StencilComp]
36
- Pass [_StencilOp]
37
- ReadMask [_StencilReadMask]
38
- WriteMask [_StencilWriteMask]
39
- }
40
-
41
- Cull [_CullMode]
42
- Lighting Off
43
- ZWrite Off
44
- ZTest [unity_GUIZTestMode]
45
- Blend SrcAlpha OneMinusSrcAlpha
46
- ColorMask [_ColorMask]
47
-
48
- Pass
49
- {
50
- Name "Default"
51
- CGPROGRAM
52
- #pragma vertex vert
53
- #pragma fragment frag
54
- #pragma target 2.0
55
-
56
- #include "UnityCG.cginc"
57
- #include "UnityUI.cginc"
58
-
59
- #pragma multi_compile __ UNITY_UI_CLIP_RECT
60
- #pragma multi_compile __ UNITY_UI_ALPHACLIP
61
-
62
- struct appdata_t
63
- {
64
- float4 vertex : POSITION;
65
- float4 color : COLOR;
66
- float2 texcoord : TEXCOORD0;
67
- UNITY_VERTEX_INPUT_INSTANCE_ID
68
- };
69
-
70
- struct v2f
71
- {
72
- float4 vertex : SV_POSITION;
73
- fixed4 color : COLOR;
74
- float2 texcoord : TEXCOORD0;
75
- float4 worldPosition : TEXCOORD1;
76
- float4 mask : TEXCOORD2;
77
- UNITY_VERTEX_OUTPUT_STEREO
78
- };
79
-
80
- sampler2D _MainTex;
81
- fixed4 _Color;
82
- fixed4 _TextureSampleAdd;
83
- float4 _ClipRect;
84
- float4 _MainTex_ST;
85
- float _UIMaskSoftnessX;
86
- float _UIMaskSoftnessY;
87
- int _UIVertexColorAlwaysGammaSpace;
88
-
89
- v2f vert(appdata_t v)
90
- {
91
- v2f OUT;
92
- UNITY_SETUP_INSTANCE_ID(v);
93
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
94
- float4 vPosition = UnityObjectToClipPos(v.vertex);
95
- OUT.worldPosition = v.vertex;
96
- OUT.vertex = vPosition;
97
-
98
- float2 pixelSize = vPosition.w;
99
- pixelSize /= abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
100
-
101
- float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
102
- OUT.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
103
- OUT.mask = half4(v.vertex.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_UIMaskSoftnessX, _UIMaskSoftnessY) + abs(pixelSize.xy)));
104
-
105
- if (_UIVertexColorAlwaysGammaSpace && !IsGammaSpace())
106
- {
107
- v.color.rgb = UIGammaToLinear(v.color.rgb);
108
- }
109
- OUT.color = v.color * _Color;
110
- return OUT;
111
- }
112
-
113
- fixed4 frag(v2f IN) : SV_Target
114
- {
115
- half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
116
-
117
- #if UNITY_UI_CLIP_RECT
118
- half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw);
119
- color *= m.x * m.y;
120
- #endif
121
-
122
- #ifdef UNITY_UI_ALPHACLIP
123
- clip (color.a - 0.001);
124
- #endif
125
-
126
- return color;
127
- }
128
- ENDCG
129
- }
130
- }
131
- }
@@ -1,84 +0,0 @@
1
- float2 UnpackUV(float uv)
2
- {
3
- float2 output;
4
- output.x = floor(uv / 4096);
5
- output.y = uv - 4096 * output.x;
6
-
7
- return output * 0.001953125;
8
- }
9
-
10
- fixed4 GetColor(half d, fixed4 faceColor, fixed4 outlineColor, half outline, half softness)
11
- {
12
- half faceAlpha = 1-saturate((d - outline * 0.5 + softness * 0.5) / (1.0 + softness));
13
- half outlineAlpha = saturate((d + outline * 0.5)) * sqrt(min(1.0, outline));
14
-
15
- faceColor.rgb *= faceColor.a;
16
- outlineColor.rgb *= outlineColor.a;
17
-
18
- faceColor = lerp(faceColor, outlineColor, outlineAlpha);
19
-
20
- faceColor *= faceAlpha;
21
-
22
- return faceColor;
23
- }
24
-
25
- float3 GetSurfaceNormal(float4 h, float bias)
26
- {
27
- bool raisedBevel = step(1, fmod(_ShaderFlags, 2));
28
-
29
- h += bias+_BevelOffset;
30
-
31
- float bevelWidth = max(.01, _OutlineWidth+_BevelWidth);
32
-
33
- // Track outline
34
- h -= .5;
35
- h /= bevelWidth;
36
- h = saturate(h+.5);
37
-
38
- if(raisedBevel) h = 1 - abs(h*2.0 - 1.0);
39
- h = lerp(h, sin(h*3.141592/2.0), _BevelRoundness);
40
- h = min(h, 1.0-_BevelClamp);
41
- h *= _Bevel * bevelWidth * _GradientScale * -2.0;
42
-
43
- float3 va = normalize(float3(1.0, 0.0, h.y - h.x));
44
- float3 vb = normalize(float3(0.0, -1.0, h.w - h.z));
45
-
46
- return cross(va, vb);
47
- }
48
-
49
- float3 GetSurfaceNormal(float2 uv, float bias, float3 delta)
50
- {
51
- // Read "height field"
52
- float4 h = {tex2D(_MainTex, uv - delta.xz).a,
53
- tex2D(_MainTex, uv + delta.xz).a,
54
- tex2D(_MainTex, uv - delta.zy).a,
55
- tex2D(_MainTex, uv + delta.zy).a};
56
-
57
- return GetSurfaceNormal(h, bias);
58
- }
59
-
60
- float3 GetSpecular(float3 n, float3 l)
61
- {
62
- float spec = pow(max(0.0, dot(n, l)), _Reflectivity);
63
- return _SpecularColor.rgb * spec * _SpecularPower;
64
- }
65
-
66
- float4 GetGlowColor(float d, float scale)
67
- {
68
- float glow = d - (_GlowOffset*_ScaleRatioB) * 0.5 * scale;
69
- float t = lerp(_GlowInner, (_GlowOuter * _ScaleRatioB), step(0.0, glow)) * 0.5 * scale;
70
- glow = saturate(abs(glow/(1.0 + t)));
71
- glow = 1.0-pow(glow, _GlowPower);
72
- glow *= sqrt(min(1.0, t)); // Fade off glow thinner than 1 screen pixel
73
- return float4(_GlowColor.rgb, saturate(_GlowColor.a * glow * 2));
74
- }
75
-
76
- float4 BlendARGB(float4 overlying, float4 underlying)
77
- {
78
- overlying.rgb *= overlying.a;
79
- underlying.rgb *= underlying.a;
80
- float3 blended = overlying.rgb + ((1-overlying.a)*underlying.rgb);
81
- float alpha = underlying.a + (1-underlying.a)*overlying.a;
82
- return float4(blended, alpha);
83
- }
84
-
@@ -1,165 +0,0 @@
1
- struct vertex_t
2
- {
3
- UNITY_VERTEX_INPUT_INSTANCE_ID
4
- float4 position : POSITION;
5
- float3 normal : NORMAL;
6
- float4 color : COLOR;
7
- float4 texcoord0 : TEXCOORD0;
8
- float2 texcoord1 : TEXCOORD1;
9
- };
10
-
11
- struct pixel_t
12
- {
13
- UNITY_VERTEX_INPUT_INSTANCE_ID
14
- UNITY_VERTEX_OUTPUT_STEREO
15
- float4 position : SV_POSITION;
16
- float4 faceColor : COLOR;
17
- float4 outlineColor : COLOR1;
18
- float4 texcoord0 : TEXCOORD0;
19
- float4 param : TEXCOORD1; // x = weight, y = no longer used
20
- float2 mask : TEXCOORD2;
21
- #if (UNDERLAY_ON || UNDERLAY_INNER)
22
- float4 texcoord2 : TEXCOORD3;
23
- float4 underlayColor : COLOR2;
24
- #endif
25
- };
26
-
27
- float4 SRGBToLinear(float4 rgba)
28
- {
29
- return float4(lerp(rgba.rgb / 12.92f, pow((rgba.rgb + 0.055f) / 1.055f, 2.4f), step(0.04045f, rgba.rgb)), rgba.a);
30
- }
31
-
32
- float _UIMaskSoftnessX;
33
- float _UIMaskSoftnessY;
34
-
35
- pixel_t VertShader(vertex_t input)
36
- {
37
- pixel_t output;
38
-
39
- UNITY_INITIALIZE_OUTPUT(pixel_t, output);
40
- UNITY_SETUP_INSTANCE_ID(input);
41
- UNITY_TRANSFER_INSTANCE_ID(input, output);
42
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
43
-
44
- float bold = step(input.texcoord0.w, 0);
45
-
46
- float4 vert = input.position;
47
- vert.x += _VertexOffsetX;
48
- vert.y += _VertexOffsetY;
49
-
50
- float4 vPosition = UnityObjectToClipPos(vert);
51
-
52
- float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0;
53
- weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5;
54
-
55
- // Generate UV for the Masking Texture
56
- float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
57
- float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy);
58
-
59
- float4 color = input.color;
60
- #if (FORCE_LINEAR && !UNITY_COLORSPACE_GAMMA)
61
- color = SRGBToLinear(input.color);
62
- #endif
63
-
64
- float opacity = color.a;
65
- #if (UNDERLAY_ON | UNDERLAY_INNER)
66
- opacity = 1.0;
67
- #endif
68
-
69
- float4 faceColor = float4(color.rgb, opacity) * _FaceColor;
70
- faceColor.rgb *= faceColor.a;
71
-
72
- float4 outlineColor = _OutlineColor;
73
- outlineColor.a *= opacity;
74
- outlineColor.rgb *= outlineColor.a;
75
-
76
- output.position = vPosition;
77
- output.faceColor = faceColor;
78
- output.outlineColor = outlineColor;
79
- output.texcoord0 = float4(input.texcoord0.xy, maskUV.xy);
80
- output.param = float4(0.5 - weight, 0, _OutlineWidth * _ScaleRatioA * 0.5, 0);
81
-
82
- float2 mask = float2(0, 0);
83
- #if UNITY_UI_CLIP_RECT
84
- mask = vert.xy * 2 - clampedRect.xy - clampedRect.zw;
85
- #endif
86
- output.mask = mask;
87
-
88
- #if (UNDERLAY_ON || UNDERLAY_INNER)
89
- float4 underlayColor = _UnderlayColor;
90
- underlayColor.rgb *= underlayColor.a;
91
-
92
- float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth;
93
- float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight;
94
-
95
- output.texcoord2 = float4(input.texcoord0 + float2(x, y), input.color.a, 0);
96
- output.underlayColor = underlayColor;
97
- #endif
98
-
99
- return output;
100
- }
101
-
102
- float4 PixShader(pixel_t input) : SV_Target
103
- {
104
- UNITY_SETUP_INSTANCE_ID(input);
105
-
106
- float d = tex2D(_MainTex, input.texcoord0.xy).a;
107
-
108
- float pixelSize = abs(ddx(input.texcoord0.y)) + abs(ddy(input.texcoord0.y));
109
- pixelSize *= _TextureHeight * 0.75;
110
- float scale = 1 / pixelSize * _GradientScale * (_Sharpness + 1);
111
-
112
- #if (UNDERLAY_ON | UNDERLAY_INNER)
113
- float layerScale = scale;
114
- layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale);
115
- float layerBias = input.param.x * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale);
116
- #endif
117
-
118
- scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale);
119
-
120
- float4 faceColor = input.faceColor * saturate((d - input.param.x) * scale + 0.5);
121
-
122
- #if OUTLINE_ON
123
- float4 outlineColor = lerp(input.faceColor, input.outlineColor, sqrt(min(1.0, input.param.z * scale * 2)));
124
- faceColor = lerp(outlineColor, input.faceColor, saturate((d - input.param.x - input.param.z) * scale + 0.5));
125
- faceColor *= saturate((d - input.param.x + input.param.z) * scale + 0.5);
126
- #endif
127
-
128
- #if UNDERLAY_ON
129
- d = tex2D(_MainTex, input.texcoord2.xy).a * layerScale;
130
- faceColor += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - layerBias) * (1 - faceColor.a);
131
- #endif
132
-
133
- #if UNDERLAY_INNER
134
- float bias = input.param.x * scale - 0.5;
135
- float sd = saturate(d * scale - bias - input.param.z);
136
- d = tex2D(_MainTex, input.texcoord2.xy).a * layerScale;
137
- faceColor += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - layerBias)) * sd * (1 - faceColor.a);
138
- #endif
139
-
140
- #if MASKING
141
- float a = abs(_MaskInverse - tex2D(_MaskTex, input.texcoord0.zw).a);
142
- float t = a + (1 - _MaskWipeControl) * _MaskEdgeSoftness - _MaskWipeControl;
143
- a = saturate(t / _MaskEdgeSoftness);
144
- faceColor.rgb = lerp(_MaskEdgeColor.rgb * faceColor.a, faceColor.rgb, a);
145
- faceColor *= a;
146
- #endif
147
-
148
- // Alternative implementation to UnityGet2DClipping with support for softness
149
- #if UNITY_UI_CLIP_RECT
150
- half2 maskSoftness = half2(max(_UIMaskSoftnessX, _MaskSoftnessX), max(_UIMaskSoftnessY, _MaskSoftnessY));
151
- float2 maskZW = 0.25 / (0.25 * maskSoftness + 1 / scale);
152
- float2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * maskZW);
153
- faceColor *= m.x * m.y;
154
- #endif
155
-
156
- #if (UNDERLAY_ON | UNDERLAY_INNER)
157
- faceColor *= input.texcoord2.z;
158
- #endif
159
-
160
- #if UNITY_UI_ALPHACLIP
161
- clip(faceColor.a - 0.001);
162
- #endif
163
-
164
- return faceColor;
165
- }