Quote:

struct VS_OUTPUT0
{
float4 Pos : POSITION;
float2 Tex : TEXCOORD0;
float3 View : TEXCOORD1;

float3 Light1 : TEXCOORD2;
float Att1 : TEXCOORD3;
float3 Sun : TEXCOORD6;

float3 Light2 : TEXCOORD4;
float Att2 : TEXCOORD5;

float Fog : FOG;
};


VS_OUTPUT0 VS_PASS0(float4 Pos : POSITION, float2 texcoord0 : TEXCOORD0, float3 Normal : NORMAL, float3 Tangent : TEXCOORD0 )
{
VS_OUTPUT0 Out = (VS_OUTPUT0)0;
Out.Pos = mul(Pos, matWorldViewProj); // transform Position

// compute the 3x3 tranform matrix
// to transform from world space to tangent space
float3x3 worldToTangentSpace;
worldToTangentSpace[0] = mul(Tangent, matWorld);
worldToTangentSpace[1] = mul(cross(Tangent, Normal), matWorld);
worldToTangentSpace[2] = mul(Normal, matWorld);

Out.Tex = texcoord0.xy;

float3 PosWorld = mul(Pos, matWorld);

float3 Viewer = PosWorld - vecViewPos;
Out.View = mul(worldToTangentSpace, - Viewer); // V

Out.Sun = mul(worldToTangentSpace, -vecSunDir);

//light 1
float3 Light1 = PosWorld - vecLightPos[0] ;
Out.Light1.xyz = mul(worldToTangentSpace, -Light1); // L
Out.Att1 = distance(PosWorld,vecLightPos[0])/vecLightPos[0].w; // Point light

//light 2
float3 Light2 = PosWorld - vecLightPos[1] ;
Out.Light2.xyz = mul(worldToTangentSpace, -Light2); // L

Out.Att2 = distance(PosWorld,vecLightPos[1])/vecLightPos[1].w; // Point light

float ofog = 1 - (distance(PosWorld, vecViewPos) - vecFog.x) * (vecFog.z);
Out.Fog = ofog;

return Out;
}




I tried adding it, but it gives an error and defaults to vertex lighting material. Then I added "float3 Sun : TEXCOORD6;" and theres no error, but it doesn't show the first light properly(and still no sun). I've also tried messing in the PS part and edited out light1 and put in Sun instead, but no luck. Am I messing things up?


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/