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