UnlitOpaque.shader 1.2 KB

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