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.

87 lines
2.5 KiB

  1. //======= Copyright (c) Valve Corporation, All rights reserved. ===============
  2. //
  3. // Purpose: Used for objects that can be seen through objects in front of them
  4. //
  5. //=============================================================================
  6. // UNITY_SHADER_NO_UPGRADE
  7. Shader "Valve/VR/SeeThru"
  8. {
  9. Properties
  10. {
  11. _Color( "Color", Color ) = ( 1, 1, 1, 1 )
  12. }
  13. SubShader
  14. {
  15. Tags{ "Queue" = "Geometry+1" "RenderType" = "Transparent" }
  16. LOD 100
  17. Pass
  18. {
  19. // Render State ---------------------------------------------------------------------------------------------------------------------------------------------
  20. Blend SrcAlpha OneMinusSrcAlpha // Alpha blending
  21. Cull Off
  22. ZWrite Off
  23. ZTest Greater
  24. Stencil
  25. {
  26. Ref 2
  27. Comp notequal
  28. Pass replace
  29. Fail keep
  30. }
  31. CGPROGRAM
  32. #pragma target 5.0
  33. #pragma only_renderers d3d11 vulkan
  34. #pragma exclude_renderers gles
  35. #pragma vertex MainVS
  36. #pragma fragment MainPS
  37. // Includes -------------------------------------------------------------------------------------------------------------------------------------------------
  38. #include "UnityCG.cginc"
  39. // Structs --------------------------------------------------------------------------------------------------------------------------------------------------
  40. struct VertexInput
  41. {
  42. float4 vertex : POSITION;
  43. float2 uv : TEXCOORD0;
  44. };
  45. struct VertexOutput
  46. {
  47. float2 uv : TEXCOORD0;
  48. float4 vertex : SV_POSITION;
  49. };
  50. // Globals --------------------------------------------------------------------------------------------------------------------------------------------------
  51. sampler2D _MainTex;
  52. float4 _MainTex_ST;
  53. float4 _Color;
  54. // MainVs ---------------------------------------------------------------------------------------------------------------------------------------------------
  55. VertexOutput MainVS( VertexInput i )
  56. {
  57. VertexOutput o;
  58. #if UNITY_VERSION >= 540
  59. o.vertex = UnityObjectToClipPos(i.vertex);
  60. #else
  61. o.vertex = mul(UNITY_MATRIX_MVP, i.vertex);
  62. #endif
  63. o.uv = TRANSFORM_TEX( i.uv, _MainTex );
  64. return o;
  65. }
  66. // MainPs ---------------------------------------------------------------------------------------------------------------------------------------------------
  67. float4 MainPS( VertexOutput i ) : SV_Target
  68. {
  69. float4 vColor = _Color.rgba;
  70. return vColor.rgba;
  71. }
  72. ENDCG
  73. }
  74. }
  75. }