AlphaBlended.shader 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "FORGE3D/Alpha Blended"
  4. {
  5. Properties
  6. {
  7. _MainTex("MainTex", 2D) = "white" {}
  8. _Tint("Tint", Color) = (1,1,1,1)
  9. _InvFade("InvFade", Float) = 0
  10. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  11. [HideInInspector] __dirty( "", Int ) = 1
  12. }
  13. SubShader
  14. {
  15. Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+0" "IgnoreProjector" = "True" "ForceNoShadowCasting" = "True" "IsEmissive" = "true" }
  16. Cull Off
  17. CGPROGRAM
  18. #include "UnityCG.cginc"
  19. #pragma target 2.0
  20. #pragma multi_compile_instancing
  21. #pragma surface surf Unlit alpha:fade keepalpha noshadow novertexlights nolightmap nodynlightmap nodirlightmap nofog noforwardadd
  22. struct Input
  23. {
  24. half2 uv_texcoord;
  25. float4 vertexColor : COLOR;
  26. float4 screenPos;
  27. };
  28. uniform sampler2D _MainTex;
  29. uniform float4 _MainTex_ST;
  30. uniform half4 _Tint;
  31. uniform sampler2D _CameraDepthTexture;
  32. uniform half _InvFade;
  33. inline half4 LightingUnlit( SurfaceOutput s, half3 lightDir, half atten )
  34. {
  35. return half4 ( 0, 0, 0, s.Alpha );
  36. }
  37. void surf( Input i , inout SurfaceOutput o )
  38. {
  39. float2 uv_MainTex = i.uv_texcoord * _MainTex_ST.xy + _MainTex_ST.zw;
  40. half4 tex2DNode5 = tex2D( _MainTex, uv_MainTex );
  41. o.Emission = ( tex2DNode5 * _Tint * i.vertexColor ).rgb;
  42. float4 ase_screenPos = float4( i.screenPos.xyz , i.screenPos.w + 0.00000000001 );
  43. float4 ase_screenPosNorm = ase_screenPos / ase_screenPos.w;
  44. ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5;
  45. float screenDepth6 = LinearEyeDepth(UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture,UNITY_PROJ_COORD(ase_screenPos))));
  46. float distanceDepth6 = abs( ( screenDepth6 - LinearEyeDepth( ase_screenPosNorm.z ) ) / ( _InvFade ) );
  47. o.Alpha = ( tex2DNode5.a * _Tint.a * saturate( distanceDepth6 ) * i.vertexColor.a );
  48. }
  49. ENDCG
  50. }
  51. }
  52. /*ASEBEGIN
  53. Version=15401
  54. 1927;29;1906;1124;1192;803;1;True;False
  55. Node;AmplifyShaderEditor.RangedFloatNode;3;-903,1.285706;Float;False;Property;_InvFade;InvFade;2;0;Create;True;0;0;False;0;0;0;0;0;0;1;FLOAT;0
  56. Node;AmplifyShaderEditor.DepthFade;6;-645,6.285706;Float;False;True;1;0;FLOAT;1;False;1;FLOAT;0
  57. Node;AmplifyShaderEditor.SaturateNode;8;-400,7.285706;Float;False;1;0;FLOAT;0;False;1;FLOAT;0
  58. Node;AmplifyShaderEditor.SamplerNode;5;-644,-578.7143;Float;True;Property;_MainTex;MainTex;0;0;Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  59. Node;AmplifyShaderEditor.VertexColorNode;10;-608,-198;Float;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  60. Node;AmplifyShaderEditor.ColorNode;4;-642,-377.7143;Float;False;Property;_Tint;Tint;1;0;Create;True;0;0;False;0;1,1,1,1;0,0,0,0;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  61. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;9;-135,-184.7143;Float;False;4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT;0
  62. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;7;-287,-574.7143;Float;False;3;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;1;COLOR;0
  63. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;2;121,-341;Half;False;True;0;Half;;0;0;Unlit;FORGE3D/Alpha Blended;False;False;False;False;False;True;True;True;True;True;False;True;False;False;True;True;True;False;False;False;Off;0;False;-1;0;False;-1;False;0;False;-1;0;False;-1;False;0;Transparent;0.5;True;False;0;False;Transparent;;Transparent;All;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;0;False;-1;False;0;False;-1;255;False;-1;255;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;False;2;15;10;25;False;0.5;False;2;5;False;-1;10;False;-1;0;0;False;-1;0;False;-1;-1;False;-1;-1;False;-1;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;Relative;0;;-1;-1;-1;-1;0;False;0;0;False;-1;-1;0;False;-1;0;0;15;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0;False;4;FLOAT;0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0;False;9;FLOAT;0;False;10;FLOAT;0;False;13;FLOAT3;0,0,0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
  64. WireConnection;6;0;3;0
  65. WireConnection;8;0;6;0
  66. WireConnection;9;0;5;4
  67. WireConnection;9;1;4;4
  68. WireConnection;9;2;8;0
  69. WireConnection;9;3;10;4
  70. WireConnection;7;0;5;0
  71. WireConnection;7;1;4;0
  72. WireConnection;7;2;10;0
  73. WireConnection;2;2;7;0
  74. WireConnection;2;9;9;0
  75. ASEEND*/
  76. //CHKSM=69126B8B5ACA4BD258A859F2261767A32A5C28CE