the models dissapear and appear right in front of the camera blocking most of your visibility when you point it where the models should be. They are black, but I guess thats because I have not added light yet??? anyway, the lighting effect on the black models looks cool unless it is just a fluke. I will keep banging away at it. feel free to give a pointer, I'm frustrated already

Here is what I have so far:
Code:
 
float4x4 matWorldViewProj: register(c0);
float4x4 matView: register(c4);



texture entSkin1;
texture entSkin2;

sampler ColorMapSampler = sampler_state
{
Texture = <entSkin1>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
AddressU = wrap;
AddressV = wrap;
};


sampler BumpMapSampler = sampler_state
{
Texture = <entSkin2>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
AddressU = wrap;
AddressV = wrap;
};

struct VS_OUTPUT {
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
float3 lightvec: TEXCOORD1;
};

//VS_OUTPUT VS1(float4 Pos: POSITION, float3 normal: NORMAL, float3 tangent: TANGENT, float3 binormal: BINORMAL) {
VS_OUTPUT VS1(float4 Pos: POSITION, float3 normal: NORMAL, float3 tangent: TANGENT) {
VS_OUTPUT Out;

//Out.Pos = mul(view_proj_matrix, Pos);
Out.Pos = mul(matWorldViewProj, Pos);



// Some object-linear texgen, specific for this particular model
Out.texCoord.x = Pos.x * 0.0065 + 0.46;
Out.texCoord.y = Pos.z * 0.0065 + 0.46;



//float3 Pview = -mul(view_matrix, Pos);
float3 Pview = -mul(matView, Pos);

// Move our tangent-space into eye-space

float3 vtang = mul(matView, tangent);
float3 vbinorm = mul(matView, cross(tangent, normal));
float3 vnorm = mul(matView, normal);


// We use lightVec = viewVec, that is, the camera is also the light.
float3 lightvec = Pview;

// Transform light vector from eye-space to tangent-soace
Out.lightvec.x = dot(lightvec, vtang);
Out.lightvec.y = dot(lightvec, vbinorm);
Out.lightvec.z = dot(lightvec, vnorm);

return Out;
}

/////////////////////Pixel Shader


float4 Gold: register(c0);
sampler ColorMap: register(s0);
sampler BumpMap: register(s1);

float4 PS1(float2 texCoord: TEXCOORD0, float3 lightvec: TEXCOORD1) : COLOR {
float4 base = tex2D(ColorMapSampler, texCoord);
float3 bump = tex2D(BumpMapSampler, texCoord) * 2.0 - 1.0;

// shine = diffuse and specular
float shine = saturate(dot(normalize(lightvec), normalize(bump)));
return (shine * 0.2) * base + pow(shine, 64) * Gold;
}


technique Gold_shine
{
pass p0
{
VertexShader = compile vs_1_1 VS1();
PixelShader = compile ps_2_0 PS1();
}
}





I think the lines below this comment are whats messing it up as far as the camera.
// Move our tangent-space into eye-space

Last edited by zefor; 01/21/06 13:48.