Add Bumpiness to this Shader?

Hi there…

I wanted to ask if someone can add me Bumping to this Shader?

Shader "Custom/DissolveDiffuse" {
Properties {
	_Color ("Main Color", Color) = (1,1,1,1)
	_MainTex ("Base (RGB)", 2D) = "white" {}
	_DissolveTex ("Dissolve (R)", 2D) = "white" {}
}

SubShader {
	Tags {"IgnoreProjector"="True" "RenderType"="TransparentCutout"}
	LOD 300

CGPROGRAM
#pragma surface surf Lambert alphatest:Zero
sampler2D _MainTex;
sampler2D _DissolveTex;
float4 _Color;

struct Input {
	float2 uv_MainTex;
	float2 uv_DissolveTex;
};

void surf (Input IN, inout SurfaceOutput o) {
	half4 tex = tex2D(_MainTex, IN.uv_MainTex);
	half4 texd = tex2D(_DissolveTex, IN.uv_DissolveTex);
	o.Albedo = tex.rgb * _Color.rgb;
	o.Alpha = _Color.a - texd.r;
}
ENDCG
}

Fallback "Transparent/Cutout/VertexLit"
}

I like the effect, but miss the normalmapping :confused:

Shader "Custom/DissolveDiffuse"
{
	Properties
	{
	    _Color ("Main Color", Color) = (1,1,1,1)
	    _MainTex ("Base (RGB)", 2D) = "white" {}
	    _BumpTex ("Normalmap", 2D) = "bump" {}
	    _DissolveTex ("Dissolve (R)", 2D) = "white" {}
	}
	
	SubShader
	{
    	Tags {"IgnoreProjector"="True" "RenderType"="TransparentCutout"}
		LOD 300
		
		CGPROGRAM
		#pragma surface surf Lambert alphatest:Zero
		
		sampler2D _MainTex;
		sampler2D _BumpTex;
		sampler2D _DissolveTex;
		float4 _Color;
		
		struct Input
		{
			float2 uv_MainTex;
			float2 uv_BumpTex;
			float2 uv_DissolveTex;
		};
		
		void surf (Input IN, inout SurfaceOutput o)
		{
			half4 tex = tex2D(_MainTex, IN.uv_MainTex);
			half4 texd = tex2D(_DissolveTex, IN.uv_DissolveTex);
			
			o.Albedo = tex.rgb * _Color.rgb;
			o.Normal = UnpackNormal(tex2D(_BumpTex, IN.uv_BumpTex));
			o.Alpha = _Color.a - texd.r;
		}
		ENDCG
	}
	Fallback "Transparent/Cutout/VertexLit"
}

This should to it for you. Basically you add a new Property, a new sampler2D, a new set of uv scaling/offset parameters to the Input struct and finally you sample the normal map withing the surface shader function. Keep in mind that you will need to tell Unity that your imported texture is of type Normal Map. Otherwise you’ll get shading rrrors.

Great!!!
works superb - thank you :smile: