Unlit.shader 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. //Unity's base unlit shader adapted for emulated mipmaps
  3. // Unlit alpha-blended shader.
  4. // - no lighting
  5. // - no lightmap support
  6. // - no per-material color
  7. Shader "Emulated Mipmap/Unlit Transparent" {
  8. Properties {
  9. _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
  10. }
  11. SubShader {
  12. Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  13. LOD 100
  14. ZWrite Off
  15. Blend SrcAlpha OneMinusSrcAlpha
  16. Pass {
  17. CGPROGRAM
  18. #pragma vertex vert
  19. #pragma fragment frag
  20. #pragma multi_compile_fog
  21. #pragma target 3.0
  22. #include "UnityCG.cginc"
  23. #include "./MipSample.cginc"
  24. struct appdata_t {
  25. float4 vertex : POSITION;
  26. float2 texcoord : TEXCOORD0;
  27. };
  28. struct v2f {
  29. float4 vertex : SV_POSITION;
  30. half2 texcoord : TEXCOORD0;
  31. UNITY_FOG_COORDS(1)
  32. };
  33. sampler2D _MainTex;
  34. float4 _MainTex_ST;
  35. float4 _MainTex_TexelSize;
  36. v2f vert (appdata_t v)
  37. {
  38. v2f o;
  39. o.vertex = UnityObjectToClipPos(v.vertex);
  40. o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
  41. UNITY_TRANSFER_FOG(o,o.vertex);
  42. return o;
  43. }
  44. fixed4 frag (v2f i) : SV_Target
  45. {
  46. fixed4 col = mipSample(_MainTex, i.texcoord, _MainTex_TexelSize.zw, 10, 1);
  47. UNITY_APPLY_FOG(i.fogCoord, col);
  48. return col;
  49. }
  50. ENDCG
  51. }
  52. }
  53. }