2
0

TMP_SDF-Mobile SSD.shader 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. Shader "TextMeshPro/Mobile/Distance Field SSD" {
  6. Properties {
  7. [HDR]_FaceColor ("Face Color", Color) = (1,1,1,1)
  8. _FaceDilate ("Face Dilate", Range(-1,1)) = 0
  9. [HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1)
  10. _OutlineWidth ("Outline Thickness", Range(0,1)) = 0
  11. _OutlineSoftness ("Outline Softness", Range(0,1)) = 0
  12. [HDR]_UnderlayColor ("Border Color", Color) = (0,0,0,.5)
  13. _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0
  14. _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0
  15. _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0
  16. _UnderlaySoftness ("Border Softness", Range(0,1)) = 0
  17. _WeightNormal ("Weight Normal", float) = 0
  18. _WeightBold ("Weight Bold", float) = .5
  19. _ShaderFlags ("Flags", float) = 0
  20. _ScaleRatioA ("Scale RatioA", float) = 1
  21. _ScaleRatioB ("Scale RatioB", float) = 1
  22. _ScaleRatioC ("Scale RatioC", float) = 1
  23. _MainTex ("Font Atlas", 2D) = "white" {}
  24. _TextureWidth ("Texture Width", float) = 512
  25. _TextureHeight ("Texture Height", float) = 512
  26. _GradientScale ("Gradient Scale", float) = 5
  27. _ScaleX ("Scale X", float) = 1
  28. _ScaleY ("Scale Y", float) = 1
  29. _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875
  30. _Sharpness ("Sharpness", Range(-1,1)) = 0
  31. _VertexOffsetX ("Vertex OffsetX", float) = 0
  32. _VertexOffsetY ("Vertex OffsetY", float) = 0
  33. _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
  34. _MaskSoftnessX ("Mask SoftnessX", float) = 0
  35. _MaskSoftnessY ("Mask SoftnessY", float) = 0
  36. _MaskTex ("Mask Texture", 2D) = "white" {}
  37. _MaskInverse ("Inverse", float) = 0
  38. _MaskEdgeColor ("Edge Color", Color) = (1,1,1,1)
  39. _MaskEdgeSoftness ("Edge Softness", Range(0, 1)) = 0.01
  40. _MaskWipeControl ("Wipe Position", Range(0, 1)) = 0.5
  41. _StencilComp ("Stencil Comparison", Float) = 8
  42. _Stencil ("Stencil ID", Float) = 0
  43. _StencilOp ("Stencil Operation", Float) = 0
  44. _StencilWriteMask ("Stencil Write Mask", Float) = 255
  45. _StencilReadMask ("Stencil Read Mask", Float) = 255
  46. _CullMode ("Cull Mode", Float) = 0
  47. _ColorMask ("Color Mask", Float) = 15
  48. }
  49. SubShader {
  50. Tags {
  51. "Queue"="Transparent"
  52. "IgnoreProjector"="True"
  53. "RenderType"="Transparent"
  54. }
  55. Stencil
  56. {
  57. Ref [_Stencil]
  58. Comp [_StencilComp]
  59. Pass [_StencilOp]
  60. ReadMask [_StencilReadMask]
  61. WriteMask [_StencilWriteMask]
  62. }
  63. Cull [_CullMode]
  64. ZWrite Off
  65. Lighting Off
  66. Fog { Mode Off }
  67. ZTest [unity_GUIZTestMode]
  68. Blend One OneMinusSrcAlpha
  69. ColorMask [_ColorMask]
  70. Pass {
  71. CGPROGRAM
  72. #pragma vertex VertShader
  73. #pragma fragment PixShader
  74. #pragma shader_feature __ OUTLINE_ON
  75. #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER
  76. #pragma multi_compile __ UNITY_UI_CLIP_RECT
  77. #pragma multi_compile __ UNITY_UI_ALPHACLIP
  78. #include "UnityCG.cginc"
  79. #include "UnityUI.cginc"
  80. #include "TMPro_Properties.cginc"
  81. #include "TMPro_Mobile.cginc"
  82. ENDCG
  83. }
  84. }
  85. CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI"
  86. }