FT_Panner_DoubleSide.shader 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
  2. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  3. // Shader created with Shader Forge v1.05
  4. // Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
  5. // Note: Manually altering this data may prevent you from opening it in Shader Forge
  6. /*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:2,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:8272,x:33577,y:32755,varname:node_8272,prsc:2|emission-3506-OUT;n:type:ShaderForge.SFN_Tex2d,id:8575,x:32399,y:32980,ptovrint:False,ptlb:Texture,ptin:_Texture,varname:node_8575,prsc:2,ntxv:0,isnm:False|UVIN-3629-OUT;n:type:ShaderForge.SFN_Lerp,id:5816,x:32598,y:32980,varname:node_5816,prsc:2|A-1338-OUT,B-8575-RGB,T-8575-A;n:type:ShaderForge.SFN_Vector1,id:1338,x:32388,y:32887,varname:node_1338,prsc:2,v1:0;n:type:ShaderForge.SFN_Time,id:3530,x:31714,y:33309,varname:node_3530,prsc:2;n:type:ShaderForge.SFN_Multiply,id:2466,x:32007,y:33201,varname:node_2466,prsc:2|A-1875-OUT,B-3530-T;n:type:ShaderForge.SFN_ValueProperty,id:5788,x:31594,y:33119,ptovrint:False,ptlb:X_speed,ptin:_X_speed,varname:node_5788,prsc:2,glob:False,v1:1;n:type:ShaderForge.SFN_ValueProperty,id:6571,x:31594,y:33222,ptovrint:False,ptlb:Y_speed,ptin:_Y_speed,varname:node_6571,prsc:2,glob:False,v1:2;n:type:ShaderForge.SFN_Append,id:1875,x:31825,y:33156,varname:node_1875,prsc:2|A-5788-OUT,B-6571-OUT;n:type:ShaderForge.SFN_TexCoord,id:3955,x:32013,y:33015,varname:node_3955,prsc:2,uv:0;n:type:ShaderForge.SFN_Add,id:3629,x:32200,y:33071,varname:node_3629,prsc:2|A-3955-UVOUT,B-2466-OUT;n:type:ShaderForge.SFN_Multiply,id:4899,x:32780,y:32980,varname:node_4899,prsc:2|A-5816-OUT,B-2145-RGB,C-9543-RGB,D-6383-OUT,E-2145-A;n:type:ShaderForge.SFN_ValueProperty,id:6383,x:32596,y:33429,ptovrint:False,ptlb:Emission,ptin:_Emission,varname:node_6383,prsc:2,glob:False,v1:1;n:type:ShaderForge.SFN_VertexColor,id:2145,x:32596,y:33109,varname:node_2145,prsc:2;n:type:ShaderForge.SFN_Color,id:9543,x:32596,y:33259,ptovrint:False,ptlb:Color,ptin:_Color,varname:node_9543,prsc:2,glob:False,c1:0.5,c2:0.5,c3:0.5,c4:1;n:type:ShaderForge.SFN_Fresnel,id:2301,x:32586,y:32709,varname:node_2301,prsc:2|EXP-8082-OUT;n:type:ShaderForge.SFN_Multiply,id:3506,x:33339,y:32847,varname:node_3506,prsc:2|A-7994-OUT,B-4899-OUT,C-3807-OUT;n:type:ShaderForge.SFN_OneMinus,id:5918,x:32743,y:32709,varname:node_5918,prsc:2|IN-2301-OUT;n:type:ShaderForge.SFN_Vector1,id:8082,x:32351,y:32732,varname:node_8082,prsc:2,v1:5;n:type:ShaderForge.SFN_Power,id:4684,x:32915,y:32709,varname:node_4684,prsc:2|VAL-5918-OUT,EXP-3093-OUT;n:type:ShaderForge.SFN_ValueProperty,id:3093,x:32694,y:32886,ptovrint:False,ptlb:Fresnel_Strength,ptin:_Fresnel_Strength,varname:node_3093,prsc:2,glob:False,v1:5;n:type:ShaderForge.SFN_SwitchProperty,id:7994,x:33163,y:32750,ptovrint:False,ptlb:Use_Fresnel,ptin:_Use_Fresnel,varname:node_7994,prsc:2,on:True|A-5455-OUT,B-4684-OUT;n:type:ShaderForge.SFN_Vector1,id:5455,x:32979,y:32637,varname:node_5455,prsc:2,v1:1;n:type:ShaderForge.SFN_Slider,id:762,x:32800,y:33228,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:3807,x:33357,y:33173,ptovrint:False,ptlb:Use_SoftPaticle,ptin:_Use_SoftPaticle,varname:node_287,prsc:2,on:False|A-1220-OUT,B-9515-OUT;n:type:ShaderForge.SFN_DepthBlend,id:9515,x:33150,y:33238,varname:node_9515,prsc:2|DIST-762-OUT;n:type:ShaderForge.SFN_Vector1,id:1220,x:33150,y:33173,varname:node_1220,prsc:2,v1:1;proporder:9543-8575-6383-5788-6571-7994-3093-3807-762;pass:END;sub:END;*/
  7. Shader "FT/Panner_DoubleSide" {
  8. Properties {
  9. _Color ("Color", Color) = (0.5,0.5,0.5,1)
  10. _Texture ("Texture", 2D) = "white" {}
  11. _Emission ("Emission", Float ) = 1
  12. _X_speed ("X_speed", Float ) = 1
  13. _Y_speed ("Y_speed", Float ) = 2
  14. [MaterialToggle] _Use_Fresnel ("Use_Fresnel", Float ) = 0
  15. _Fresnel_Strength ("Fresnel_Strength", Float ) = 5
  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. Cull Off
  32. ZWrite Off
  33. CGPROGRAM
  34. #pragma vertex vert
  35. #pragma fragment frag
  36. #define UNITY_PASS_FORWARDBASE
  37. #include "UnityCG.cginc"
  38. #pragma multi_compile_fwdbase
  39. #pragma exclude_renderers xbox360 ps3 flash d3d11_9x
  40. #pragma target 3.0
  41. uniform sampler2D _CameraDepthTexture;
  42. uniform float4 _TimeEditor;
  43. uniform sampler2D _Texture; uniform float4 _Texture_ST;
  44. uniform float _X_speed;
  45. uniform float _Y_speed;
  46. uniform float _Emission;
  47. uniform float4 _Color;
  48. uniform float _Fresnel_Strength;
  49. uniform fixed _Use_Fresnel;
  50. uniform float _SoftParticle_Value;
  51. uniform fixed _Use_SoftPaticle;
  52. struct VertexInput {
  53. float4 vertex : POSITION;
  54. float3 normal : NORMAL;
  55. float2 texcoord0 : TEXCOORD0;
  56. float4 vertexColor : COLOR;
  57. };
  58. struct VertexOutput {
  59. float4 pos : SV_POSITION;
  60. float2 uv0 : TEXCOORD0;
  61. float4 posWorld : TEXCOORD1;
  62. float3 normalDir : TEXCOORD2;
  63. float4 vertexColor : COLOR;
  64. float4 projPos : TEXCOORD3;
  65. };
  66. VertexOutput vert (VertexInput v) {
  67. VertexOutput o = (VertexOutput)0;
  68. o.uv0 = v.texcoord0;
  69. o.vertexColor = v.vertexColor;
  70. o.normalDir = mul(unity_ObjectToWorld, float4(v.normal,0)).xyz;
  71. o.posWorld = mul(unity_ObjectToWorld, v.vertex);
  72. o.pos = UnityObjectToClipPos(v.vertex);
  73. o.projPos = ComputeScreenPos (o.pos);
  74. COMPUTE_EYEDEPTH(o.projPos.z);
  75. return o;
  76. }
  77. fixed4 frag(VertexOutput i) : COLOR {
  78. i.normalDir = normalize(i.normalDir);
  79. float sceneZ = max(0,LinearEyeDepth (UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)))) - _ProjectionParams.g);
  80. float partZ = max(0,i.projPos.z - _ProjectionParams.g);
  81. /////// Vectors:
  82. float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
  83. float3 normalDirection = i.normalDir;
  84. float nSign = sign( dot( viewDirection, i.normalDir ) ); // Reverse normal if this is a backface
  85. i.normalDir *= nSign;
  86. normalDirection *= nSign;
  87. ////// Lighting:
  88. ////// Emissive:
  89. float node_1338 = 0.0;
  90. float4 node_3530 = _Time + _TimeEditor;
  91. float2 node_3629 = (i.uv0+(float2(_X_speed,_Y_speed)*node_3530.g));
  92. float4 _Texture_var = tex2D(_Texture,TRANSFORM_TEX(node_3629, _Texture));
  93. float3 emissive = (lerp( 1.0, pow((1.0 - pow(1.0-max(0,dot(normalDirection, viewDirection)),5.0)),_Fresnel_Strength), _Use_Fresnel )*(lerp(float3(node_1338,node_1338,node_1338),_Texture_var.rgb,_Texture_var.a)*i.vertexColor.rgb*_Color.rgb*_Emission*i.vertexColor.a)*lerp( 1.0, saturate((sceneZ-partZ)/_SoftParticle_Value), _Use_SoftPaticle ));
  94. float3 finalColor = emissive;
  95. return fixed4(finalColor,1);
  96. }
  97. ENDCG
  98. }
  99. }
  100. FallBack "Diffuse"
  101. CustomEditor "ShaderForgeMaterialInspector"
  102. }