TMP_SDF Internal Editor.shader 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 "Hidden/TMP/Internal/Editor/Distance Field SSD" {
  6. Properties{
  7. _FaceColor("Face Color", Color) = (1,1,1,1)
  8. _FaceDilate("Face Dilate", Range(-1,1)) = 0
  9. _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. _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) = 1024
  25. _TextureHeight("Texture Height", float) = 1024
  26. _GradientScale("Gradient Scale", float) = 1
  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. }
  34. SubShader
  35. {
  36. Tags
  37. {
  38. "ForceSupported" = "True"
  39. }
  40. Lighting Off
  41. Blend One OneMinusSrcAlpha
  42. Cull Off
  43. ZWrite Off
  44. ZTest Always
  45. Pass
  46. {
  47. CGPROGRAM
  48. #pragma vertex VertShader
  49. #pragma fragment PixShader
  50. #pragma shader_feature __ OUTLINE_ON
  51. #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER
  52. #include "UnityCG.cginc"
  53. #include "UnityUI.cginc"
  54. #include "TMP_Properties.cginc"
  55. #include "TMP_SDF_SSD.cginc"
  56. ENDCG
  57. }
  58. }
  59. CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI"
  60. }