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.

122 lines
4.3 KiB

  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "ASESampleShaders/GlassSimple"
  4. {
  5. Properties
  6. {
  7. _Color("Color", Color) = (0,0,0,0)
  8. _Smoothness("Smoothness", Range( 0 , 1)) = 0
  9. [HideInInspector] __dirty( "", Int ) = 1
  10. }
  11. SubShader
  12. {
  13. Pass
  14. {
  15. ColorMask 0
  16. ZWrite On
  17. }
  18. Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+0" "IgnoreProjector" = "True" }
  19. Cull Back
  20. Blend SrcAlpha OneMinusSrcAlpha
  21. CGINCLUDE
  22. #include "UnityPBSLighting.cginc"
  23. #include "Lighting.cginc"
  24. #pragma target 3.0
  25. struct Input
  26. {
  27. fixed filler;
  28. };
  29. uniform float4 _Color;
  30. uniform float _Smoothness;
  31. void surf( Input i , inout SurfaceOutputStandard o )
  32. {
  33. o.Albedo = _Color.rgb;
  34. o.Smoothness = _Smoothness;
  35. o.Alpha = _Color.a;
  36. }
  37. ENDCG
  38. CGPROGRAM
  39. #pragma surface surf Standard keepalpha fullforwardshadows
  40. ENDCG
  41. Pass
  42. {
  43. Name "ShadowCaster"
  44. Tags{ "LightMode" = "ShadowCaster" }
  45. ZWrite On
  46. CGPROGRAM
  47. #pragma vertex vert
  48. #pragma fragment frag
  49. #pragma target 3.0
  50. #pragma multi_compile_shadowcaster
  51. #pragma multi_compile UNITY_PASS_SHADOWCASTER
  52. #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
  53. #include "HLSLSupport.cginc"
  54. #if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )
  55. #define CAN_SKIP_VPOS
  56. #endif
  57. #include "UnityCG.cginc"
  58. #include "Lighting.cginc"
  59. #include "UnityPBSLighting.cginc"
  60. sampler3D _DitherMaskLOD;
  61. struct v2f
  62. {
  63. V2F_SHADOW_CASTER;
  64. float3 worldPos : TEXCOORD1;
  65. UNITY_VERTEX_INPUT_INSTANCE_ID
  66. };
  67. v2f vert( appdata_full v )
  68. {
  69. v2f o;
  70. UNITY_SETUP_INSTANCE_ID( v );
  71. UNITY_INITIALIZE_OUTPUT( v2f, o );
  72. UNITY_TRANSFER_INSTANCE_ID( v, o );
  73. float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
  74. fixed3 worldNormal = UnityObjectToWorldNormal( v.normal );
  75. o.worldPos = worldPos;
  76. TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
  77. return o;
  78. }
  79. fixed4 frag( v2f IN
  80. #if !defined( CAN_SKIP_VPOS )
  81. , UNITY_VPOS_TYPE vpos : VPOS
  82. #endif
  83. ) : SV_Target
  84. {
  85. UNITY_SETUP_INSTANCE_ID( IN );
  86. Input surfIN;
  87. UNITY_INITIALIZE_OUTPUT( Input, surfIN );
  88. float3 worldPos = IN.worldPos;
  89. fixed3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
  90. SurfaceOutputStandard o;
  91. UNITY_INITIALIZE_OUTPUT( SurfaceOutputStandard, o )
  92. surf( surfIN, o );
  93. #if defined( CAN_SKIP_VPOS )
  94. float2 vpos = IN.pos;
  95. #endif
  96. half alphaRef = tex3D( _DitherMaskLOD, float3( vpos.xy * 0.25, o.Alpha * 0.9375 ) ).a;
  97. clip( alphaRef - 0.01 );
  98. SHADOW_CASTER_FRAGMENT( IN )
  99. }
  100. ENDCG
  101. }
  102. }
  103. Fallback "Diffuse"
  104. CustomEditor "ASEMaterialInspector"
  105. }
  106. /*ASEBEGIN
  107. Version=15101
  108. 1927;29;1906;1044;1122;356;1;True;False
  109. Node;AmplifyShaderEditor.RangedFloatNode;2;-310,211;Float;False;Property;_Smoothness;Smoothness;2;0;Create;True;0;0;False;0;0;0.444;0;1;0;1;FLOAT;0
  110. Node;AmplifyShaderEditor.ColorNode;1;-319,1;Float;False;Property;_Color;Color;1;0;Create;True;0;0;False;0;0,0,0,0;0.07239401,0.303863,0.7573529,0.222;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  111. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;0,0;Float;False;True;2;Float;ASEMaterialInspector;0;0;Standard;ASESampleShaders/GlassSimple;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;False;False;False;False;Back;0;False;-1;0;False;-1;False;0;0;True;0;Custom;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;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;2;SrcAlpha;OneMinusSrcAlpha;0;Zero;Zero;OFF;OFF;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;Relative;0;;0;-1;-1;-1;0;0;0;False;0;0;0;False;-1;-1;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
  112. WireConnection;0;0;1;0
  113. WireConnection;0;4;2;0
  114. WireConnection;0;9;1;4
  115. ASEEND*/
  116. //CHKSM=3C484878651C606197C3672240890F7420EBBCF4