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.

175 lines
5.9 KiB

  1. Shader "OvrAvatar/AvatarSurfaceShaderSelfOccluding" {
  2. Properties{
  3. // Global parameters
  4. _Alpha("Alpha", Range(0.0, 1.0)) = 1.0
  5. _DarkMultiplier("Dark Multiplier", Color) = (0.6, 0.6, 0.6, 1.0)
  6. _BaseColor("Base Color", Color) = (0.0, 0.0, 0.0, 0.0)
  7. _BaseMaskType("Base Mask Type", Int) = 0
  8. _BaseMaskParameters("Base Mask Parameters", Vector) = (0, 0, 0, 0)
  9. _BaseMaskAxis("Base Mask Axis", Vector) = (0, 1, 0, 0)
  10. _AlphaMask("Alpha Mask", 2D) = "white" {}
  11. _NormalMap("Normal Map", 2D) = "" {}
  12. _ParallaxMap("Parallax Map", 2D) = "" {}
  13. _RoughnessMap("Roughness Map", 2D) = "" {}
  14. // Layer 0 parameters
  15. _LayerSampleMode0("Layer Sample Mode 0", Int) = 0
  16. _LayerBlendMode0("Layer Blend Mode 0", Int) = 0
  17. _LayerMaskType0("Layer Mask Type 0", Int) = 0
  18. _LayerColor0("Layer Color 0", Color) = (1.0, 1.0, 1.0, 1.0)
  19. _LayerSurface0("Layer Surface 0", 2D) = "" {}
  20. _LayerSampleParameters0("Layer Sample Parameters 0", Vector) = (0, 0, 0, 0)
  21. _LayerMaskParameters0("Layer Mask Parameters 0", Vector) = (0, 0, 0, 0)
  22. _LayerMaskAxis0("Layer Mask Axis 0", Vector) = (0, 1, 0, 0)
  23. // Layer 1 parameters
  24. _LayerSampleMode1("Layer Sample Mode 1", Int) = 0
  25. _LayerBlendMode1("Layer Blend Mode 1", Int) = 0
  26. _LayerMaskType1("Layer Mask Type 1", Int) = 0
  27. _LayerColor1("Layer Color 1", Color) = (1.0, 1.0, 1.0, 1.0)
  28. _LayerSurface1("Layer Surface 1", 2D) = "" {}
  29. _LayerSampleParameters1("Layer Sample Parameters 1", Vector) = (0, 0, 0, 0)
  30. _LayerMaskParameters1("Layer Mask Parameters 1", Vector) = (0, 0, 0, 0)
  31. _LayerMaskAxis1("Layer Mask Axis 1", Vector) = (0, 1, 0, 0)
  32. // Layer 2 parameters
  33. _LayerSampleMode2("Layer Sample Mode 2", Int) = 0
  34. _LayerBlendMode2("Layer Blend Mode 2", Int) = 0
  35. _LayerMaskType2("Layer Mask Type 2", Int) = 0
  36. _LayerColor2("Layer Color 2", Color) = (1.0, 1.0, 1.0, 1.0)
  37. _LayerSurface2("Layer Surface 2", 2D) = "" {}
  38. _LayerSampleParameters2("Layer Sample Parameters 2", Vector) = (0, 0, 0, 0)
  39. _LayerMaskParameters2("Layer Mask Parameters 2", Vector) = (0, 0, 0, 0)
  40. _LayerMaskAxis2("Layer Mask Axis 2", Vector) = (0, 1, 0, 0)
  41. // Layer 3 parameters
  42. _LayerSampleMode3("Layer Sample Mode 3", Int) = 0
  43. _LayerBlendMode3("Layer Blend Mode 3", Int) = 0
  44. _LayerMaskType3("Layer Mask Type 3", Int) = 0
  45. _LayerColor3("Layer Color 3", Color) = (1.0, 1.0, 1.0, 1.0)
  46. _LayerSurface3("Layer Surface 3", 2D) = "" {}
  47. _LayerSampleParameters3("Layer Sample Parameters 3", Vector) = (0, 0, 0, 0)
  48. _LayerMaskParameters3("Layer Mask Parameters 3", Vector) = (0, 0, 0, 0)
  49. _LayerMaskAxis3("Layer Mask Axis 3", Vector) = (0, 1, 0, 0)
  50. // Layer 4 parameters
  51. _LayerSampleMode4("Layer Sample Mode 4", Int) = 0
  52. _LayerBlendMode4("Layer Blend Mode 4", Int) = 0
  53. _LayerMaskType4("Layer Mask Type 4", Int) = 0
  54. _LayerColor4("Layer Color 4", Color) = (1.0, 1.0, 1.0, 1.0)
  55. _LayerSurface4("Layer Surface 4", 2D) = "" {}
  56. _LayerSampleParameters4("Layer Sample Parameters 4", Vector) = (0, 0, 0, 0)
  57. _LayerMaskParameters4("Layer Mask Parameters 4", Vector) = (0, 0, 0, 0)
  58. _LayerMaskAxis4("Layer Mask Axis 4", Vector) = (0, 1, 0, 0)
  59. // Layer 5 parameters
  60. _LayerSampleMode5("Layer Sample Mode 5", Int) = 0
  61. _LayerBlendMode5("Layer Blend Mode 5", Int) = 0
  62. _LayerMaskType5("Layer Mask Type 5", Int) = 0
  63. _LayerColor5("Layer Color 5", Color) = (1.0, 1.0, 1.0, 1.0)
  64. _LayerSurface5("Layer Surface 5", 2D) = "" {}
  65. _LayerSampleParameters5("Layer Sample Parameters 5", Vector) = (0, 0, 0, 0)
  66. _LayerMaskParameters5("Layer Mask Parameters 5", Vector) = (0, 0, 0, 0)
  67. _LayerMaskAxis5("Layer Mask Axis 5", Vector) = (0, 1, 0, 0)
  68. // Layer 6 parameters
  69. _LayerSampleMode6("Layer Sample Mode 6", Int) = 0
  70. _LayerBlendMode6("Layer Blend Mode 6", Int) = 0
  71. _LayerMaskType6("Layer Mask Type 6", Int) = 0
  72. _LayerColor6("Layer Color 6", Color) = (1.0, 1.0, 1.0, 1.0)
  73. _LayerSurface6("Layer Surface 6", 2D) = "" {}
  74. _LayerSampleParameters6("Layer Sample Parameters 6", Vector) = (0, 0, 0, 0)
  75. _LayerMaskParameters6("Layer Mask Parameters 6", Vector) = (0, 0, 0, 0)
  76. _LayerMaskAxis6("Layer Mask Axis 6", Vector) = (0, 1, 0, 0)
  77. // Layer 7 parameters
  78. _LayerSampleMode7("Layer Sample Mode 7", Int) = 0
  79. _LayerBlendMode7("Layer Blend Mode 7", Int) = 0
  80. _LayerMaskType7("Layer Mask Type 7", Int) = 0
  81. _LayerColor7("Layer Color 7", Color) = (1.0, 1.0, 1.0, 1.0)
  82. _LayerSurface7("Layer Surface 7", 2D) = "" {}
  83. _LayerSampleParameters7("Layer Sample Parameters 7", Vector) = (0, 0, 0, 0)
  84. _LayerMaskParameters7("Layer Mask Parameters 7", Vector) = (0, 0, 0, 0)
  85. _LayerMaskAxis7("Layer Mask Axis 7", Vector) = (0, 1, 0, 0)
  86. }
  87. SubShader
  88. {
  89. Tags
  90. {
  91. "Queue" = "Transparent"
  92. "RenderType" = "Transparent"
  93. }
  94. Pass
  95. {
  96. ZWrite On
  97. Cull Off
  98. ColorMask 0
  99. Offset 1, 1
  100. CGPROGRAM
  101. #pragma vertex vert
  102. #pragma fragment frag
  103. #pragma target 3.0
  104. #include "UnityCG.cginc"
  105. struct v2f
  106. {
  107. float4 position : SV_POSITION;
  108. };
  109. v2f vert(appdata_full v)
  110. {
  111. // Output
  112. v2f output;
  113. output.position = UnityObjectToClipPos(v.vertex);
  114. return output;
  115. }
  116. float4 frag(v2f input) : COLOR
  117. {
  118. return 0;
  119. }
  120. ENDCG
  121. }
  122. Blend SrcAlpha OneMinusSrcAlpha
  123. ZWrite Off
  124. LOD 200
  125. Pass
  126. {
  127. Name "FORWARD"
  128. Tags
  129. {
  130. "LightMode" = "ForwardBase"
  131. }
  132. CGPROGRAM
  133. #pragma only_renderers d3d11 gles3 gles
  134. #pragma vertex vert
  135. #pragma fragment frag
  136. #pragma target 3.0
  137. #pragma multi_compile PROJECTOR_OFF PROJECTOR_ON
  138. #pragma multi_compile NORMAL_MAP_OFF NORMAL_MAP_ON
  139. #pragma multi_compile PARALLAX_OFF PARALLAX_ON
  140. #pragma multi_compile ROUGHNESS_OFF ROUGHNESS_ON
  141. #pragma multi_compile VERTALPHA_OFF VERTALPHA_ON
  142. #pragma multi_compile LAYERS_1 LAYERS_2 LAYERS_3 LAYERS_4 LAYERS_5 LAYERS_6 LAYERS_7 LAYERS_8
  143. #include "Assets/Oculus/Avatar/Resources/Materials/AvatarMaterialStateShader.cginc"
  144. float4 frag(VertexOutput IN) : SV_Target
  145. {
  146. return ComputeSurface(IN);
  147. }
  148. ENDCG
  149. }
  150. }
  151. FallBack "Diffuse"
  152. CustomEditor "AvatarMaterialEditor"
  153. }