Code:
//////////////////////////////
// Matrix
//////////////////////////////; 
float4x4 matWorldViewProj; 
float4x4 matWorld;
float4x4 matView;
float4x4 matWorldInv;

//////////////////////////////
// Lighting
//////////////////////////////
float4 vecLightPos[8];
float4 vecLightColor[8];

//////////////////////////////
// Coloring
//////////////////////////////
float4 DiffColor   = {0.9f, 1.0f, 0.9f, 1.0f};
float4 AmbiColor  = {0.1f, 0.1f, 0.1f, 1.0f};
float4 SubColor  = {1.0f, 0.2f, 0.2f, 1.0f};

float RollOff  = 0.2;

//////////////////////////////
// Texture Reference
//////////////////////////////
texture entSkin1;
texture entSkin2;
texture entSkin3;

sampler2D ColorSampler = sampler_state
{
	Texture = entSkin1;
	MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
	AddressU = WRAP;
	AddressV = WRAP;
};

sampler NormalSampler = sampler_state
{ 
	Texture = entSkin2;
	MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
	AddressU = WRAP;
	AddressV = WRAP;
};

sampler GlossSampler = sampler_state
{ 
	Texture = entSkin3;
	MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
	AddressU = WRAP;
	AddressV = WRAP;
};

//////////////////////////////
// Data Structs
//////////////////////////////
struct appdata 
{
    float3 P			: POSITION;
    float4 UV			: TEXCOORD0;
    float4 N			: NORMAL;
    float3 T 			: TANGENT;
    float3 B 			: BINORMAL;
};

/* data passed from vertex shader to pixel shader */
struct shadedVertexOutput 
{
    float4 P			: POSITION;
    float4 Tex			: TEXCOORD0;
    float4 Col			: COLOR0;
};

/* data passed from vertex shader to pixel shader */
struct vertexOutput 
{
    half4 P					: POSITION;
    half4 Tex				: TEXCOORD0;
    half3 L					: TEXCOORD1;
    half3 wN				: TEXCOORD2;
    float3 V 				: TEXCOORD3;
    float3 Tangent 		: TEXCOORD4;
    float3 Binormal 		: TEXCOORD5;    
};

//////////////////////////////
// Vertex Shader
//////////////////////////////
void lambskin(float3 N,float3 L,out float4 Diffuse,out float4 Subsurface) 
{
    float ldn = dot(L,N);
    float diffComp = max(0,ldn);
    
    Diffuse = float4((diffComp * DiffColor).xyz,1);
   
    float subLamb = smoothstep(-RollOff,1.0,ldn) - smoothstep(0.0,1.0,ldn);
   
    subLamb = max(0.0,subLamb);
   
    Subsurface = subLamb * SubColor;
}

void lamb_ps_shared(vertexOutput IN,out float4 DiffuseContrib,out float4 SubContrib)
{
     
    half3 Ln = normalize(IN.L); 
    half3 Nn = normalize(IN.wN);
	
	 lambskin(Nn,Ln,DiffuseContrib,SubContrib);
}

vertexOutput simpleVS(appdata IN) 
{
	vertexOutput OUT;
	
	half4 Po = half4(IN.P.xyz,1);
	OUT.P = mul(Po, matWorldViewProj);

	OUT.Tex = IN.UV;

	float3 vP = mul(IN.P,matWorld);
	float4 vN = normalize(IN.N);

	OUT.L = float4(0.f,0.f,0.f,0.f);
   
   OUT.wN = mul(vN, matWorldInv).xyz;
   OUT.Tangent = normalize(mul(IN.T, matWorldInv));
   OUT.Binormal = normalize(mul(IN.B, matWorldInv));  
	
	half3 Pw = mul(Po, matWorld).xyz;
   for (int i=0; i<8; i++)
   {
      OUT.L+= normalize(vecLightPos[i] - Pw);
   }

	OUT.V = mul(vP, matView);
	
	return OUT;
}

//////////////////////////////
// Pixle Shader
//////////////////////////////
float4 lambPS_t(vertexOutput IN) : COLOR 
{
	float4 diffContrib;
	float4 subContrib;
	
	float4 Color = tex2D(ColorSampler, IN.Tex);
	float4 Gloss = tex2D(GlossSampler,IN.Tex);
	float4 Bump = tex2D(NormalSampler,IN.Tex);
	
	//LambSkin
	lamb_ps_shared(IN,diffContrib,subContrib);	
	float4 litC = diffContrib + AmbiColor + subContrib;

	//Normal Mapping
   float3 bumpNormal = IN.wN + (Bump.x * IN.Tangent + Bump.y * IN.Binormal);
   bumpNormal = normalize(bumpNormal);
   
	//Gloss
   float3 Normal = normalize(IN.wN);
   float3 LightDir = normalize(IN.L);
   float3 ViewDir = normalize(IN.V);
   float Diff = saturate(dot(Normal, LightDir));
   float3 Reflect = normalize(2 * dot(Diff, bumpNormal) * bumpNormal - LightDir);  
   float Specular = pow(saturate(dot(Reflect, ViewDir)), 20);   	
	Specular = Specular*Gloss.x;
	    	
	float4 FinalColor = (litC*Color)+Specular;	
	return FinalColor;
}

technique HumanSkin 
 {		
 	pass p0
 	{
		ZEnable = true;
		ZWriteEnable = true;
		CullMode = None;
		VertexShader = compile vs_2_0 simpleVS();
		PixelShader = compile ps_2_0 lambPS_t();
	}
}



It seems to be working correctly, however I am running into an issue...Whenever I add the Shadow Demo from the workshop The face becomes transparent...I do not know why this is happening as this is the first real shader I have tried to piece together
from reading on the net help here and all...so if any experts out there could take a glance at my code...point out a few things I am doing wrong...I would appreciate the critique.


John C Leutz II