POLYGON_SpaceShip_Rim.shader 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "SyntyStudios/SpaceShip_Rim"
  4. {
  5. Properties
  6. {
  7. _Texture("Texture", 2D) = "white" {}
  8. _RimColor("RimColor", Color) = (0,0,0,0)
  9. _Detail("Detail", 2D) = "white" {}
  10. _DetailAmount("DetailAmount", Range( 0 , 1)) = 1
  11. _RimPower("RimPower", Range( 0 , 10)) = 2
  12. _Spec("Spec", Color) = (0,0,0,0)
  13. _Smoothness("Smoothness", Range( 0 , 1)) = 0
  14. _Emissive("Emissive", 2D) = "white" {}
  15. _EmissiveColor("Emissive Color", Color) = (0.4926471,0.4926471,0.4926471,0)
  16. [HideInInspector] _texcoord3( "", 2D ) = "white" {}
  17. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  18. [HideInInspector] __dirty( "", Int ) = 1
  19. }
  20. SubShader
  21. {
  22. Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" "IsEmissive" = "true" }
  23. Cull Back
  24. CGINCLUDE
  25. #include "UnityPBSLighting.cginc"
  26. #include "Lighting.cginc"
  27. #pragma target 3.0
  28. #ifdef UNITY_PASS_SHADOWCASTER
  29. #undef INTERNAL_DATA
  30. #undef WorldReflectionVector
  31. #undef WorldNormalVector
  32. #define INTERNAL_DATA half3 internalSurfaceTtoW0; half3 internalSurfaceTtoW1; half3 internalSurfaceTtoW2;
  33. #define WorldReflectionVector(data,normal) reflect (data.worldRefl, half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal)))
  34. #define WorldNormalVector(data,normal) half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
  35. #endif
  36. struct Input
  37. {
  38. float2 uv_texcoord;
  39. float2 uv3_texcoord3;
  40. float3 viewDir;
  41. INTERNAL_DATA
  42. };
  43. uniform sampler2D _Texture;
  44. uniform float4 _Texture_ST;
  45. uniform sampler2D _Detail;
  46. uniform float4 _Detail_ST;
  47. uniform float _DetailAmount;
  48. uniform sampler2D Normals;
  49. uniform float4 Normals_ST;
  50. uniform float _RimPower;
  51. uniform float4 _RimColor;
  52. uniform sampler2D _Emissive;
  53. uniform float4 _Emissive_ST;
  54. uniform float4 _EmissiveColor;
  55. uniform float4 _Spec;
  56. uniform float _Smoothness;
  57. void surf( Input i , inout SurfaceOutputStandard o )
  58. {
  59. o.Normal = float3(0,0,1);
  60. float2 uv_Texture = i.uv_texcoord * _Texture_ST.xy + _Texture_ST.zw;
  61. float4 color53 = IsGammaSpace() ? float4(1,1,1,0) : float4(1,1,1,0);
  62. float2 uv3_Detail = i.uv3_texcoord3 * _Detail_ST.xy + _Detail_ST.zw;
  63. float4 lerpResult33 = lerp( color53 , tex2D( _Detail, uv3_Detail, float2( 0,0 ), float2( 0,0 ) ) , _DetailAmount);
  64. o.Albedo = ( tex2D( _Texture, uv_Texture ) * lerpResult33 ).rgb;
  65. float2 uvNormals = i.uv_texcoord * Normals_ST.xy + Normals_ST.zw;
  66. float3 normalizeResult43 = normalize( i.viewDir );
  67. float dotResult44 = dot( UnpackNormal( tex2D( Normals, uvNormals ) ) , normalizeResult43 );
  68. float2 uv_Emissive = i.uv_texcoord * _Emissive_ST.xy + _Emissive_ST.zw;
  69. o.Emission = ( ( pow( ( 1.0 - saturate( dotResult44 ) ) , _RimPower ) * _RimColor ) + ( tex2D( _Emissive, uv_Emissive ) * _EmissiveColor ) ).rgb;
  70. o.Metallic = ( _Spec * float4( 0,0,0,0 ) ).r;
  71. o.Smoothness = _Smoothness;
  72. o.Alpha = 1;
  73. }
  74. ENDCG
  75. CGPROGRAM
  76. #pragma surface surf Standard keepalpha fullforwardshadows
  77. ENDCG
  78. Pass
  79. {
  80. Name "ShadowCaster"
  81. Tags{ "LightMode" = "ShadowCaster" }
  82. ZWrite On
  83. CGPROGRAM
  84. #pragma vertex vert
  85. #pragma fragment frag
  86. #pragma target 3.0
  87. #pragma multi_compile_shadowcaster
  88. #pragma multi_compile UNITY_PASS_SHADOWCASTER
  89. #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
  90. #include "HLSLSupport.cginc"
  91. #if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )
  92. #define CAN_SKIP_VPOS
  93. #endif
  94. #include "UnityCG.cginc"
  95. #include "Lighting.cginc"
  96. #include "UnityPBSLighting.cginc"
  97. struct v2f
  98. {
  99. V2F_SHADOW_CASTER;
  100. float4 customPack1 : TEXCOORD1;
  101. float4 tSpace0 : TEXCOORD2;
  102. float4 tSpace1 : TEXCOORD3;
  103. float4 tSpace2 : TEXCOORD4;
  104. UNITY_VERTEX_INPUT_INSTANCE_ID
  105. };
  106. v2f vert( appdata_full v )
  107. {
  108. v2f o;
  109. UNITY_SETUP_INSTANCE_ID( v );
  110. UNITY_INITIALIZE_OUTPUT( v2f, o );
  111. UNITY_TRANSFER_INSTANCE_ID( v, o );
  112. Input customInputData;
  113. float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
  114. half3 worldNormal = UnityObjectToWorldNormal( v.normal );
  115. half3 worldTangent = UnityObjectToWorldDir( v.tangent.xyz );
  116. half tangentSign = v.tangent.w * unity_WorldTransformParams.w;
  117. half3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;
  118. o.tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x );
  119. o.tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y );
  120. o.tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z );
  121. o.customPack1.xy = customInputData.uv_texcoord;
  122. o.customPack1.xy = v.texcoord;
  123. o.customPack1.zw = customInputData.uv3_texcoord3;
  124. o.customPack1.zw = v.texcoord2;
  125. TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
  126. return o;
  127. }
  128. half4 frag( v2f IN
  129. #if !defined( CAN_SKIP_VPOS )
  130. , UNITY_VPOS_TYPE vpos : VPOS
  131. #endif
  132. ) : SV_Target
  133. {
  134. UNITY_SETUP_INSTANCE_ID( IN );
  135. Input surfIN;
  136. UNITY_INITIALIZE_OUTPUT( Input, surfIN );
  137. surfIN.uv_texcoord = IN.customPack1.xy;
  138. surfIN.uv3_texcoord3 = IN.customPack1.zw;
  139. float3 worldPos = float3( IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w );
  140. half3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
  141. surfIN.viewDir = IN.tSpace0.xyz * worldViewDir.x + IN.tSpace1.xyz * worldViewDir.y + IN.tSpace2.xyz * worldViewDir.z;
  142. surfIN.internalSurfaceTtoW0 = IN.tSpace0.xyz;
  143. surfIN.internalSurfaceTtoW1 = IN.tSpace1.xyz;
  144. surfIN.internalSurfaceTtoW2 = IN.tSpace2.xyz;
  145. SurfaceOutputStandard o;
  146. UNITY_INITIALIZE_OUTPUT( SurfaceOutputStandard, o )
  147. surf( surfIN, o );
  148. #if defined( CAN_SKIP_VPOS )
  149. float2 vpos = IN.pos;
  150. #endif
  151. SHADOW_CASTER_FRAGMENT( IN )
  152. }
  153. ENDCG
  154. }
  155. }
  156. Fallback "Diffuse"
  157. CustomEditor "ASEMaterialInspector"
  158. }
  159. /*ASEBEGIN
  160. Version=16200
  161. 2567;32;2546;1397;1301.015;588.327;1.3;True;False
  162. Node;AmplifyShaderEditor.ViewDirInputsCoordNode;41;-340.9191,-924.5035;Float;False;Tangent;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
  163. Node;AmplifyShaderEditor.SamplerNode;42;-340.9191,-1196.504;Float;True;Global;Normals;Normals;5;0;Create;True;0;0;False;0;None;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;0,0;False;1;FLOAT2;1,0;False;2;FLOAT;1;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  164. Node;AmplifyShaderEditor.NormalizeNode;43;-118.222,-927.6034;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
  165. Node;AmplifyShaderEditor.DotProductOpNode;44;73.47791,-1006.004;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0
  166. Node;AmplifyShaderEditor.SaturateNode;45;248.6774,-1030.504;Float;False;1;0;FLOAT;1.23;False;1;FLOAT;0
  167. Node;AmplifyShaderEditor.RangedFloatNode;47;321.0787,-872.8041;Float;False;Property;_RimPower;RimPower;4;0;Create;True;0;0;False;0;2;3.01;0;10;0;1;FLOAT;0
  168. Node;AmplifyShaderEditor.OneMinusNode;46;417.6804,-988.2048;Float;False;1;0;FLOAT;0;False;1;FLOAT;0
  169. Node;AmplifyShaderEditor.ColorNode;49;604.2787,-785.0047;Float;False;Property;_RimColor;RimColor;1;0;Create;True;0;0;False;0;0,0,0,0;0.1614143,0.1380298,0.8161765,0;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  170. Node;AmplifyShaderEditor.PowerNode;48;610.4781,-964.8038;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
  171. Node;AmplifyShaderEditor.ColorNode;29;73.40263,648.8723;Float;False;Property;_EmissiveColor;Emissive Color;9;0;Create;True;0;0;False;0;0.4926471,0.4926471,0.4926471,0;1,1,1,0;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  172. Node;AmplifyShaderEditor.SamplerNode;27;70.88784,431.2822;Float;True;Property;_Emissive;Emissive;8;0;Create;True;0;0;False;0;84508b93f15f2b64386ec07486afc7a3;7a170cdb7cc88024cb628cfcdbb6705c;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;1;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
  173. Node;AmplifyShaderEditor.ColorNode;53;57.48351,-48.82599;Float;False;Constant;_Color0;Color 0;10;0;Create;True;0;0;False;0;1,1,1,0;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  174. Node;AmplifyShaderEditor.RangedFloatNode;22;53.67255,340.2063;Float;False;Property;_DetailAmount;DetailAmount;3;0;Create;True;0;0;False;0;1;1;0;1;0;1;FLOAT;0
  175. Node;AmplifyShaderEditor.SamplerNode;19;45.94752,129.7363;Float;True;Property;_Detail;Detail;2;0;Create;True;0;0;False;0;84508b93f15f2b64386ec07486afc7a3;1e98a8c6cf7c7614e9cc8a41b88160a4;True;2;False;white;Auto;False;Object;-1;Derivative;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;1;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
  176. Node;AmplifyShaderEditor.SamplerNode;7;48.10994,-616.7598;Float;True;Property;_Texture;Texture;0;0;Create;True;0;0;False;0;84508b93f15f2b64386ec07486afc7a3;936bffa65ef866a43969ea77c103adb3;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;1;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
  177. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;50;852.8785,-949.6043;Float;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  178. Node;AmplifyShaderEditor.ColorNode;36;57.09566,-356.5158;Float;False;Property;_Spec;Spec;6;0;Create;True;0;0;False;0;0,0,0,0;1,1,1,0;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  179. Node;AmplifyShaderEditor.LerpOp;33;529.0709,112.9396;Float;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
  180. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;28;572.3224,436.2078;Float;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  181. Node;AmplifyShaderEditor.SimpleAddOpNode;51;836.8489,-331.5538;Float;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  182. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;52;718.1613,-601.5464;Float;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  183. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;37;442.3606,-353.8864;Float;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  184. Node;AmplifyShaderEditor.RangedFloatNode;40;46.51579,-176.7621;Float;False;Property;_Smoothness;Smoothness;7;0;Create;True;0;0;False;0;0;0.499;0;1;0;1;FLOAT;0
  185. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;1047.167,-598.0992;Float;False;True;2;Float;ASEMaterialInspector;0;0;Standard;SyntyStudios/SpaceShip_Rim;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;Back;0;False;-1;0;False;-1;False;0;False;-1;0;False;-1;False;0;Opaque;0.5;True;True;0;False;Opaque;;Geometry;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;True;0;0;False;-1;0;False;-1;0;0;False;-1;0;False;-1;0;False;-1;0;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;0;16;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;5;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
  186. WireConnection;43;0;41;0
  187. WireConnection;44;0;42;0
  188. WireConnection;44;1;43;0
  189. WireConnection;45;0;44;0
  190. WireConnection;46;0;45;0
  191. WireConnection;48;0;46;0
  192. WireConnection;48;1;47;0
  193. WireConnection;50;0;48;0
  194. WireConnection;50;1;49;0
  195. WireConnection;33;0;53;0
  196. WireConnection;33;1;19;0
  197. WireConnection;33;2;22;0
  198. WireConnection;28;0;27;0
  199. WireConnection;28;1;29;0
  200. WireConnection;51;0;50;0
  201. WireConnection;51;1;28;0
  202. WireConnection;52;0;7;0
  203. WireConnection;52;1;33;0
  204. WireConnection;37;0;36;0
  205. WireConnection;0;0;52;0
  206. WireConnection;0;2;51;0
  207. WireConnection;0;3;37;0
  208. WireConnection;0;4;40;0
  209. ASEEND*/
  210. //CHKSM=208F40AC8B052F2F1E62AE98A4766C537E1CC5CB