Shader をちょっと修正。Metallic Map を追加しました。こっちの方で質感をコントロールすれば、わざわざマテリアルを分ける必要ないじゃん!とやっと気が付くアホな自分でした。
Shader "Custom/Shader_VertexColor" {
Properties {
_MainTex ("Albedo", 2D) = "white" { }
_Color ("Color" , Color ) = (1, 1, 1, 1)
_MetallicGlossMap("Gloss Map", 2D) = "white" {} //追加
_Metallic ("Metallic" , Range(0, 1)) = 0.0
_Glossiness ("Smoothness", Range(0, 1)) = 0.5
_Occlusion ("Occlusion" , Range(0, 1)) = 1.0
_BumpScale ("Scale", Float) = 1
_BumpMap ("Normal Map", 2D) = "bump" { }
_DetailAlbedoMap("Detail Albedo x2", 2D) = "white" {}
_DetailNormalMapScale("Scale", Float) = 1.0
_DetailNormalMap("Normal Map", 2D) = "bump" {}
_DetailMask("Detail Mask", 2D) = "black" {}
}
SubShader {
Tags {
"Queue" = "Geometry"
"RenderType" = "Opaque"
}
CGPROGRAM
#pragma target 3.0
#pragma surface surf Standard fullforwardshadows
fixed4 _Color;
sampler2D _MainTex;
sampler2D _BumpMap;
sampler2D _DetailAlbedoMap;
sampler2D _DetailNormalMap;
sampler2D _DetailMask;
sampler2D _MetallicGlossMap; //追加
half _BumpScale;
half _Glossiness;
half _Metallic;
half _Occlusion;
half _DetailNormalMapScale;
struct Input {
float2 uv_MainTex;
float2 uv2_DetailAlbedoMap;
fixed4 color : COLOR;
};
void surf (Input IN, inout SurfaceOutputStandard o) {
fixed4 c1 = tex2D(_MainTex, IN.uv_MainTex) * _Color;
fixed4 c2 = tex2D(_DetailAlbedoMap, IN.uv2_DetailAlbedoMap) * _Color;
fixed4 m = tex2D(_DetailMask, IN.uv_MainTex);
o.Albedo = lerp(c1, c2, m) * lerp(1, IN.color, _Occlusion);
half4 glossmap = tex2D(_MetallicGlossMap, IN.uv_MainTex); //追加
o.Metallic = glossmap.r * _Metallic; //修正
o.Smoothness = glossmap.a * _Glossiness; //修正
fixed3 n = UnpackScaleNormal(tex2D(_BumpMap, IN.uv_MainTex), _BumpScale);
fixed3 n2 = UnpackScaleNormal(tex2D(_DetailNormalMap, IN.uv2_DetailAlbedoMap), _DetailNormalMapScale);
o.Normal= BlendNormals(n, n2);
}
ENDCG
}
FallBack "Diffuse"
}