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.

79 lines
1.6 KiB

  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "OvrAvatar/AvatarSurfaceShaderPBS" {
  3. Properties{
  4. // Global parameters
  5. _Alpha("Alpha", Range(0.0, 1.0)) = 1.0
  6. _Albedo("Albedo (RGB)", 2D) = "" {}
  7. _Surface("Metallic (R) Occlusion (G) and Smoothness (A)", 2D) = "" {}
  8. }
  9. SubShader{
  10. Tags {
  11. "Queue" = "Transparent"
  12. "RenderType" = "Transparent"
  13. }
  14. Pass {
  15. ZWrite On
  16. Cull Off
  17. ColorMask 0
  18. CGPROGRAM
  19. #pragma vertex vert
  20. #pragma fragment frag
  21. #pragma target 3.0
  22. #include "UnityCG.cginc"
  23. struct v2f {
  24. float4 position : SV_POSITION;
  25. };
  26. v2f vert(appdata_full v) {
  27. // Output
  28. v2f output;
  29. output.position = UnityObjectToClipPos(v.vertex);
  30. return output;
  31. }
  32. float4 frag(v2f input) : COLOR {
  33. return 0;
  34. }
  35. ENDCG
  36. }
  37. LOD 200
  38. CGPROGRAM
  39. // Physically based Standard lighting model, and enable shadows on all light types
  40. #pragma surface surf Standard vertex:vert nolightmap alpha noforwardadd
  41. float _Alpha;
  42. sampler2D _Albedo;
  43. float4 _Albedo_ST;
  44. sampler2D _Surface;
  45. float4 _Surface_ST;
  46. struct Input {
  47. float2 texcoord;
  48. };
  49. void vert(inout appdata_full v, out Input o) {
  50. UNITY_INITIALIZE_OUTPUT(Input, o);
  51. o.texcoord = v.texcoord.xy;
  52. }
  53. void surf (Input IN, inout SurfaceOutputStandard o) {
  54. o.Albedo = tex2D(_Albedo, TRANSFORM_TEX(IN.texcoord, _Albedo)).rgb;
  55. float4 surfaceParams = tex2D(_Surface, TRANSFORM_TEX(IN.texcoord, _Surface));
  56. o.Metallic = surfaceParams.r;
  57. o.Occlusion = surfaceParams.g;
  58. o.Smoothness = surfaceParams.a;
  59. o.Alpha = _Alpha;
  60. }
  61. #pragma only_renderers d3d11 gles3 gles
  62. ENDCG
  63. }
  64. FallBack "Diffuse"
  65. }