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.

48 lines
1.7 KiB

  1. /*
  2. This shader is used to render the impostor while clearing out the alpha of the eye buffer
  3. The important details here are:
  4. - the use of the Geometry+1 queue to make sure the impostor is drawn after all other opaque objects but before alpha
  5. - the keepalpha parameter that allow unity to actually write the alpha we return at the end of the shader.
  6. */
  7. Shader "Oculus/Underlay Impostor" {
  8. Properties{
  9. _Color("Color", Color) = (1,1,1,1)
  10. _MainTex("Albedo (RGB)", 2D) = "white" {}
  11. _Glossiness("Smoothness", Range(0,1)) = 0.5
  12. _Metallic("Metallic", Range(0,1)) = 0.0
  13. }
  14. SubShader{
  15. Tags { "Queue" = "Geometry+1" "RenderType" = "Opaque" }
  16. LOD 200
  17. CGPROGRAM
  18. // Physically based Standard lighting model, and enable shadows on all light types
  19. #pragma surface surf Standard fullforwardshadows keepalpha
  20. // Use shader model 3.0 target, to get nicer looking lighting
  21. #pragma target 3.0
  22. sampler2D _MainTex;
  23. struct Input {
  24. float2 uv_MainTex;
  25. };
  26. half _Glossiness;
  27. half _Metallic;
  28. fixed4 _Color;
  29. void surf(Input IN, inout SurfaceOutputStandard o) {
  30. // Albedo comes from a texture tinted by color
  31. fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
  32. o.Albedo = c.rgb;
  33. // Metallic and smoothness come from slider variables
  34. o.Metallic = _Metallic;
  35. o.Smoothness = _Glossiness;
  36. o.Alpha = 0.f;
  37. }
  38. ENDCG
  39. }
  40. FallBack "Diffuse"
  41. }