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,258 +0,0 @@
1
- // Simplified SDF shader:
2
- // - No Shading Option (bevel / bump / env map)
3
- // - No Glow Option
4
- // - Softness is applied on both side of the outline
5
-
6
- Shader "TextMeshPro/Mobile/Distance Field - Masking" {
7
-
8
- Properties {
9
- _FaceColor ("Face Color", Color) = (1,1,1,1)
10
- _FaceDilate ("Face Dilate", Range(-1,1)) = 0
11
-
12
- _OutlineColor ("Outline Color", Color) = (0,0,0,1)
13
- _OutlineWidth ("Outline Thickness", Range(0,1)) = 0
14
- _OutlineSoftness ("Outline Softness", Range(0,1)) = 0
15
-
16
- _UnderlayColor ("Border Color", Color) = (0,0,0,.5)
17
- _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0
18
- _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0
19
- _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0
20
- _UnderlaySoftness ("Border Softness", Range(0,1)) = 0
21
-
22
- _WeightNormal ("Weight Normal", float) = 0
23
- _WeightBold ("Weight Bold", float) = .5
24
-
25
- _ShaderFlags ("Flags", float) = 0
26
- _ScaleRatioA ("Scale RatioA", float) = 1
27
- _ScaleRatioB ("Scale RatioB", float) = 1
28
- _ScaleRatioC ("Scale RatioC", float) = 1
29
-
30
- _MainTex ("Font Atlas", 2D) = "white" {}
31
- _TextureWidth ("Texture Width", float) = 512
32
- _TextureHeight ("Texture Height", float) = 512
33
- _GradientScale ("Gradient Scale", float) = 5
34
- _ScaleX ("Scale X", float) = 1
35
- _ScaleY ("Scale Y", float) = 1
36
- _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875
37
- _Sharpness ("Sharpness", Range(-1,1)) = 0
38
-
39
- _VertexOffsetX ("Vertex OffsetX", float) = 0
40
- _VertexOffsetY ("Vertex OffsetY", float) = 0
41
-
42
- _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
43
- _MaskSoftnessX ("Mask SoftnessX", float) = 0
44
- _MaskSoftnessY ("Mask SoftnessY", float) = 0
45
- _MaskTex ("Mask Texture", 2D) = "white" {}
46
- _MaskInverse ("Inverse", float) = 0
47
- _MaskEdgeColor ("Edge Color", Color) = (1,1,1,1)
48
- _MaskEdgeSoftness ("Edge Softness", Range(0, 1)) = 0.01
49
- _MaskWipeControl ("Wipe Position", Range(0, 1)) = 0.5
50
-
51
- _StencilComp ("Stencil Comparison", Float) = 8
52
- _Stencil ("Stencil ID", Float) = 0
53
- _StencilOp ("Stencil Operation", Float) = 0
54
- _StencilWriteMask ("Stencil Write Mask", Float) = 255
55
- _StencilReadMask ("Stencil Read Mask", Float) = 255
56
-
57
- _CullMode ("Cull Mode", Float) = 0
58
- _ColorMask ("Color Mask", Float) = 15
59
- }
60
-
61
- SubShader {
62
- Tags
63
- {
64
- "Queue"="Transparent"
65
- "IgnoreProjector"="True"
66
- "RenderType"="Transparent"
67
- }
68
-
69
-
70
- Stencil
71
- {
72
- Ref [_Stencil]
73
- Comp [_StencilComp]
74
- Pass [_StencilOp]
75
- ReadMask [_StencilReadMask]
76
- WriteMask [_StencilWriteMask]
77
- }
78
-
79
- Cull [_CullMode]
80
- ZWrite Off
81
- Lighting Off
82
- Fog { Mode Off }
83
- ZTest [unity_GUIZTestMode]
84
- Blend One OneMinusSrcAlpha
85
- ColorMask [_ColorMask]
86
-
87
- Pass {
88
- CGPROGRAM
89
- #pragma vertex VertShader
90
- #pragma fragment PixShader
91
- #pragma shader_feature __ OUTLINE_ON
92
- #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER
93
-
94
- #pragma multi_compile __ UNITY_UI_CLIP_RECT
95
- #pragma multi_compile __ UNITY_UI_ALPHACLIP
96
-
97
-
98
- #include "UnityCG.cginc"
99
- #include "UnityUI.cginc"
100
- #include "TMPro_Properties.cginc"
101
-
102
- struct vertex_t
103
- {
104
- float4 vertex : POSITION;
105
- float3 normal : NORMAL;
106
- fixed4 color : COLOR;
107
- float4 texcoord0 : TEXCOORD0;
108
- float2 texcoord1 : TEXCOORD1;
109
- };
110
-
111
- struct pixel_t
112
- {
113
- float4 vertex : SV_POSITION;
114
- fixed4 faceColor : COLOR;
115
- fixed4 outlineColor : COLOR1;
116
- float4 texcoord0 : TEXCOORD0; // Texture UV, Mask UV
117
- half4 param : TEXCOORD1; // Scale(x), BiasIn(y), BiasOut(z), Bias(w)
118
- half4 mask : TEXCOORD2; // Position in clip space(xy), Softness(zw)
119
-
120
- #if (UNDERLAY_ON | UNDERLAY_INNER)
121
- float4 texcoord1 : TEXCOORD3; // Texture UV, alpha, reserved
122
- half2 underlayParam : TEXCOORD4; // Scale(x), Bias(y)
123
- #endif
124
- };
125
-
126
- float _MaskWipeControl;
127
- float _MaskEdgeSoftness;
128
- fixed4 _MaskEdgeColor;
129
- bool _MaskInverse;
130
- float _UIMaskSoftnessX;
131
- float _UIMaskSoftnessY;
132
- int _UIVertexColorAlwaysGammaSpace;
133
-
134
- pixel_t VertShader(vertex_t input)
135
- {
136
- float bold = step(input.texcoord0.w, 0);
137
-
138
- float4 vert = input.vertex;
139
- vert.x += _VertexOffsetX;
140
- vert.y += _VertexOffsetY;
141
- float4 vPosition = UnityObjectToClipPos(vert);
142
-
143
- float2 pixelSize = vPosition.w;
144
- pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
145
-
146
- float scale = rsqrt(dot(pixelSize, pixelSize));
147
- scale *= abs(input.texcoord0.w) * _GradientScale * (_Sharpness + 1);
148
- if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert)))));
149
-
150
- float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0;
151
- weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5;
152
-
153
- float layerScale = scale;
154
-
155
- scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale);
156
- float bias = (0.5 - weight) * scale - 0.5;
157
- float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale;
158
-
159
- if (_UIVertexColorAlwaysGammaSpace && !IsGammaSpace())
160
- {
161
- input.color.rgb = UIGammaToLinear(input.color.rgb);
162
- }
163
- float opacity = input.color.a;
164
- #if (UNDERLAY_ON | UNDERLAY_INNER)
165
- opacity = 1.0;
166
- #endif
167
-
168
- fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor;
169
- faceColor.rgb *= faceColor.a;
170
-
171
- fixed4 outlineColor = _OutlineColor;
172
- outlineColor.a *= opacity;
173
- outlineColor.rgb *= outlineColor.a;
174
- outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2))));
175
-
176
- #if (UNDERLAY_ON | UNDERLAY_INNER)
177
-
178
- layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale);
179
- float layerBias = (.5 - weight) * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale);
180
-
181
- float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth;
182
- float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight;
183
- float2 layerOffset = float2(x, y);
184
- #endif
185
-
186
- // Generate UV for the Masking Texture
187
- float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
188
- float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy);
189
- const half2 maskSoftness = half2(max(_UIMaskSoftnessX, _MaskSoftnessX), max(_UIMaskSoftnessY, _MaskSoftnessY));
190
-
191
- // Structure for pixel shader
192
- pixel_t output = {
193
- vPosition,
194
- faceColor,
195
- outlineColor,
196
- float4(input.texcoord0.x, input.texcoord0.y, maskUV.x, maskUV.y),
197
- half4(scale, bias - outline, bias + outline, bias),
198
- half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * maskSoftness + pixelSize.xy)),
199
- #if (UNDERLAY_ON | UNDERLAY_INNER)
200
- float4(input.texcoord0 + layerOffset, input.color.a, 0),
201
- half2(layerScale, layerBias),
202
- #endif
203
- };
204
-
205
- return output;
206
- }
207
-
208
-
209
- // PIXEL SHADER
210
- fixed4 PixShader(pixel_t input) : SV_Target
211
- {
212
- half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x;
213
- half4 c = input.faceColor * saturate(d - input.param.w);
214
-
215
- #ifdef OUTLINE_ON
216
- c = lerp(input.outlineColor, input.faceColor, saturate(d - input.param.z));
217
- c *= saturate(d - input.param.y);
218
- #endif
219
-
220
- #if UNDERLAY_ON
221
- d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x;
222
- c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - input.underlayParam.y) * (1 - c.a);
223
- #endif
224
-
225
- #if UNDERLAY_INNER
226
- half sd = saturate(d - input.param.z);
227
- d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x;
228
- c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - input.underlayParam.y)) * sd * (1 - c.a);
229
- #endif
230
-
231
- // Alternative implementation to UnityGet2DClipping with support for softness.
232
- //#if UNITY_UI_CLIP_RECT
233
- half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw);
234
- c *= m.x * m.y;
235
- //#endif
236
-
237
- float a = abs(_MaskInverse - tex2D(_MaskTex, input.texcoord0.zw).a);
238
- float t = a + (1 - _MaskWipeControl) * _MaskEdgeSoftness - _MaskWipeControl;
239
- a = saturate(t / _MaskEdgeSoftness);
240
- c.rgb = lerp(_MaskEdgeColor.rgb*c.a, c.rgb, a);
241
- c *= a;
242
-
243
- #if (UNDERLAY_ON | UNDERLAY_INNER)
244
- c *= input.texcoord1.z;
245
- #endif
246
-
247
- #if UNITY_UI_ALPHACLIP
248
- clip(c.a - 0.001);
249
- #endif
250
-
251
- return c;
252
- }
253
- ENDCG
254
- }
255
- }
256
-
257
- CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI"
258
- }
@@ -1,252 +0,0 @@
1
- // Simplified SDF shader:
2
- // - No Shading Option (bevel / bump / env map)
3
- // - No Glow Option
4
- // - Softness is applied on both side of the outline
5
-
6
- Shader "TextMeshPro/Mobile/Distance Field Overlay" {
7
-
8
- Properties {
9
- _FaceColor ("Face Color", Color) = (1,1,1,1)
10
- _FaceDilate ("Face Dilate", Range(-1,1)) = 0
11
-
12
- _OutlineColor ("Outline Color", Color) = (0,0,0,1)
13
- _OutlineWidth ("Outline Thickness", Range(0,1)) = 0
14
- _OutlineSoftness ("Outline Softness", Range(0,1)) = 0
15
-
16
- _UnderlayColor ("Border Color", Color) = (0,0,0,.5)
17
- _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0
18
- _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0
19
- _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0
20
- _UnderlaySoftness ("Border Softness", Range(0,1)) = 0
21
-
22
- _WeightNormal ("Weight Normal", float) = 0
23
- _WeightBold ("Weight Bold", float) = .5
24
-
25
- _ShaderFlags ("Flags", float) = 0
26
- _ScaleRatioA ("Scale RatioA", float) = 1
27
- _ScaleRatioB ("Scale RatioB", float) = 1
28
- _ScaleRatioC ("Scale RatioC", float) = 1
29
-
30
- _MainTex ("Font Atlas", 2D) = "white" {}
31
- _TextureWidth ("Texture Width", float) = 512
32
- _TextureHeight ("Texture Height", float) = 512
33
- _GradientScale ("Gradient Scale", float) = 5
34
- _ScaleX ("Scale X", float) = 1
35
- _ScaleY ("Scale Y", float) = 1
36
- _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875
37
- _Sharpness ("Sharpness", Range(-1,1)) = 0
38
-
39
- _VertexOffsetX ("Vertex OffsetX", float) = 0
40
- _VertexOffsetY ("Vertex OffsetY", float) = 0
41
-
42
- _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
43
- _MaskSoftnessX ("Mask SoftnessX", float) = 0
44
- _MaskSoftnessY ("Mask SoftnessY", float) = 0
45
-
46
- _StencilComp ("Stencil Comparison", Float) = 8
47
- _Stencil ("Stencil ID", Float) = 0
48
- _StencilOp ("Stencil Operation", Float) = 0
49
- _StencilWriteMask ("Stencil Write Mask", Float) = 255
50
- _StencilReadMask ("Stencil Read Mask", Float) = 255
51
-
52
- _CullMode ("Cull Mode", Float) = 0
53
- _ColorMask ("Color Mask", Float) = 15
54
- }
55
-
56
- SubShader {
57
- Tags
58
- {
59
- "Queue"="Overlay"
60
- "IgnoreProjector"="True"
61
- "RenderType"="Transparent"
62
- }
63
-
64
-
65
- Stencil
66
- {
67
- Ref [_Stencil]
68
- Comp [_StencilComp]
69
- Pass [_StencilOp]
70
- ReadMask [_StencilReadMask]
71
- WriteMask [_StencilWriteMask]
72
- }
73
-
74
- Cull [_CullMode]
75
- ZWrite Off
76
- Lighting Off
77
- Fog { Mode Off }
78
- ZTest Always
79
- Blend One OneMinusSrcAlpha
80
- ColorMask [_ColorMask]
81
-
82
- Pass {
83
- CGPROGRAM
84
- #pragma vertex VertShader
85
- #pragma fragment PixShader
86
- #pragma shader_feature __ OUTLINE_ON
87
- #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER
88
-
89
- #pragma multi_compile __ UNITY_UI_CLIP_RECT
90
- #pragma multi_compile __ UNITY_UI_ALPHACLIP
91
-
92
- #include "UnityCG.cginc"
93
- #include "UnityUI.cginc"
94
- #include "TMPro_Properties.cginc"
95
-
96
- struct vertex_t
97
- {
98
- UNITY_VERTEX_INPUT_INSTANCE_ID
99
- float4 vertex : POSITION;
100
- float3 normal : NORMAL;
101
- fixed4 color : COLOR;
102
- float4 texcoord0 : TEXCOORD0;
103
- float2 texcoord1 : TEXCOORD1;
104
- };
105
-
106
- struct pixel_t
107
- {
108
- UNITY_VERTEX_INPUT_INSTANCE_ID
109
- UNITY_VERTEX_OUTPUT_STEREO
110
- float4 vertex : SV_POSITION;
111
- fixed4 faceColor : COLOR;
112
- fixed4 outlineColor : COLOR1;
113
- float4 texcoord0 : TEXCOORD0; // Texture UV, Mask UV
114
- half4 param : TEXCOORD1; // Scale(x), BiasIn(y), BiasOut(z), Bias(w)
115
- half4 mask : TEXCOORD2; // Position in clip space(xy), Softness(zw)
116
-
117
- #if (UNDERLAY_ON | UNDERLAY_INNER)
118
- float4 texcoord1 : TEXCOORD3; // Texture UV, alpha, reserved
119
- half2 underlayParam : TEXCOORD4; // Scale(x), Bias(y)
120
- #endif
121
- };
122
-
123
- float _UIMaskSoftnessX;
124
- float _UIMaskSoftnessY;
125
- int _UIVertexColorAlwaysGammaSpace;
126
-
127
-
128
- pixel_t VertShader(vertex_t input)
129
- {
130
- pixel_t output;
131
-
132
- UNITY_INITIALIZE_OUTPUT(pixel_t, output);
133
- UNITY_SETUP_INSTANCE_ID(input);
134
- UNITY_TRANSFER_INSTANCE_ID(input, output);
135
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
136
-
137
- float bold = step(input.texcoord0.w, 0);
138
-
139
- float4 vert = input.vertex;
140
- vert.x += _VertexOffsetX;
141
- vert.y += _VertexOffsetY;
142
- float4 vPosition = UnityObjectToClipPos(vert);
143
-
144
- float2 pixelSize = vPosition.w;
145
- pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
146
-
147
- float scale = rsqrt(dot(pixelSize, pixelSize));
148
- scale *= abs(input.texcoord0.w) * _GradientScale * (_Sharpness + 1);
149
- if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert)))));
150
-
151
- float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0;
152
- weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5;
153
-
154
- float layerScale = scale;
155
-
156
- scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale);
157
- float bias = (0.5 - weight) * scale - 0.5;
158
- float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale;
159
-
160
- if (_UIVertexColorAlwaysGammaSpace && !IsGammaSpace())
161
- {
162
- input.color.rgb = UIGammaToLinear(input.color.rgb);
163
- }
164
- float opacity = input.color.a;
165
- #if (UNDERLAY_ON | UNDERLAY_INNER)
166
- opacity = 1.0;
167
- #endif
168
-
169
- fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor;
170
- faceColor.rgb *= faceColor.a;
171
-
172
- fixed4 outlineColor = _OutlineColor;
173
- outlineColor.a *= opacity;
174
- outlineColor.rgb *= outlineColor.a;
175
- outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2))));
176
-
177
- #if (UNDERLAY_ON | UNDERLAY_INNER)
178
- layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale);
179
- float layerBias = (.5 - weight) * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale);
180
-
181
- float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth;
182
- float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight;
183
- float2 layerOffset = float2(x, y);
184
- #endif
185
-
186
- // Generate UV for the Masking Texture
187
- float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
188
- float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy);
189
-
190
- // Populate structure for pixel shader
191
- output.vertex = vPosition;
192
- output.faceColor = faceColor;
193
- output.outlineColor = outlineColor;
194
- output.texcoord0 = float4(input.texcoord0.x, input.texcoord0.y, maskUV.x, maskUV.y);
195
- output.param = half4(scale, bias - outline, bias + outline, bias);
196
- const half2 maskSoftness = half2(max(_UIMaskSoftnessX, _MaskSoftnessX), max(_UIMaskSoftnessY, _MaskSoftnessY));
197
- output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * maskSoftness + pixelSize.xy));
198
- #if (UNDERLAY_ON || UNDERLAY_INNER)
199
- output.texcoord1 = float4(input.texcoord0 + layerOffset, input.color.a, 0);
200
- output.underlayParam = half2(layerScale, layerBias);
201
- #endif
202
-
203
- return output;
204
- }
205
-
206
-
207
- // PIXEL SHADER
208
- fixed4 PixShader(pixel_t input) : SV_Target
209
- {
210
- UNITY_SETUP_INSTANCE_ID(input);
211
-
212
- half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x;
213
- half4 c = input.faceColor * saturate(d - input.param.w);
214
-
215
- #ifdef OUTLINE_ON
216
- c = lerp(input.outlineColor, input.faceColor, saturate(d - input.param.z));
217
- c *= saturate(d - input.param.y);
218
- #endif
219
-
220
- #if UNDERLAY_ON
221
- d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x;
222
- c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - input.underlayParam.y) * (1 - c.a);
223
- #endif
224
-
225
- #if UNDERLAY_INNER
226
- half sd = saturate(d - input.param.z);
227
- d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x;
228
- c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - input.underlayParam.y)) * sd * (1 - c.a);
229
- #endif
230
-
231
- // Alternative implementation to UnityGet2DClipping with support for softness.
232
- #if UNITY_UI_CLIP_RECT
233
- half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw);
234
- c *= m.x * m.y;
235
- #endif
236
-
237
- #if (UNDERLAY_ON | UNDERLAY_INNER)
238
- c *= input.texcoord1.z;
239
- #endif
240
-
241
- #if UNITY_UI_ALPHACLIP
242
- clip(c.a - 0.001);
243
- #endif
244
-
245
- return c;
246
- }
247
- ENDCG
248
- }
249
- }
250
-
251
- CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI"
252
- }
@@ -1,106 +0,0 @@
1
- // Simplified SDF shader:
2
- // - No Shading Option (bevel / bump / env map)
3
- // - No Glow Option
4
- // - Softness is applied on both side of the outline
5
-
6
- Shader "TextMeshPro/Mobile/Distance Field SSD" {
7
-
8
- Properties {
9
- _FaceColor ("Face Color", Color) = (1,1,1,1)
10
- _FaceDilate ("Face Dilate", Range(-1,1)) = 0
11
-
12
- _OutlineColor ("Outline Color", Color) = (0,0,0,1)
13
- _OutlineWidth ("Outline Thickness", Range(0,1)) = 0
14
- _OutlineSoftness ("Outline Softness", Range(0,1)) = 0
15
-
16
- _UnderlayColor ("Border Color", Color) = (0,0,0,.5)
17
- _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0
18
- _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0
19
- _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0
20
- _UnderlaySoftness ("Border Softness", Range(0,1)) = 0
21
-
22
- _WeightNormal ("Weight Normal", float) = 0
23
- _WeightBold ("Weight Bold", float) = .5
24
-
25
- _ShaderFlags ("Flags", float) = 0
26
- _ScaleRatioA ("Scale RatioA", float) = 1
27
- _ScaleRatioB ("Scale RatioB", float) = 1
28
- _ScaleRatioC ("Scale RatioC", float) = 1
29
-
30
- _MainTex ("Font Atlas", 2D) = "white" {}
31
- _TextureWidth ("Texture Width", float) = 512
32
- _TextureHeight ("Texture Height", float) = 512
33
- _GradientScale ("Gradient Scale", float) = 5
34
- _ScaleX ("Scale X", float) = 1
35
- _ScaleY ("Scale Y", float) = 1
36
- _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875
37
- _Sharpness ("Sharpness", Range(-1,1)) = 0
38
-
39
- _VertexOffsetX ("Vertex OffsetX", float) = 0
40
- _VertexOffsetY ("Vertex OffsetY", float) = 0
41
-
42
- _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
43
- _MaskSoftnessX ("Mask SoftnessX", float) = 0
44
- _MaskSoftnessY ("Mask SoftnessY", float) = 0
45
- _MaskTex ("Mask Texture", 2D) = "white" {}
46
- _MaskInverse ("Inverse", float) = 0
47
- _MaskEdgeColor ("Edge Color", Color) = (1,1,1,1)
48
- _MaskEdgeSoftness ("Edge Softness", Range(0, 1)) = 0.01
49
- _MaskWipeControl ("Wipe Position", Range(0, 1)) = 0.5
50
-
51
- _StencilComp ("Stencil Comparison", Float) = 8
52
- _Stencil ("Stencil ID", Float) = 0
53
- _StencilOp ("Stencil Operation", Float) = 0
54
- _StencilWriteMask ("Stencil Write Mask", Float) = 255
55
- _StencilReadMask ("Stencil Read Mask", Float) = 255
56
-
57
- _CullMode ("Cull Mode", Float) = 0
58
- _ColorMask ("Color Mask", Float) = 15
59
- }
60
-
61
- SubShader {
62
- Tags {
63
- "Queue"="Transparent"
64
- "IgnoreProjector"="True"
65
- "RenderType"="Transparent"
66
- }
67
-
68
- Stencil
69
- {
70
- Ref [_Stencil]
71
- Comp [_StencilComp]
72
- Pass [_StencilOp]
73
- ReadMask [_StencilReadMask]
74
- WriteMask [_StencilWriteMask]
75
- }
76
-
77
- Cull [_CullMode]
78
- ZWrite Off
79
- Lighting Off
80
- Fog { Mode Off }
81
- ZTest [unity_GUIZTestMode]
82
- Blend One OneMinusSrcAlpha
83
- ColorMask [_ColorMask]
84
-
85
- Pass {
86
- CGPROGRAM
87
- #pragma vertex VertShader
88
- #pragma fragment PixShader
89
- #pragma shader_feature __ OUTLINE_ON
90
- #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER
91
-
92
- #pragma multi_compile __ UNITY_UI_CLIP_RECT
93
- #pragma multi_compile __ UNITY_UI_ALPHACLIP
94
-
95
- #include "UnityCG.cginc"
96
- #include "UnityUI.cginc"
97
- #include "TMPro_Properties.cginc"
98
-
99
- #include "TMPro_Mobile.cginc"
100
-
101
- ENDCG
102
- }
103
- }
104
-
105
- CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI"
106
- }