You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

190 lines
9.5 KiB

  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "ASESampleShaders/Transparency"
  4. {
  5. Properties
  6. {
  7. [HideInInspector] __dirty( "", Int ) = 1
  8. _UVOffset1("UVOffset1", Vector) = (-0.1,-0.1,-0.1,0)
  9. _TextureSample3("Texture Sample 3", CUBE) = "white" {}
  10. _Opacity("Opacity", Range( 0 , 1)) = 1
  11. _Smoothness("Smoothness", Range( 0 , 1)) = 0
  12. _TextureSample1("Texture Sample 1", CUBE) = "white" {}
  13. _char_woodman_normals("char_woodman_normals", 2D) = "bump" {}
  14. _Cubemap("Cubemap", CUBE) = "white" {}
  15. _UVOffset0("UVOffset0", Vector) = (0.07,0.1,0.1,0)
  16. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  17. }
  18. SubShader
  19. {
  20. Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+0" "IgnoreProjector" = "True" "IsEmissive" = "true" }
  21. Cull Back
  22. CGINCLUDE
  23. #include "UnityPBSLighting.cginc"
  24. #include "Lighting.cginc"
  25. #pragma target 3.0
  26. #ifdef UNITY_PASS_SHADOWCASTER
  27. #undef INTERNAL_DATA
  28. #undef WorldReflectionVector
  29. #undef WorldNormalVector
  30. #define INTERNAL_DATA half3 internalSurfaceTtoW0; half3 internalSurfaceTtoW1; half3 internalSurfaceTtoW2;
  31. #define WorldReflectionVector(data,normal) reflect (data.worldRefl, half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal)))
  32. #define WorldNormalVector(data,normal) fixed3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
  33. #endif
  34. struct Input
  35. {
  36. float2 uv_texcoord;
  37. float3 worldRefl;
  38. INTERNAL_DATA
  39. };
  40. uniform sampler2D _char_woodman_normals;
  41. uniform float4 _char_woodman_normals_ST;
  42. uniform samplerCUBE _TextureSample1;
  43. uniform float3 _UVOffset0;
  44. uniform samplerCUBE _Cubemap;
  45. uniform samplerCUBE _TextureSample3;
  46. uniform float3 _UVOffset1;
  47. uniform float _Smoothness;
  48. uniform float _Opacity;
  49. void surf( Input i , inout SurfaceOutputStandard o )
  50. {
  51. float2 uv_char_woodman_normals = i.uv_texcoord * _char_woodman_normals_ST.xy + _char_woodman_normals_ST.zw;
  52. o.Normal = UnpackNormal( tex2D( _char_woodman_normals, uv_char_woodman_normals ) );
  53. o.Albedo = float4(1,1,1,0).rgb;
  54. float3 tex2DNode10 = UnpackNormal( tex2D( _char_woodman_normals, uv_char_woodman_normals ) );
  55. float3 worldrefVec9 = WorldReflectionVector( i , tex2DNode10 );
  56. float3 appendResult32 = (float3(texCUBE( _TextureSample1, ( worldrefVec9 + _UVOffset0 ) ).r , texCUBE( _Cubemap, worldrefVec9 ).g , texCUBE( _TextureSample3, ( worldrefVec9 + _UVOffset1 ) ).b));
  57. o.Emission = appendResult32;
  58. o.Metallic = 1.0;
  59. o.Smoothness = _Smoothness;
  60. o.Alpha = _Opacity;
  61. }
  62. ENDCG
  63. CGPROGRAM
  64. #pragma surface surf Standard alpha:fade keepalpha fullforwardshadows
  65. ENDCG
  66. Pass
  67. {
  68. Name "ShadowCaster"
  69. Tags{ "LightMode" = "ShadowCaster" }
  70. ZWrite On
  71. CGPROGRAM
  72. #pragma vertex vert
  73. #pragma fragment frag
  74. #pragma target 3.0
  75. #pragma multi_compile_shadowcaster
  76. #pragma multi_compile UNITY_PASS_SHADOWCASTER
  77. #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
  78. # include "HLSLSupport.cginc"
  79. #if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )
  80. #define CAN_SKIP_VPOS
  81. #endif
  82. #include "UnityCG.cginc"
  83. #include "Lighting.cginc"
  84. #include "UnityPBSLighting.cginc"
  85. sampler3D _DitherMaskLOD;
  86. struct v2f
  87. {
  88. V2F_SHADOW_CASTER;
  89. float3 worldPos : TEXCOORD6;
  90. float4 tSpace0 : TEXCOORD1;
  91. float4 tSpace1 : TEXCOORD2;
  92. float4 tSpace2 : TEXCOORD3;
  93. float4 texcoords01 : TEXCOORD4;
  94. UNITY_VERTEX_INPUT_INSTANCE_ID
  95. };
  96. v2f vert( appdata_full v )
  97. {
  98. v2f o;
  99. UNITY_SETUP_INSTANCE_ID( v );
  100. UNITY_INITIALIZE_OUTPUT( v2f, o );
  101. UNITY_TRANSFER_INSTANCE_ID( v, o );
  102. float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
  103. half3 worldNormal = UnityObjectToWorldNormal( v.normal );
  104. fixed3 worldTangent = UnityObjectToWorldDir( v.tangent.xyz );
  105. fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
  106. fixed3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;
  107. o.tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x );
  108. o.tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y );
  109. o.tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z );
  110. o.texcoords01 = float4( v.texcoord.xy, v.texcoord1.xy );
  111. o.worldPos = worldPos;
  112. TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
  113. return o;
  114. }
  115. fixed4 frag( v2f IN
  116. #if !defined( CAN_SKIP_VPOS )
  117. , UNITY_VPOS_TYPE vpos : VPOS
  118. #endif
  119. ) : SV_Target
  120. {
  121. UNITY_SETUP_INSTANCE_ID( IN );
  122. Input surfIN;
  123. UNITY_INITIALIZE_OUTPUT( Input, surfIN );
  124. surfIN.uv_texcoord.xy = IN.texcoords01.xy;
  125. float3 worldPos = float3( IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w );
  126. fixed3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
  127. surfIN.worldRefl = -worldViewDir;
  128. surfIN.internalSurfaceTtoW0 = IN.tSpace0.xyz;
  129. surfIN.internalSurfaceTtoW1 = IN.tSpace1.xyz;
  130. surfIN.internalSurfaceTtoW2 = IN.tSpace2.xyz;
  131. SurfaceOutputStandard o;
  132. UNITY_INITIALIZE_OUTPUT( SurfaceOutputStandard, o )
  133. surf( surfIN, o );
  134. #if defined( CAN_SKIP_VPOS )
  135. float2 vpos = IN.pos;
  136. #endif
  137. half alphaRef = tex3D( _DitherMaskLOD, float3( vpos.xy * 0.25, o.Alpha * 0.9375 ) ).a;
  138. clip( alphaRef - 0.01 );
  139. SHADOW_CASTER_FRAGMENT( IN )
  140. }
  141. ENDCG
  142. }
  143. }
  144. Fallback "Diffuse"
  145. CustomEditor "ASEMaterialInspector"
  146. }
  147. /*ASEBEGIN
  148. Version=12003
  149. 0;92;1541;926;1371.115;369.9559;1.6;False;False
  150. Node;AmplifyShaderEditor.SamplerNode;10;-1400.201,-39.50001;Float;True;Property;_char_woodman_normals;char_woodman_normals;-1;0;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;1.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;FLOAT3;FLOAT;FLOAT;FLOAT;FLOAT
  151. Node;AmplifyShaderEditor.WorldReflectionVector;9;-1042.699,194.6001;Float;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;FLOAT;FLOAT;FLOAT
  152. Node;AmplifyShaderEditor.Vector3Node;25;-1009.816,641.7439;Float;False;Property;_UVOffset1;UVOffset1;-1;0;-0.1,-0.1,-0.1;0;4;FLOAT3;FLOAT;FLOAT;FLOAT
  153. Node;AmplifyShaderEditor.Vector3Node;24;-1001.816,470.7439;Float;False;Property;_UVOffset0;UVOffset0;-1;0;0.07,0.1,0.1;0;4;FLOAT3;FLOAT;FLOAT;FLOAT
  154. Node;AmplifyShaderEditor.SimpleAddOpNode;26;-741.8156,623.7439;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0.0,0,0;False;1;FLOAT3
  155. Node;AmplifyShaderEditor.SimpleAddOpNode;23;-742.4155,168.1439;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0.0,0,0;False;1;FLOAT3
  156. Node;AmplifyShaderEditor.SamplerNode;1;-568.5999,323.5997;Float;True;Property;_Cubemap;Cubemap;-1;0;None;True;0;False;white;Auto;False;Object;-1;Auto;Cube;6;0;SAMPLER2D;0,0;False;1;FLOAT3;1.0;False;2;FLOAT;1.0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT;1.0;False;5;FLOAT4;FLOAT;FLOAT;FLOAT;FLOAT
  157. Node;AmplifyShaderEditor.SamplerNode;20;-566.8156,525.7439;Float;True;Property;_TextureSample3;Texture Sample 3;-1;0;None;True;0;False;white;Auto;False;Object;-1;Auto;Cube;6;0;SAMPLER2D;0,0;False;1;FLOAT3;1.0;False;2;FLOAT;1.0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT;1.0;False;5;FLOAT4;FLOAT;FLOAT;FLOAT;FLOAT
  158. Node;AmplifyShaderEditor.SamplerNode;19;-554.3158,130.5439;Float;True;Property;_TextureSample1;Texture Sample 1;-1;0;None;True;0;False;white;Auto;False;Object;-1;Auto;Cube;6;0;SAMPLER2D;0,0;False;1;FLOAT3;1.0;False;2;FLOAT;1.0;False;3;FLOAT3;0,0,0;False;4;FLOAT3;0,0,0;False;5;FLOAT;1.0;False;5;FLOAT4;FLOAT;FLOAT;FLOAT;FLOAT
  159. Node;AmplifyShaderEditor.DynamicAppendNode;32;-158.3146,278.6447;Float;False;FLOAT3;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT3
  160. Node;AmplifyShaderEditor.RangedFloatNode;17;67.48333,164.5437;Float;False;Constant;_Metallic;Metallic;-1;0;1;0;1;0;1;FLOAT
  161. Node;AmplifyShaderEditor.WireNode;33;57.68502,89.24414;Float;False;1;0;FLOAT3;0.0;False;1;FLOAT3
  162. Node;AmplifyShaderEditor.ColorNode;16;94.68337,-258.8558;Float;False;Constant;_Color0;Color 0;-1;0;1,1,1,0;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
  163. Node;AmplifyShaderEditor.RangedFloatNode;18;75.28323,256.344;Float;False;Property;_Smoothness;Smoothness;-1;0;0;0;1;0;1;FLOAT
  164. Node;AmplifyShaderEditor.RangedFloatNode;14;82.88092,353.6438;Float;False;Property;_Opacity;Opacity;-1;0;1;0;1;0;1;FLOAT
  165. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;559.4,-96.99998;Float;False;True;2;Float;ASEMaterialInspector;0;Standard;ASESampleShaders/Transparency;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;False;False;Back;0;3;False;0;0;Transparent;0.5;True;True;0;False;Transparent;Transparent;All;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;False;0;255;255;0;0;0;0;False;0;4;10;25;False;0.5;True;0;Zero;Zero;0;Zero;Zero;Add;Add;0;False;0;0,0,0,0;VertexOffset;False;Cylindrical;False;Relative;0;;-1;-1;-1;-1;0;0;15;0;FLOAT3;0,0,0;False;1;FLOAT3;0.0;False;2;FLOAT3;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT3;0.0;False;7;FLOAT3;0.0;False;8;FLOAT;0.0;False;9;FLOAT;0,0,0;False;10;OBJECT;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
  166. WireConnection;9;0;10;0
  167. WireConnection;26;0;9;0
  168. WireConnection;26;1;25;0
  169. WireConnection;23;0;9;0
  170. WireConnection;23;1;24;0
  171. WireConnection;1;1;9;0
  172. WireConnection;20;1;26;0
  173. WireConnection;19;1;23;0
  174. WireConnection;32;0;19;1
  175. WireConnection;32;1;1;2
  176. WireConnection;32;2;20;3
  177. WireConnection;33;0;32;0
  178. WireConnection;0;0;16;0
  179. WireConnection;0;1;10;0
  180. WireConnection;0;2;33;0
  181. WireConnection;0;3;17;0
  182. WireConnection;0;4;18;0
  183. WireConnection;0;9;14;0
  184. ASEEND*/
  185. //CHKSM=EA918958D151C229CBAECAFC7F62CCF6E9541F85