I so wished I understood Shader coding so I need some help here… please
I want a shader that allows me to control the blending of the detail texture with the main texture.
Here is what I have so far which is missing the blending part
Edit: What I am actually looking for is the ability to control how much of the detail texture is showing on top of the main texture. Not an actual blend between the two like Lerp for instance would produce at 0.5 value.
Shader "Custom/Diffuse Bump Detail Blending" {
Properties {
_MainTex ("Main Texture", 2D) = ""
_Detail ("Detail Texture", 2D) = ""
_BumpMap ("Normal Map", 2D) = "bump" {}
_Blend ("Blend", Range(0, 2)) = 0.5
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert
struct Input {
float2 uv_MainTex;
float2 uv_Detail;
float2 uv_BumpMap;
};
float _Blend;
sampler2D _MainTex;
sampler2D _Detail;
sampler2D _BumpMap;
void surf (Input IN, inout SurfaceOutput o) {
//o.Albedo = lerp( tex2D (_MainTex, IN.uv_MainTex).rgb, tex2D (_Detail, IN.uv_MainTex).rgb, _Blend);
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
float3 detail = tex2D (_Detail, IN.uv_Detail).rgb * _Blend;
o.Albedo *= detail;
//o.Alpha = _Blend;
o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
}
ENDCG
}
Fallback "Diffuse"
}