Ok so I have tired to make a go of this myself, as it is something I need for my game, and one should not expect handouts..not to mention the more I can increase my knowledge base the better...

So breaking down the idea into parts, I figured I would first see if I could code the color change to make the colors of the hair...

Roots - being the Darkest
Main - the majority of the hair color
Highlights - being the lightest...

I know their is a lot more to real hair color but its a start..


This is the texture I am using with alpha channels , figuring the easiest way from what I have read would be to do an alpha-blending of the colors..where the texture was darkest would be the darkest color ect ect ect

Right now I am just trying to blend the color red into the hair
and I either am missing a step in the logic, or well as this is the first shader I am trying to write....way off base...

Code:
// Input parameters.
float4x4 matWorldView;
float4x4 matProj;

texture entSkin1;
sampler hair = sampler_state
{
    Texture = entSkin1;
 
    MinFilter = None;
    MagFilter = None;
    MipFilter = None;
    AddressU = clamp;
    AddressV = clamp;
};



// Vertex shader input structure.
struct VS_INPUT
{
    float4 Position : POSITION0;
    float2 TexCoord : TEXCOORD0;
};

// Vertex shader output structure.
struct VS_OUTPUT
{
    float4 Position : POSITION0;
    float2 TexCoord : TEXCOORD0;
};

// Vertex shader program.
VS_OUTPUT VS(VS_INPUT input)
{
    VS_OUTPUT output;
 
    //generate the view-projection matrix
    float4x4 vp = mul(matWorldView, matProj);
    output.Position = mul(input.Position, vp);
 
    output.TexCoord = input.TexCoord;
 
    return output;
}

float4 PS(VS_OUTPUT input) : COLOR
{
    float4 colour = tex2D(hair, input.TexCoord);
    
  
	 colour.r = (colour.r * colour.a) + (255 * 1);
	 colour.g = (colour.g * colour.a) + (0 * 1);
	 colour.b = (colour.b * colour.a) + (0 * 1);
;
    return colour;
}

technique Terrain
{
    pass Main
    {
        AlphaBlendEnable = true;
        SrcBlend = SRCALPHA;
        DestBlend = INVSRCALPHA;
        VertexShader = compile vs_2_0 VS();
        PixelShader = compile ps_2_0 PS();
    }
}



The issue I am having is the white are receiving the tint I want, but the rest is coming back grey...



Can someone point me in the right direction


John C Leutz II