Hey I found a specular bump mapping shader on the search here it is
float bumpiness = { 1.0f }; //Stärke des Bumpmappings
float specular_power = { 128.0f }; //Stärke des Lichts (1 = sehr stark, über 1 schwächer)
float Ka = { 1.0f }; //Gesamthelligkeit
float4 specular = { 1.0f, 0.956737f, 0.670380f, 1.0f }; //Specular Farbe
float4 ambient = { 0.37647f, 0.37647f, 0.24314f, 1.0f }; //Ambient Farbe alt: alles 1.0f
float4 diffuse = { 0.37647f, 0.37647f, 0.24314f, 1.0f }; //Diffuse Farbe alt: 0.839216f, 0.862341f, 0.890411f, 1.0f
float Kd = { 1.0f };
float Ks = { 1.0f };
float4 light_position = { -100.0f, 100.0f, -100.0f, 1.0f };
float4 eye_position = { 0.0f, 0.0f, -10.0f, 1.0f };
float4 vecViewPos;
float4 vecSunDir;
float4 vecAmbient;
float4x4 matWorldViewProj: register(c0);
float4x4 matMtl;
texture entSkin1;
texture entSkin2;
struct VS_INPUT_STRUCT
{
float4 position: POSITION;
float3 normal: NORMAL;
float2 texcoord0: TEXCOORD0;
float3 binormal: TEXCOORD1;
float3 tangent: TEXCOORD2;
};
struct VS_OUTPUT_STRUCT
{
float4 position: POSITION;
float2 bump_map: TEXCOORD0;
float3 light_vector: TEXCOORD1;
float3 half_angle: TEXCOORD2;
};
VS_OUTPUT_STRUCT VS( VS_INPUT_STRUCT vsInStruct )
{
VS_OUTPUT_STRUCT vsOutStruct; //** Declare the output struct
//**-----------------------------------------------------------
//** Calculate the pixel position using the perspective matrix.
//**-----------------------------------------------------------
vsOutStruct.position = mul(vsInStruct.position, matWorldViewProj );
//**----------------------------------------------
//** Pass the bump and base texture coords through
//**----------------------------------------------
vsOutStruct.bump_map = vsInStruct.texcoord0;
//**--------------------------------------------
//** Calculate the light vector in object space,
//** and then transform it into texture space.
//**--------------------------------------------
float3 temp_light_position = mul( vecAmbient, matMtl );
float3 temp_light_vector = temp_light_position - vsInStruct.position;
vsOutStruct.light_vector.x = dot( temp_light_vector, vsInStruct.tangent );
vsOutStruct.light_vector.y = dot( temp_light_vector, vsInStruct.binormal );
vsOutStruct.light_vector.z = dot( temp_light_vector, vsInStruct.normal );
//**-------------------------------------------
//** Calculate the view vector in object space,
//** and then transform it into texture space.
//**-------------------------------------------
float3 temp_eye_position = mul( vecViewPos, matMtl );
float3 temp_view_vector = temp_eye_position - vsInStruct.position;
float3 temp_view_vector2;
temp_view_vector2.x = dot( temp_view_vector, vsInStruct.tangent );
temp_view_vector2.y = dot( temp_view_vector, vsInStruct.binormal );
temp_view_vector2.z = dot( temp_view_vector, vsInStruct.normal );
//**-------------------------
//** Calculate the half angle
//**-------------------------
vsOutStruct.half_angle = vsOutStruct.light_vector + temp_view_vector2;
return vsOutStruct; //** Return the resulting output struct
}
sampler base_map = sampler_state
{
texture=(entSkin1);
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = LINEAR;
};
sampler bump_map = sampler_state
{
texture=(entSkin2);
MAGFILTER = LINEAR;
MINFILTER = LINEAR;
MIPFILTER = LINEAR;
};
struct PS_INPUT_STRUCT
{
float2 bump_map: TEXCOORD0;
float3 light_vector: TEXCOORD1;
float3 half_angle: TEXCOORD2;
};
struct PS_OUTPUT_STRUCT
{
float4 color0: COLOR0;
};
//**---------------------------------------------------------
//** Function: main
//** Description: Declare the main entry point for the shader
//** Input: PS_INPUT_STRUCT, derived from the output of
//** the associated vertex shader
//** Returns: PS_OUTPUT_STRUCT
//**---------------------------------------------------------
PS_OUTPUT_STRUCT PS( PS_INPUT_STRUCT psInStruct )
{
PS_OUTPUT_STRUCT psOutStruct; //** Declare the output struct
//**------------------------------------------------------
//** Retreive the base color and bump components from the
//** respective textures, based on the passed bump coords.
//**------------------------------------------------------
float3 base = tex2D( base_map, psInStruct.bump_map );
float3 bump = tex2D( bump_map, psInStruct.bump_map );
//**----------------------------------------------------
//** Normalize the passed vectors from the vertex shader
//**----------------------------------------------------
float3 normalized_light_vector = normalize( psInStruct.light_vector );
float3 normalized_half_angle = normalize( psInStruct.half_angle );
//**--------------------------------------------------------
//** "Smooth out" the bump based on the bumpiness parameter.
//** This is simply a linear interpolation between a "flat"
//** normal and a "bumped" normal. Note that this "flat"
//** normal is based on the texture space coordinate basis.
//**--------------------------------------------------------
float3 smooth = { 0.5f, 0.5f, 1.0f };
bump = lerp( smooth, bump, bumpiness );
bump = normalize( ( bump * 2.0f ) - 1.0f );
//**---------------------------------------------------------
//** These dot products are used for the lighting model
//** equations. The surface normal dotted with the light
//** vector is denoted by n_dot_l. The normal vector
//** dotted with the half angle vector is denoted by n_dot_h.
//**---------------------------------------------------------
float4 n_dot_l = dot( bump, normalized_light_vector );
float4 n_dot_h = dot( bump, normalized_half_angle );
//**--------------------------------------
//** Calculate the resulting pixel color,
//** based on our lighting model.
//** Ambient + Diffuse + Specular
//**--------------------------------------
psOutStruct.color0.rgb =
( base * ambient * Ka ) +
( base * diffuse * Kd * max( 0, n_dot_l ) ) +
( specular * Ks * pow( max( 0, n_dot_h ), specular_power ) );
psOutStruct.color0.a = 1.0f; //** Set the alpha component manually
return psOutStruct; //** Return the resulting output struct
}
technique spec_bump
{
pass Single_Pass
{
VertexShader = compile vs_2_0 VS();
PixelShader = compile ps_2_0 PS();
}
}