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.

109 lines
4.8 KiB

  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "ASESampleShaders/Transmission"
  4. {
  5. Properties
  6. {
  7. [HideInInspector] __dirty( "", Int ) = 1
  8. _Transmission("Transmission", Color) = (0,0,0,0)
  9. _NormalMap("Normal Map", 2D) = "bump" {}
  10. _Color("Color", Color) = (0,0,0,0)
  11. _BaseColor("Base Color", 2D) = "white" {}
  12. _Metallic("Metallic", Range( 0 , 1)) = 0
  13. _Gloss("Gloss", Range( 0 , 1)) = 0.8
  14. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  15. }
  16. SubShader
  17. {
  18. Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" }
  19. Cull Back
  20. ZTest LEqual
  21. CGPROGRAM
  22. #include "UnityPBSLighting.cginc"
  23. #pragma target 3.0
  24. #pragma surface surf StandardCustom keepalpha addshadow fullforwardshadows exclude_path:deferred
  25. struct Input
  26. {
  27. float2 uv_texcoord;
  28. };
  29. struct SurfaceOutputStandardCustom
  30. {
  31. fixed3 Albedo;
  32. fixed3 Normal;
  33. half3 Emission;
  34. half Metallic;
  35. half Smoothness;
  36. half Occlusion;
  37. fixed Alpha;
  38. fixed3 Transmission;
  39. };
  40. uniform sampler2D _NormalMap;
  41. uniform float4 _NormalMap_ST;
  42. uniform sampler2D _BaseColor;
  43. uniform float4 _BaseColor_ST;
  44. uniform fixed4 _Color;
  45. uniform fixed _Metallic;
  46. uniform fixed _Gloss;
  47. uniform fixed4 _Transmission;
  48. inline half4 LightingStandardCustom(SurfaceOutputStandardCustom s, half3 viewDir, UnityGI gi )
  49. {
  50. half3 transmission = max(0 , -dot(s.Normal, gi.light.dir)) * gi.light.color * s.Transmission;
  51. half4 d = half4(s.Albedo * transmission , 0);
  52. SurfaceOutputStandard r;
  53. r.Albedo = s.Albedo;
  54. r.Normal = s.Normal;
  55. r.Emission = s.Emission;
  56. r.Metallic = s.Metallic;
  57. r.Smoothness = s.Smoothness;
  58. r.Occlusion = s.Occlusion;
  59. r.Alpha = s.Alpha;
  60. return LightingStandard (r, viewDir, gi) + d;
  61. }
  62. inline void LightingStandardCustom_GI(SurfaceOutputStandardCustom s, UnityGIInput data, inout UnityGI gi )
  63. {
  64. UNITY_GI(gi, s, data);
  65. }
  66. void surf( Input i , inout SurfaceOutputStandardCustom o )
  67. {
  68. float2 uv_NormalMap = i.uv_texcoord * _NormalMap_ST.xy + _NormalMap_ST.zw;
  69. o.Normal = UnpackNormal( tex2D( _NormalMap, uv_NormalMap ) );
  70. float2 uv_BaseColor = i.uv_texcoord * _BaseColor_ST.xy + _BaseColor_ST.zw;
  71. o.Albedo = ( tex2D( _BaseColor, uv_BaseColor ) * _Color ).xyz;
  72. o.Metallic = _Metallic;
  73. o.Smoothness = _Gloss;
  74. o.Transmission = _Transmission.rgb;
  75. o.Alpha = 1;
  76. }
  77. ENDCG
  78. }
  79. Fallback "Diffuse"
  80. CustomEditor "ASEMaterialInspector"
  81. }
  82. /*ASEBEGIN
  83. Version=12003
  84. 0;92;1541;926;1195.518;334.1495;1.3;False;False
  85. Node;AmplifyShaderEditor.SamplerNode;1;-823.954,-122.8771;Float;True;Property;_BaseColor;Base Color;3;0;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;0,0;False;1;FLOAT2;1.0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;FLOAT4;FLOAT;FLOAT;FLOAT;FLOAT
  86. Node;AmplifyShaderEditor.ColorNode;2;-716.0739,66.4277;Float;False;Property;_Color;Color;2;0;0,0,0,0;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
  87. Node;AmplifyShaderEditor.ColorNode;7;-372.3347,513.6476;Float;False;Property;_Transmission;Transmission;-1;0;0,0,0,0;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
  88. Node;AmplifyShaderEditor.SamplerNode;6;-513.9389,303.0193;Float;True;Property;_NormalMap;Normal Map;1;0;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;0,0;False;1;FLOAT2;1.0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;FLOAT3;FLOAT;FLOAT;FLOAT;FLOAT
  89. Node;AmplifyShaderEditor.RangedFloatNode;5;-429.0605,215.0723;Float;False;Property;_Gloss;Gloss;5;0;0.8;0;1;0;1;FLOAT
  90. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;3;-422.3381,-5.544991;Float;False;2;2;0;FLOAT4;0.0,0,0,0;False;1;COLOR;0.0,0,0,0;False;1;FLOAT4
  91. Node;AmplifyShaderEditor.RangedFloatNode;4;-430.4556,117.6564;Float;False;Property;_Metallic;Metallic;4;0;0;0;1;0;1;FLOAT
  92. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;80.91907,-11.16125;Fixed;False;True;2;Fixed;ASEMaterialInspector;0;Standard;ASESampleShaders/Transmission;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;Back;0;3;False;0;0;Opaque;0.5;True;True;0;False;Opaque;Geometry;ForwardOnly;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,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0.0;False;9;FLOAT;0.0;False;10;OBJECT;0.0;False;11;FLOAT3;0.0,0,0;False;12;FLOAT3;0.0,0,0;False;14;FLOAT4;0.0,0,0,0;False;15;FLOAT3;0,0,0;False;0
  93. WireConnection;3;0;1;0
  94. WireConnection;3;1;2;0
  95. WireConnection;0;0;3;0
  96. WireConnection;0;1;6;0
  97. WireConnection;0;3;4;0
  98. WireConnection;0;4;5;0
  99. WireConnection;0;6;7;0
  100. ASEEND*/
  101. //CHKSM=D1ACCDDD4FB9E49D2BA42BFCF930909C3D4897DA