Hi,
since we need to get rid of the no-secondary-maps-on-mobile-Restriction we’ve create a custom Standard Surface Shader.
However the custom shader (which just sets some basic vars) does not work like intended. First issue, is that the _BumpScale is not applied like in the Standard Shader (a “fine grained” value like 0.26 is the same as if set to 1, but 2 is stronger, 3 etc. - but the value is a float?)
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap)) * _BumpScale;
Is this the correct way to apply the BumpScale?
The second issue is that - even without bump - the detail albedo is much brighter when using the Standard Shader.
Standard Shader: Dropbox
Custom Shader: Dropbox
Here is the full source of the shader (Note that for simplification / performance i use the UV of MainTex for Metallic and Bump):
Shader "Custom Colorable Object" {
Properties {
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo", 2D) = "white" {}
_MetallicGlossMap("Metallic", 2D) = "white" {}
_GlossMapScale("Smoothness", Range(0, 1)) = 0
_MetallicFactor("Metallic Factor",Range(0, 1)) = 0
_BumpMap("Normal Map", 2D) = "bump" {}
_BumpScale("Scale", Float) = 1.0
_DetailAlbedoMap("Detail Albedo x2", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _DetailAlbedoMap;
sampler2D _BumpMap;
sampler2D _MetallicGlossMap;
float _MetallicFactor;
float _BumpScale;
float _GlossMapScale;
struct Input {
float2 uv_MainTex;
//float2 uv_BumpMap;
float2 uv2_DetailAlbedoMap;
};
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * tex2D(_DetailAlbedoMap, IN.uv2_DetailAlbedoMap) * _Color;
//fixed4 c = tex2D(_DetailAlbedoMap, IN.uv2_DetailAlbedoMap) * _Color;
o.Albedo = c.rgb;
// Bump
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_MainTex)) * _BumpScale;
// Metallic
fixed4 mc = tex2D(_MetallicGlossMap, IN.uv_MainTex);
o.Metallic = mc.r * _MetallicFactor;
o.Smoothness = mc.a * _GlossMapScale;
}
ENDCG
}
FallBack "Diffuse"
}
I’d appreciate any help on these issues!
Best regards
zkw