-
Notifications
You must be signed in to change notification settings - Fork 1
/
Unreal2unity.shader
63 lines (48 loc) · 1.33 KB
/
Unreal2unity.shader
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
Shader "UNREAL"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Normal("Normal", 2D) = "bump" {}
_Mask("Mask", 2D) = "white" {}
_BumpScale("", Range(0, 1)) = 1
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0
sampler2D _MainTex;
sampler2D _Normal;
sampler2D _Mask;
struct Input
{
float2 uv_MainTex;
};
fixed4 _Color;
half _BumpScale;
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandard o)
{
//Getting Albedo
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
//Big mask
fixed4 Mask = tex2D(_Mask, IN.uv_MainTex) ;
o.Metallic = Mask.b;
//Invert Roug map
o.Smoothness = 1-Mask.g;
o.Occlusion = Mask.r;
fixed4 NormalMap = tex2D(_Normal, IN.uv_MainTex);
//Invert G channel
NormalMap.g = 1 - NormalMap.g;
o.Normal = UnpackScaleNormal(NormalMap, _BumpScale);
o.Albedo = c.rgb ;
}
ENDCG
}
FallBack "Diffuse"
}