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