- Home /
Question by
Bob_King · Mar 08, 2017 at 09:15 AM ·
shadergraphicsprogramming
Secondary maps problem
Hello, I have problem enable secondary maps in simple shader. Is here anybody able to help please? Thansk a lot Bob
Shader "DualMaps" { Properties {
_MainTex("Main (RGB)", 2D) = "black" {}
_SecTex("Main (RGB)", 2D) = "white" {}
_FilTex("Filter (Alpha)", 2D) = "black"{}
_LightMap("Lightmap (RGB)", 2D) = "black" {}
_DetailMask("Detail Mask", 2D) = "white" { }
_DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" { }
DetailNormalMapScale("Scale", Float) = 1.000000
//_DetailNormalMap("Normal Map", 2D) = "bump" { }
}
SubShader
{
Tags{ "RenderType" = "Opaque" }
LOD 200
CGPROGRAM
pragma surface surf Lambert
pragma multi_compile sampler2D _MainTex; sampler2D _SecTex; sampler2D _FilTex; sampler2D _LightMap;
sampler2D _DetailAlbedoMap;
sampler2D _DetailNormalMapScale;
//sampler2D _DetailNormalMap;
struct Input
{
float2 uv_MainTex;
float2 uv_SecTex;
float2 uv_FilTex;
float2 uv_LightMap;
float2 uv_DetailAlbedoMap;
float2 uv_DetailNormalMapScale;
//float2 uv_DetailNormalMap;
};
void surf(Input IN, inout SurfaceOutput o)
{
fixed4 main = tex2D(_MainTex, IN.uv_MainTex);
fixed4 sec = tex2D(_SecTex, IN.uv_SecTex);
fixed4 filter = tex2D(_FilTex, IN.uv_FilTex);
fixed4 lm = tex2D(_LightMap, IN.uv_LightMap);
fixed4 da = tex2D(_DetailAlbedoMap, IN.uv_DetailAlbedoMap);
fixed4 dn = tex2D(_DetailNormalMapScale, IN.uv_DetailNormalMapScale);
//fixed4 dx = tex2D(_DetailNormalMap, IN.uv_DetailNormalMap);
o.Albedo = lerp(main.rgb, sec.rgb, filter.a);
o.Alpha = main.a;
o.Emission = lm.rgb*o.Albedo.rgb;
}
ENDCG
}
FallBack "Legacy Shaders/Lightmapped/VertexLit"
}
Comment