説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Sprites-Inspector.shader 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // Texture is forced to be in Gamma space regardless of the active ColorSpace.
  2. Shader "Hidden/InternalSpritesInspector"
  3. {
  4. Properties
  5. {
  6. [PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
  7. _Color("Tint", Color) = (1, 1, 1, 1)
  8. [MaterialToggle] PixelSnap("Pixel snap", Float) = 0
  9. }
  10. SubShader
  11. {
  12. Tags
  13. {
  14. "Queue" = "Transparent"
  15. "IgnoreProjector" = "True"
  16. "RenderType" = "Transparent"
  17. "PreviewType" = "Plane"
  18. "CanUseSpriteAtlas" = "True"
  19. }
  20. Cull Off
  21. Lighting Off
  22. ZWrite Off
  23. Fog{ Mode Off }
  24. Blend SrcAlpha OneMinusSrcAlpha
  25. Pass
  26. {
  27. CGPROGRAM
  28. #pragma vertex vert
  29. #pragma fragment frag
  30. #pragma multi_compile DUMMY PIXELSNAP_ON
  31. #include "UnityCG.cginc"
  32. uniform bool _AdjustLinearForGamma;
  33. struct appdata_t
  34. {
  35. float4 vertex : POSITION;
  36. float4 color : COLOR;
  37. float2 texcoord : TEXCOORD0;
  38. };
  39. struct v2f
  40. {
  41. float4 vertex : SV_POSITION;
  42. fixed4 color : COLOR;
  43. half2 texcoord : TEXCOORD0;
  44. float2 clipUV : TEXCOORD1;
  45. };
  46. fixed4 _Color;
  47. uniform float4x4 unity_GUIClipTextureMatrix;
  48. v2f vert(appdata_t IN)
  49. {
  50. float3 screenUV = UnityObjectToViewPos(IN.vertex);
  51. v2f OUT;
  52. OUT.vertex = UnityObjectToClipPos(IN.vertex);
  53. OUT.texcoord = IN.texcoord;
  54. OUT.color = IN.color * _Color;
  55. OUT.clipUV = mul(unity_GUIClipTextureMatrix, float4(screenUV.xy, 0, 1.0));
  56. return OUT;
  57. }
  58. sampler2D _MainTex;
  59. sampler2D _GUIClipTexture;
  60. fixed4 frag(v2f IN) : COLOR
  61. {
  62. fixed4 col = tex2D(_MainTex, IN.texcoord);
  63. fixed alpha = col.a;
  64. if (_AdjustLinearForGamma)
  65. col.rgb = LinearToGammaSpace(col.rgb);
  66. col.a = alpha * tex2D(_GUIClipTexture, IN.clipUV).a;
  67. return col * IN.color;
  68. }
  69. ENDCG
  70. }
  71. }
  72. }