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.

141 lines
7.9 KiB

  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "ASESampleShaders/UV Light Reveal"
  4. {
  5. Properties
  6. {
  7. [HideInInspector] __dirty( "", Int ) = 1
  8. _BaseTexture("Base Texture", 2D) = "white" {}
  9. _UVTexture("UV Texture", 2D) = "white" {}
  10. _ColortoBeFiltered("Color to Be Filtered", Color) = (0.4039216,0,1,1)
  11. _DifferenceThreshold("Difference Threshold", Range( 0 , 0.05)) = 0
  12. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  13. }
  14. SubShader
  15. {
  16. Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" "IsEmissive" = "true" }
  17. Cull Back
  18. CGPROGRAM
  19. #include "UnityPBSLighting.cginc"
  20. #include "UnityShaderVariables.cginc"
  21. #pragma target 3.0
  22. #pragma surface surf StandardCustomLighting keepalpha addshadow fullforwardshadows
  23. struct Input
  24. {
  25. float2 uv_texcoord;
  26. };
  27. struct SurfaceOutputCustomLightingCustom
  28. {
  29. fixed3 Albedo;
  30. fixed3 Normal;
  31. half3 Emission;
  32. half Metallic;
  33. half Smoothness;
  34. half Occlusion;
  35. fixed Alpha;
  36. Input SurfInput;
  37. UnityGIInput GIData;
  38. };
  39. uniform sampler2D _BaseTexture;
  40. uniform float4 _BaseTexture_ST;
  41. uniform sampler2D _UVTexture;
  42. uniform float4 _UVTexture_ST;
  43. uniform float4 _ColortoBeFiltered;
  44. uniform float _DifferenceThreshold;
  45. inline half4 LightingStandardCustomLighting( inout SurfaceOutputCustomLightingCustom s, half3 viewDir, UnityGI gi )
  46. {
  47. UnityGIInput data = s.GIData;
  48. Input i = s.SurfInput;
  49. half4 c = 0;
  50. #if DIRECTIONAL
  51. float ase_lightAtten = data.atten;
  52. if( _LightColor0.a == 0)
  53. ase_lightAtten = 0;
  54. #else
  55. float3 ase_lightAttenRGB = gi.light.color / ( ( _LightColor0.rgb ) + 0.000001 );
  56. float ase_lightAtten = max( max( ase_lightAttenRGB.r, ase_lightAttenRGB.g ), ase_lightAttenRGB.b );
  57. #endif
  58. float2 uv_BaseTexture = i.uv_texcoord * _BaseTexture_ST.xy + _BaseTexture_ST.zw;
  59. float4 temp_output_59_0 = ( ase_lightAtten * _LightColor0 );
  60. float2 uv_UVTexture = i.uv_texcoord * _UVTexture_ST.xy + _UVTexture_ST.zw;
  61. float3 componentMask91 = ( _LightColor0 * _WorldSpaceLightPos0.w ).rgb;
  62. float3 componentMask92 = _ColortoBeFiltered.rgb;
  63. c.rgb = ( ( tex2D( _BaseTexture, uv_BaseTexture ) * saturate( temp_output_59_0 ) ) + ( tex2D( _UVTexture, uv_UVTexture ).r * ( ( temp_output_59_0 * _WorldSpaceLightPos0.w ) * ( dot( normalize( componentMask91 ) , normalize( componentMask92 ) ) - _DifferenceThreshold > 1.0 ? 0.0 : dot( normalize( componentMask91 ) , normalize( componentMask92 ) ) - _DifferenceThreshold <= 1.0 && dot( normalize( componentMask91 ) , normalize( componentMask92 ) ) + _DifferenceThreshold >= 1.0 ? 1.0 : 0.0 ) ) ) ).xyz;
  64. c.a = 1;
  65. return c;
  66. }
  67. inline void LightingStandardCustomLighting_GI( inout SurfaceOutputCustomLightingCustom s, UnityGIInput data, inout UnityGI gi )
  68. {
  69. s.GIData = data;
  70. }
  71. void surf( Input i , inout SurfaceOutputCustomLightingCustom o )
  72. {
  73. o.SurfInput = i;
  74. }
  75. ENDCG
  76. }
  77. Fallback "Diffuse"
  78. CustomEditor "ASEMaterialInspector"
  79. }
  80. /*ASEBEGIN
  81. Version=10011
  82. 441;100;1028;639;1643.645;408.058;1.698814;True;False
  83. Node;AmplifyShaderEditor.WorldSpaceLightPos;54;-1219.7,205.2679;Float;False;0;3;FLOAT4;FLOAT3;FLOAT
  84. Node;AmplifyShaderEditor.LightColorNode;84;-1132.925,359.0915;Float;False;0;1;COLOR
  85. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;85;-915.9946,345.3203;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0.0,0,0,0;False;1;COLOR
  86. Node;AmplifyShaderEditor.ColorNode;87;-1057.309,513.7495;Float;False;Property;_ColortoBeFiltered;Color to Be Filtered;2;0;0.4039216,0,1,1;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
  87. Node;AmplifyShaderEditor.ComponentMaskNode;92;-734.5231,485.7451;Float;False;True;True;True;False;1;0;COLOR;0,0,0,0;False;1;FLOAT3
  88. Node;AmplifyShaderEditor.ComponentMaskNode;91;-731.6473,379.2185;Float;False;True;True;True;False;1;0;COLOR;0,0,0,0;False;1;FLOAT3
  89. Node;AmplifyShaderEditor.LightAttenuation;53;-896.7832,16.67318;Float;False;0;1;FLOAT
  90. Node;AmplifyShaderEditor.LightColorNode;58;-875.2192,128.332;Float;False;0;1;COLOR
  91. Node;AmplifyShaderEditor.NormalizeNode;116;-467.2045,386.9525;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3
  92. Node;AmplifyShaderEditor.NormalizeNode;117;-461.5048,470.5531;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3
  93. Node;AmplifyShaderEditor.RangedFloatNode;98;-678.827,588.9836;Float;False;Constant;_Float1;Float 1;4;0;1;0;0;0;1;FLOAT
  94. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;59;-681.7908,71.68948;Float;False;2;2;0;FLOAT;0.0;False;1;COLOR;0,0,0,0;False;1;COLOR
  95. Node;AmplifyShaderEditor.RangedFloatNode;90;-721.6726,682.4335;Float;False;Property;_DifferenceThreshold;Difference Threshold;3;0;0;0;0.05;0;1;FLOAT
  96. Node;AmplifyShaderEditor.DotProductOpNode;96;-303.6713,411.4413;Float;False;2;0;FLOAT3;0.0;False;1;FLOAT3;0,0,0;False;1;FLOAT
  97. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;55;-421.8257,228.5361;Float;False;2;2;0;COLOR;0.0;False;1;FLOAT;0.0,0,0,0;False;1;COLOR
  98. Node;AmplifyShaderEditor.TFHCIf;100;-145.8477,538.6387;Float;False;6;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;1;FLOAT
  99. Node;AmplifyShaderEditor.SamplerNode;52;-240.3876,51.70139;Float;True;Property;_UVTexture;UV Texture;1;0;Assets/AmplifyShaderEditor/Examples/Official/UVLightReveal/UVLight.jpg;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
  100. Node;AmplifyShaderEditor.SamplerNode;51;-616.3525,-208.0113;Float;True;Property;_BaseTexture;Base Texture;0;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
  101. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;99;92.92843,269.5623;Float;False;2;2;0;COLOR;0.0;False;1;FLOAT;0.0;False;1;COLOR
  102. Node;AmplifyShaderEditor.SaturateNode;79;-189.8604,-60.81562;Float;False;1;0;COLOR;0.0;False;1;COLOR
  103. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;80;98.50198,-126.1641;Float;False;2;2;0;FLOAT4;0.0,0,0,0;False;1;COLOR;0.0,0,0,0;False;1;FLOAT4
  104. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;57;295.7195,105.5482;Float;False;2;2;0;FLOAT;0.0;False;1;COLOR;0.0;False;1;COLOR
  105. Node;AmplifyShaderEditor.SimpleAddOpNode;78;476.3192,-97.63742;Float;False;2;2;0;FLOAT4;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;FLOAT4
  106. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;647.1755,-147.5417;Float;False;True;2;Float;ASEMaterialInspector;0;CustomLighting;ASESampleShaders/UV Light Reveal;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;14;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;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
  107. WireConnection;85;0;84;0
  108. WireConnection;85;1;54;2
  109. WireConnection;92;0;87;0
  110. WireConnection;91;0;85;0
  111. WireConnection;116;0;91;0
  112. WireConnection;117;0;92;0
  113. WireConnection;59;0;53;0
  114. WireConnection;59;1;58;0
  115. WireConnection;96;0;116;0
  116. WireConnection;96;1;117;0
  117. WireConnection;55;0;59;0
  118. WireConnection;55;1;54;2
  119. WireConnection;100;0;96;0
  120. WireConnection;100;1;98;0
  121. WireConnection;100;3;98;0
  122. WireConnection;100;5;90;0
  123. WireConnection;99;0;55;0
  124. WireConnection;99;1;100;0
  125. WireConnection;79;0;59;0
  126. WireConnection;80;0;51;0
  127. WireConnection;80;1;79;0
  128. WireConnection;57;0;52;1
  129. WireConnection;57;1;99;0
  130. WireConnection;78;0;80;0
  131. WireConnection;78;1;57;0
  132. WireConnection;0;2;78;0
  133. ASEEND*/
  134. //CHKSM=054D002F9CACBF3A4E7EF243F95951AF04647AA5