UnlitTextureAO.shader 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Shader "Funly/Unlit/UnlitTextureAO"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Texture", 2D) = "white" {}
  6. _AOTex ("Ambient Occlusion", 2D) = "white" {}
  7. _Color ("Tint", Color) = (1, 1, 1, 1)
  8. }
  9. SubShader
  10. {
  11. Tags { "RenderType"="Opaque" "LightMode"="ForwardBase"}
  12. LOD 100
  13. Pass
  14. {
  15. CGPROGRAM
  16. #pragma vertex vert
  17. #pragma fragment frag
  18. #pragma multi_compile_fwdadd_fullshadows
  19. #include "UnityCG.cginc"
  20. #include "Lighting.cginc"
  21. #include "AutoLight.cginc"
  22. struct appdata
  23. {
  24. float4 vertex : POSITION;
  25. float2 uv : TEXCOORD0;
  26. };
  27. struct v2f
  28. {
  29. float2 uv : TEXCOORD0;
  30. float4 vertex : SV_POSITION;
  31. };
  32. sampler2D _MainTex;
  33. sampler2D _AOTex;
  34. float4 _Color;
  35. v2f vert (appdata v)
  36. {
  37. v2f o;
  38. o.vertex = UnityObjectToClipPos(v.vertex);
  39. o.uv = v.uv;
  40. UNITY_TRANSFER_FOG(o, o.vertex);
  41. return o;
  42. }
  43. fixed4 frag (v2f i) : SV_Target
  44. {
  45. // sample the texture
  46. fixed4 col = tex2D(_MainTex, i.uv);
  47. fixed4 ao = tex2D(_AOTex, i.uv);
  48. fixed4 outColor = col * ao * _Color;
  49. return outColor;
  50. }
  51. ENDCG
  52. }
  53. }
  54. Fallback "VertexLit"
  55. }