I’m trying to create a shader that fades between two textures, including bumpmaps (normal). I’ve been trying for hours but I can’t figure out how to actually fade between the two bumpmaps.
This is what I got so far.
Shader "Insanity" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
_Shininess ("Shininess", Range (0.03, 1)) = 0.078125
_MainTex1 ("Base (RGB) Gloss (A)", 2D) = "white" {}
_BumpMap1 ("Normalmap", 2D) = "bump" {}
_MainTex2 ("Base (RGB) Gloss (A)", 2D) = "white" {}
_BumpMap2 ("Normalmap", 2D) = "bump" {}
_Blend ("Blend", Range(0.0,1.0)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 400
CGPROGRAM
#pragma surface surf BlinnPhong
sampler2D _MainTex1;
sampler2D _BumpMap1;
sampler2D _MainTex2;
sampler2D _BumpMap2;
float4 _Color;
float _Shininess;
float _Blend;
struct Input {
float2 uv_MainTex1;
float2 uv_BumpMap1;
float2 uv_MainTex2;
float2 uv_BumpMap2;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 tex1 = tex2D(_MainTex1, IN.uv_MainTex1);
o.Albedo = ( tex1.rgb * _Color.rgb ) * ( 1 - _Blend );
o.Gloss = ( tex1.a ) * ( 1 - _Blend );
o.Alpha = ( tex1.a * _Color.a ) * ( 1 - _Blend );
o.Specular = _Shininess;
half4 tex2 = tex2D(_MainTex2, IN.uv_MainTex2);
o.Albedo += ( tex2.rgb * _Color.rgb ) * ( _Blend );
o.Gloss += ( tex2.a ) * ( _Blend );
o.Alpha += ( tex2.a * _Color.a ) * ( _Blend );
//TODO Fade between normalmaps
o.Normal = UnpackNormal(normal1);
}
ENDCG
}
FallBack "Specular"
}
Anyone knows what I’m doing wrong and or what I need to do?
Thanks!