AlphaBlend.shader 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Shader "NRSDK/AlphaBlend "
  2. {
  3. Properties
  4. {
  5. _MainTex("_MainTex", 2D) = "white" {}
  6. _BcakGroundTex("_BcakGroundTex", 2D) = "white" {}
  7. }
  8. SubShader
  9. {
  10. Tags { "RenderType" = "Opaque" }
  11. LOD 100
  12. ZTest Always
  13. ZWrite Off
  14. Pass
  15. {
  16. CGPROGRAM
  17. #pragma vertex vert
  18. #pragma fragment frag
  19. #include "UnityCG.cginc"
  20. struct appdata
  21. {
  22. float4 vertex : POSITION;
  23. float2 uv : TEXCOORD0;
  24. };
  25. struct v2f
  26. {
  27. float2 uv : TEXCOORD0;
  28. UNITY_FOG_COORDS(1)
  29. float4 vertex : SV_POSITION;
  30. };
  31. sampler2D _MainTex;
  32. sampler2D _BcakGroundTex;
  33. float4 _MainTex_ST;
  34. v2f vert(appdata v)
  35. {
  36. v2f o;
  37. o.vertex = UnityObjectToClipPos(v.vertex);
  38. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  39. return o;
  40. }
  41. fixed4 frag(v2f i) : SV_Target
  42. {
  43. // sample the texture
  44. fixed4 col = tex2D(_MainTex, i.uv);
  45. fixed2 uv = fixed2(i.uv.x, 1 - i.uv.y);
  46. fixed4 col_bg = tex2D(_BcakGroundTex, uv);
  47. fixed3 col_tex = lerp(col_bg.rgb, col.rgb, col.a);
  48. return fixed4(col_tex,1);
  49. }
  50. ENDCG
  51. }
  52. }
  53. }