Assignment for RMIT Mixed Reality in 2020
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.

252 lines
15 KiB

  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "ASESampleShaders/Community/TFHC/Highlight Animated"
  4. {
  5. Properties
  6. {
  7. [HideInInspector] __dirty( "", Int ) = 1
  8. _Color("Color", Color) = (0.9044118,0.6640914,0.03325041,0)
  9. _Albedo("Albedo", 2D) = "white" {}
  10. _Normal("Normal", 2D) = "bump" {}
  11. _Emission("Emission", 2D) = "black" {}
  12. _Oclussion("Oclussion", 2D) = "white" {}
  13. _HighlightColor("Highlight Color", Color) = (0.7065311,0.9705882,0.9596617,1)
  14. _MinHighLightLevel("MinHighLightLevel", Range( 0 , 1)) = 0.8
  15. _MaxHighLightLevel("MaxHighLightLevel", Range( 0 , 1)) = 0.9
  16. _HighlightSpeed("Highlight Speed", Range( 0 , 200)) = 60
  17. [Toggle]_Highlighted("Highlighted", Float) = 0
  18. }
  19. SubShader
  20. {
  21. Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" "IsEmissive" = "true" }
  22. Cull Back
  23. CGINCLUDE
  24. #include "UnityShaderVariables.cginc"
  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) fixed3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
  35. #endif
  36. struct Input
  37. {
  38. float2 texcoord_0;
  39. float3 viewDir;
  40. INTERNAL_DATA
  41. };
  42. uniform sampler2D _Normal;
  43. uniform float4 _Color;
  44. uniform sampler2D _Albedo;
  45. uniform float _Highlighted;
  46. uniform sampler2D _Emission;
  47. uniform float _HighlightSpeed;
  48. uniform float _MinHighLightLevel;
  49. uniform float _MaxHighLightLevel;
  50. uniform float4 _HighlightColor;
  51. uniform sampler2D _Oclussion;
  52. void vertexDataFunc( inout appdata_full v, out Input o )
  53. {
  54. UNITY_INITIALIZE_OUTPUT( Input, o );
  55. o.texcoord_0.xy = v.texcoord.xy * float2( 1,1 ) + float2( 0,0 );
  56. }
  57. void surf( Input i , inout SurfaceOutputStandardSpecular o )
  58. {
  59. float3 Normal = UnpackNormal( tex2D( _Normal, i.texcoord_0 ) );
  60. o.Normal = Normal;
  61. float4 Albedo = ( _Color * tex2D( _Albedo, i.texcoord_0 ) );
  62. o.Albedo = Albedo.rgb;
  63. float4 Emision = tex2D( _Emission, i.texcoord_0 );
  64. float mulTime138 = _Time.y * 0.05;
  65. float Highlight_Level = (_MinHighLightLevel + (sin( ( mulTime138 * _HighlightSpeed ) ) - -1) * (_MaxHighLightLevel - _MinHighLightLevel) / (1 - -1));
  66. float4 Highlight_Color = _HighlightColor;
  67. float4 Highlight_Rim = ( pow( ( 1.0 - saturate( dot( Normal , normalize( i.viewDir ) ) ) ) , (10.0 + (Highlight_Level - 0.0) * (0.0 - 10.0) / (1.0 - 0.0)) ) * Highlight_Color );
  68. float4 Final_Emision = lerp(Emision,( Emision + Highlight_Rim ),_Highlighted);
  69. o.Emission = Final_Emision.xyz;
  70. float4 Oclussion = tex2D( _Oclussion, i.texcoord_0 );
  71. o.Occlusion = Oclussion.x;
  72. o.Alpha = 1;
  73. }
  74. ENDCG
  75. CGPROGRAM
  76. #pragma surface surf StandardSpecular keepalpha fullforwardshadows vertex:vertexDataFunc
  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. sampler3D _DitherMaskLOD;
  98. struct v2f
  99. {
  100. V2F_SHADOW_CASTER;
  101. float3 worldPos : TEXCOORD6;
  102. float4 tSpace0 : TEXCOORD1;
  103. float4 tSpace1 : TEXCOORD2;
  104. float4 tSpace2 : TEXCOORD3;
  105. UNITY_VERTEX_INPUT_INSTANCE_ID
  106. };
  107. v2f vert( appdata_full v )
  108. {
  109. v2f o;
  110. UNITY_SETUP_INSTANCE_ID( v );
  111. UNITY_INITIALIZE_OUTPUT( v2f, o );
  112. UNITY_TRANSFER_INSTANCE_ID( v, o );
  113. Input customInputData;
  114. vertexDataFunc( v, customInputData );
  115. float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
  116. half3 worldNormal = UnityObjectToWorldNormal( v.normal );
  117. fixed3 worldTangent = UnityObjectToWorldDir( v.tangent.xyz );
  118. fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
  119. fixed3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;
  120. o.tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x );
  121. o.tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y );
  122. o.tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z );
  123. o.worldPos = worldPos;
  124. TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
  125. return o;
  126. }
  127. fixed4 frag( v2f IN
  128. #if !defined( CAN_SKIP_VPOS )
  129. , UNITY_VPOS_TYPE vpos : VPOS
  130. #endif
  131. ) : SV_Target
  132. {
  133. UNITY_SETUP_INSTANCE_ID( IN );
  134. Input surfIN;
  135. UNITY_INITIALIZE_OUTPUT( Input, surfIN );
  136. float3 worldPos = float3( IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w );
  137. fixed3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
  138. surfIN.viewDir = IN.tSpace0.xyz * worldViewDir.x + IN.tSpace1.xyz * worldViewDir.y + IN.tSpace2.xyz * worldViewDir.z;
  139. surfIN.internalSurfaceTtoW0 = IN.tSpace0.xyz;
  140. surfIN.internalSurfaceTtoW1 = IN.tSpace1.xyz;
  141. surfIN.internalSurfaceTtoW2 = IN.tSpace2.xyz;
  142. SurfaceOutputStandardSpecular o;
  143. UNITY_INITIALIZE_OUTPUT( SurfaceOutputStandardSpecular, o )
  144. surf( surfIN, o );
  145. #if defined( CAN_SKIP_VPOS )
  146. float2 vpos = IN.pos;
  147. #endif
  148. SHADOW_CASTER_FRAGMENT( IN )
  149. }
  150. ENDCG
  151. }
  152. }
  153. Fallback "Diffuse"
  154. CustomEditor "ASEMaterialInspector"
  155. }
  156. /*ASEBEGIN
  157. Version=10011
  158. 646;227;1066;638;2286.505;1431.899;1.6;True;False
  159. Node;AmplifyShaderEditor.CommentaryNode;134;-1770.517,-1095.495;Float;False;1262.517;561.4071;Comment;8;128;127;125;129;124;132;87;138;Highlight Level (Ping pong animation);0;0
  160. Node;AmplifyShaderEditor.CommentaryNode;137;-3085.496,-1114.421;Float;False;1244.203;1368.811;Comment;11;51;58;67;63;52;64;85;65;86;74;75;Textures;0;0
  161. Node;AmplifyShaderEditor.TextureCoordinatesNode;51;-3035.496,-514.7198;Float;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;FLOAT;FLOAT;FLOAT;FLOAT
  162. Node;AmplifyShaderEditor.CommentaryNode;122;-1774.419,-357.309;Float;False;1900.698;589.5023;Comment;12;77;90;78;79;98;80;99;81;97;82;83;94;Highlight (Rim);0;0
  163. Node;AmplifyShaderEditor.RangedFloatNode;128;-1740.517,-840.847;Float;False;Property;_HighlightSpeed;Highlight Speed;10;0;60;0;200;0;1;FLOAT
  164. Node;AmplifyShaderEditor.SimpleTimeNode;138;-1656.213,-989.2999;Float;False;1;0;FLOAT;0.05;False;1;FLOAT
  165. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;127;-1387.964,-913.8461;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0,0,0,0;False;1;FLOAT
  166. Node;AmplifyShaderEditor.SamplerNode;58;-2625.094,-649.5204;Float;True;Property;_Normal;Normal;2;0;Assets/AmplifyShaderEditor/Examples/Assets/Textures/SceneTextures/WoodNormal.tif;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;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
  167. Node;AmplifyShaderEditor.ViewDirInputsCoordNode;77;-1724.419,-184.7088;Float;False;Tangent;0;4;FLOAT3;FLOAT;FLOAT;FLOAT
  168. Node;AmplifyShaderEditor.RegisterLocalVarNode;67;-2229.994,-607.2198;Float;False;Normal;-1;True;1;0;FLOAT3;0.0;False;1;FLOAT3
  169. Node;AmplifyShaderEditor.NormalizeNode;78;-1464.018,-113.7087;Float;False;1;0;FLOAT3;0,0,0,0;False;1;FLOAT3
  170. Node;AmplifyShaderEditor.GetLocalVarNode;90;-1490.52,-232.0073;Float;False;67;0;1;FLOAT3
  171. Node;AmplifyShaderEditor.RangedFloatNode;124;-1435.846,-772.2491;Float;False;Property;_MinHighLightLevel;MinHighLightLevel;8;0;0.8;0;1;0;1;FLOAT
  172. Node;AmplifyShaderEditor.RangedFloatNode;125;-1448.898,-649.0879;Float;False;Property;_MaxHighLightLevel;MaxHighLightLevel;9;0;0.9;0;1;0;1;FLOAT
  173. Node;AmplifyShaderEditor.SinOpNode;129;-1201.411,-905.735;Float;False;1;0;FLOAT;0.0;False;1;FLOAT
  174. Node;AmplifyShaderEditor.DotProductOpNode;79;-1195.62,-254.209;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0.0,0,0,0;False;1;FLOAT
  175. Node;AmplifyShaderEditor.TFHCRemap;132;-990.9387,-870.037;Float;False;5;0;FLOAT;0.0;False;1;FLOAT;-1;False;2;FLOAT;1;False;3;FLOAT;0.0;False;4;FLOAT;1.0;False;1;FLOAT
  176. Node;AmplifyShaderEditor.SaturateNode;80;-1019.619,-276.509;Float;False;1;0;FLOAT;0.0;False;1;FLOAT
  177. Node;AmplifyShaderEditor.GetLocalVarNode;98;-1510.627,2.193323;Float;False;87;0;1;FLOAT
  178. Node;AmplifyShaderEditor.RegisterLocalVarNode;87;-776,-868.525;Float;False;Highlight_Level;-1;True;1;0;FLOAT;0,0,0,0;False;1;FLOAT
  179. Node;AmplifyShaderEditor.CommentaryNode;133;-3053.912,330.0851;Float;False;642.599;257;Comment;2;55;95;Highlight Color;0;0
  180. Node;AmplifyShaderEditor.TFHCRemap;99;-1039.725,-60.70744;Float;False;5;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;1.0;False;3;FLOAT;10.0;False;4;FLOAT;0.0;False;1;FLOAT
  181. Node;AmplifyShaderEditor.ColorNode;55;-3003.912,380.0851;Float;False;Property;_HighlightColor;Highlight Color;7;0;0.7065311,0.9705882,0.9596617,1;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
  182. Node;AmplifyShaderEditor.OneMinusNode;81;-819.4186,-243.509;Float;False;1;0;FLOAT;0.0;False;1;FLOAT
  183. Node;AmplifyShaderEditor.GetLocalVarNode;97;-568.021,-54.00653;Float;False;95;0;1;COLOR
  184. Node;AmplifyShaderEditor.RegisterLocalVarNode;95;-2678.313,386.3863;Float;False;Highlight_Color;-1;True;1;0;COLOR;0.0;False;1;COLOR
  185. Node;AmplifyShaderEditor.PowerNode;82;-546.6185,-307.309;Float;False;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT
  186. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;83;-298.6189,-199.5089;Float;False;2;2;0;FLOAT;0.0;False;1;COLOR;0.0;False;1;COLOR
  187. Node;AmplifyShaderEditor.SamplerNode;74;-2613.095,-439.5192;Float;True;Property;_Emission;Emission;3;0;Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png;True;0;False;black;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;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;FLOAT4;FLOAT;FLOAT;FLOAT;FLOAT
  188. Node;AmplifyShaderEditor.CommentaryNode;120;-2305.992,331.5047;Float;False;987.1003;293;Comment;5;115;116;113;111;114;Emission Mix & Highlight Switching;0;0
  189. Node;AmplifyShaderEditor.RegisterLocalVarNode;75;-2224.695,-405.8194;Float;False;Emision;-1;True;1;0;FLOAT4;0.0;False;1;FLOAT4
  190. Node;AmplifyShaderEditor.GetLocalVarNode;115;-2258.862,536.0378;Float;False;94;0;1;COLOR
  191. Node;AmplifyShaderEditor.GetLocalVarNode;113;-2260.741,368.6549;Float;False;75;0;1;FLOAT4
  192. Node;AmplifyShaderEditor.RegisterLocalVarNode;94;-111.9873,-198.5623;Float;False;Highlight_Rim;-1;True;1;0;COLOR;0,0,0,0;False;1;COLOR
  193. Node;AmplifyShaderEditor.ColorNode;63;-2603.194,-1064.421;Float;False;Property;_Color;Color;0;0;0.9044118,0.6640914,0.03325041,0;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
  194. Node;AmplifyShaderEditor.SimpleAddOpNode;116;-2007.652,491.5049;Float;False;2;2;0;FLOAT4;0.0;False;1;COLOR;0.0,0,0,0;False;1;FLOAT4
  195. Node;AmplifyShaderEditor.SamplerNode;52;-2613.794,-868.2204;Float;True;Property;_Albedo;Albedo;1;0;Assets/AmplifyShaderEditor/Examples/Assets/Textures/SceneTextures/WoodDiffuse.tif;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;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;FLOAT4;FLOAT;FLOAT;FLOAT;FLOAT
  196. Node;AmplifyShaderEditor.SamplerNode;85;-2608.594,-217.0179;Float;True;Property;_Oclussion;Oclussion;4;0;Assets/AmplifyShaderEditor/Examples/Assets/Textures/SceneTextures/WoodOcclusion.tif;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;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;FLOAT4;FLOAT;FLOAT;FLOAT;FLOAT
  197. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;64;-2242.994,-902.5208;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0.0,0,0,0;False;1;COLOR
  198. Node;AmplifyShaderEditor.ToggleSwitchNode;111;-1819.132,391.7312;Float;False;Property;_Highlighted;Highlighted;11;1;[Toggle];0;2;0;FLOAT4;0.0;False;1;FLOAT4;0.0;False;1;FLOAT4
  199. Node;AmplifyShaderEditor.GetLocalVarNode;68;-349.5197,-1040.513;Float;False;65;0;1;COLOR
  200. Node;AmplifyShaderEditor.GetLocalVarNode;69;-336.4087,-902.9017;Float;False;67;0;1;FLOAT3
  201. Node;AmplifyShaderEditor.GetLocalVarNode;70;-361.5474,-762.6461;Float;False;114;0;1;FLOAT4
  202. Node;AmplifyShaderEditor.RegisterLocalVarNode;114;-1575.891,393.5044;Float;False;Final_Emision;-1;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4
  203. Node;AmplifyShaderEditor.RegisterLocalVarNode;65;-2075.293,-902.6206;Float;False;Albedo;-1;True;1;0;COLOR;0.0;False;1;COLOR
  204. Node;AmplifyShaderEditor.RegisterLocalVarNode;86;-2233.594,-167.0179;Float;False;Oclussion;-1;True;1;0;FLOAT4;0.0;False;1;FLOAT4
  205. Node;AmplifyShaderEditor.GetLocalVarNode;76;-337.862,-631.5278;Float;False;86;0;1;FLOAT4
  206. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;-3.219753,-841.6202;Float;False;True;2;Float;ASEMaterialInspector;0;StandardSpecular;ASESampleShaders/Community/TFHC/Highlight Animated;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;Back;0;0;False;0;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;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;Relative;0;;-1;-1;-1;-1;0;15;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,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;False;12;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
  207. WireConnection;127;0;138;0
  208. WireConnection;127;1;128;0
  209. WireConnection;58;1;51;0
  210. WireConnection;67;0;58;0
  211. WireConnection;78;0;77;0
  212. WireConnection;129;0;127;0
  213. WireConnection;79;0;90;0
  214. WireConnection;79;1;78;0
  215. WireConnection;132;0;129;0
  216. WireConnection;132;3;124;0
  217. WireConnection;132;4;125;0
  218. WireConnection;80;0;79;0
  219. WireConnection;87;0;132;0
  220. WireConnection;99;0;98;0
  221. WireConnection;81;0;80;0
  222. WireConnection;95;0;55;0
  223. WireConnection;82;0;81;0
  224. WireConnection;82;1;99;0
  225. WireConnection;83;0;82;0
  226. WireConnection;83;1;97;0
  227. WireConnection;74;1;51;0
  228. WireConnection;75;0;74;0
  229. WireConnection;94;0;83;0
  230. WireConnection;116;0;113;0
  231. WireConnection;116;1;115;0
  232. WireConnection;52;1;51;0
  233. WireConnection;85;1;51;0
  234. WireConnection;64;0;63;0
  235. WireConnection;64;1;52;0
  236. WireConnection;111;0;113;0
  237. WireConnection;111;1;116;0
  238. WireConnection;114;0;111;0
  239. WireConnection;65;0;64;0
  240. WireConnection;86;0;85;0
  241. WireConnection;0;0;68;0
  242. WireConnection;0;1;69;0
  243. WireConnection;0;2;70;0
  244. WireConnection;0;5;76;0
  245. ASEEND*/
  246. //CHKSM=16AE1F372D1CC72F6F6EAF5DEA04B44EFFC6D84C