FT_EmissionChannel.shader 6.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. // Shader created with Shader Forge v1.05
  3. // Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
  4. // Note: Manually altering this data may prevent you from opening it in Shader Forge
  5. /*SF_DATA;ver:1.05;sub:START;pass:START;ps:flbk:,lico:1,lgpr:1,nrmq:1,limd:0,uamb:True,mssp:True,lmpd:False,lprd:False,rprd:False,enco:False,frtr:True,vitr:True,dbil:False,rmgx:True,rpth:0,hqsc:True,hqlp:False,tesm:0,blpr:2,bsrc:0,bdst:0,culm:0,dpts:2,wrdp:False,dith:2,ufog:True,aust:True,igpj:True,qofs:0,qpre:3,rntp:2,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,ofsf:0,ofsu:0,f2p0:False;n:type:ShaderForge.SFN_Final,id:1457,x:33288,y:32719,varname:node_1457,prsc:2|emission-9525-OUT;n:type:ShaderForge.SFN_Tex2d,id:2230,x:31727,y:32709,ptovrint:False,ptlb:Texture,ptin:_Texture,varname:node_2230,prsc:2,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Color,id:5327,x:31909,y:33055,ptovrint:False,ptlb:Color_R,ptin:_Color_R,varname:node_5327,prsc:2,glob:False,c1:1,c2:0.3529412,c3:0,c4:1;n:type:ShaderForge.SFN_ValueProperty,id:8967,x:32605,y:32665,ptovrint:False,ptlb:Emission,ptin:_Emission,varname:node_8967,prsc:2,glob:False,v1:16;n:type:ShaderForge.SFN_VertexColor,id:3762,x:32684,y:33066,varname:node_3762,prsc:2;n:type:ShaderForge.SFN_Multiply,id:9525,x:33108,y:32797,varname:node_9525,prsc:2|A-8511-OUT,B-3762-RGB,C-3762-A,D-8967-OUT,E-8363-OUT;n:type:ShaderForge.SFN_Multiply,id:4821,x:32385,y:32813,varname:node_4821,prsc:2|A-3144-OUT,B-5327-RGB;n:type:ShaderForge.SFN_Multiply,id:6442,x:32385,y:32980,varname:node_6442,prsc:2|A-2319-OUT,B-5203-RGB;n:type:ShaderForge.SFN_Color,id:5203,x:31913,y:33229,ptovrint:False,ptlb:Color_G,ptin:_Color_G,varname:node_5203,prsc:2,glob:False,c1:0.1623053,c2:1,c3:0.06617647,c4:1;n:type:ShaderForge.SFN_Color,id:4165,x:31913,y:33425,ptovrint:False,ptlb:Color_B,ptin:_Color_B,varname:node_4165,prsc:2,glob:False,c1:0.1017182,c2:0.04880831,c3:0.9482759,c4:1;n:type:ShaderForge.SFN_Multiply,id:7646,x:32385,y:33166,varname:node_7646,prsc:2|A-8730-OUT,B-4165-RGB;n:type:ShaderForge.SFN_Add,id:8511,x:32672,y:32865,varname:node_8511,prsc:2|A-4821-OUT,B-6442-OUT,C-7646-OUT;n:type:ShaderForge.SFN_SwitchProperty,id:2319,x:32092,y:32646,ptovrint:False,ptlb:Use_Green,ptin:_Use_Green,varname:node_2319,prsc:2,on:True|A-4585-OUT,B-2230-G;n:type:ShaderForge.SFN_Vector1,id:4585,x:31813,y:32435,varname:node_4585,prsc:2,v1:0;n:type:ShaderForge.SFN_SwitchProperty,id:8730,x:32092,y:32796,ptovrint:False,ptlb:Use_Blue,ptin:_Use_Blue,varname:node_8730,prsc:2,on:True|A-4585-OUT,B-2230-B;n:type:ShaderForge.SFN_SwitchProperty,id:3144,x:32092,y:32495,ptovrint:False,ptlb:Use_Red,ptin:_Use_Red,varname:node_3144,prsc:2,on:True|A-4585-OUT,B-2230-R;n:type:ShaderForge.SFN_Slider,id:6930,x:32381,y:32525,ptovrint:False,ptlb:SoftParticle_Value,ptin:_SoftParticle_Value,varname:node_5073,prsc:2,min:0,cur:0,max:1;n:type:ShaderForge.SFN_SwitchProperty,id:8363,x:32938,y:32470,ptovrint:False,ptlb:Use_SoftPaticle,ptin:_Use_SoftPaticle,varname:node_287,prsc:2,on:False|A-1971-OUT,B-3226-OUT;n:type:ShaderForge.SFN_DepthBlend,id:3226,x:32731,y:32535,varname:node_3226,prsc:2|DIST-6930-OUT;n:type:ShaderForge.SFN_Vector1,id:1971,x:32731,y:32470,varname:node_1971,prsc:2,v1:1;proporder:2230-8967-3144-2319-8730-5327-5203-4165-8363-6930;pass:END;sub:END;*/
  6. Shader "FT/EmissionChannel" {
  7. Properties {
  8. _Texture ("Texture", 2D) = "white" {}
  9. _Emission ("Emission", Float ) = 16
  10. [MaterialToggle] _Use_Red ("Use_Red", Float ) = 1
  11. [MaterialToggle] _Use_Green ("Use_Green", Float ) = 1
  12. [MaterialToggle] _Use_Blue ("Use_Blue", Float ) = 1
  13. _Color_R ("Color_R", Color) = (1,0.3529412,0,1)
  14. _Color_G ("Color_G", Color) = (0.1623053,1,0.06617647,1)
  15. _Color_B ("Color_B", Color) = (0.1017182,0.04880831,0.9482759,1)
  16. [MaterialToggle] _Use_SoftPaticle ("Use_SoftPaticle", Float ) = 1
  17. _SoftParticle_Value ("SoftParticle_Value", Range(0, 1)) = 0
  18. }
  19. SubShader {
  20. Tags {
  21. "IgnoreProjector"="True"
  22. "Queue"="Transparent"
  23. "RenderType"="Transparent"
  24. }
  25. Pass {
  26. Name "ForwardBase"
  27. Tags {
  28. "LightMode"="ForwardBase"
  29. }
  30. Blend One One
  31. ZWrite Off
  32. CGPROGRAM
  33. #pragma vertex vert
  34. #pragma fragment frag
  35. #define UNITY_PASS_FORWARDBASE
  36. #include "UnityCG.cginc"
  37. #pragma multi_compile_fwdbase
  38. #pragma exclude_renderers xbox360 ps3 flash d3d11_9x
  39. #pragma target 3.0
  40. uniform sampler2D _CameraDepthTexture;
  41. uniform sampler2D _Texture; uniform float4 _Texture_ST;
  42. uniform float4 _Color_R;
  43. uniform float _Emission;
  44. uniform float4 _Color_G;
  45. uniform float4 _Color_B;
  46. uniform fixed _Use_Green;
  47. uniform fixed _Use_Blue;
  48. uniform fixed _Use_Red;
  49. uniform float _SoftParticle_Value;
  50. uniform fixed _Use_SoftPaticle;
  51. struct VertexInput {
  52. float4 vertex : POSITION;
  53. float2 texcoord0 : TEXCOORD0;
  54. float4 vertexColor : COLOR;
  55. };
  56. struct VertexOutput {
  57. float4 pos : SV_POSITION;
  58. float2 uv0 : TEXCOORD0;
  59. float4 vertexColor : COLOR;
  60. float4 projPos : TEXCOORD1;
  61. };
  62. VertexOutput vert (VertexInput v) {
  63. VertexOutput o = (VertexOutput)0;
  64. o.uv0 = v.texcoord0;
  65. o.vertexColor = v.vertexColor;
  66. o.pos = UnityObjectToClipPos(v.vertex);
  67. o.projPos = ComputeScreenPos (o.pos);
  68. COMPUTE_EYEDEPTH(o.projPos.z);
  69. return o;
  70. }
  71. fixed4 frag(VertexOutput i) : COLOR {
  72. float sceneZ = max(0,LinearEyeDepth (UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)))) - _ProjectionParams.g);
  73. float partZ = max(0,i.projPos.z - _ProjectionParams.g);
  74. /////// Vectors:
  75. ////// Lighting:
  76. ////// Emissive:
  77. float node_4585 = 0.0;
  78. float4 _Texture_var = tex2D(_Texture,TRANSFORM_TEX(i.uv0, _Texture));
  79. float3 emissive = (((lerp( node_4585, _Texture_var.r, _Use_Red )*_Color_R.rgb)+(lerp( node_4585, _Texture_var.g, _Use_Green )*_Color_G.rgb)+(lerp( node_4585, _Texture_var.b, _Use_Blue )*_Color_B.rgb))*i.vertexColor.rgb*i.vertexColor.a*_Emission*lerp( 1.0, saturate((sceneZ-partZ)/_SoftParticle_Value), _Use_SoftPaticle ));
  80. float3 finalColor = emissive;
  81. return fixed4(finalColor,1);
  82. }
  83. ENDCG
  84. }
  85. }
  86. FallBack "Diffuse"
  87. CustomEditor "ShaderForgeMaterialInspector"
  88. }