Hellhound

04-09-2005, 05:24 PM

Hi,

I've implemented a dot3 cgShader and it works fine on my GeforceGT 6800 with vp/fp40. But i've got several problems with running that shader on older hardware ...

After some tests i've figured out, that the fragmend program is the part which will not run. Here is my code:

// input structure

struct vert2frag

{

float2 TextureCoords :TEXCOORD0;

float3 TangentSpaceLightPos :TEXCOORD1;

};

void main(const vert2frag IN, out float3 oColor:COLOR,

float4 AmbientLight,

float4 LMs : TEXCOORD4,

const uniform sampler2D NormalMap,

const uniform sampler2D DecalMap )

{

// normalize Light

float3 normTangentSpaceLightPos = normalize(IN.TangentSpaceLightPos);

// Do Dot3 calculation (N.L) (multiplication for more reflection)

float3 nmap= 2*(tex2D(NormalMap,IN.TextureCoords)-0.5).rgb;

//adding decal color (multiplication for better color results)

oColor = dot(nmap.xyz, normTangentSpaceLightPos)*tex2D(DecalMap,IN.Textur eCoords);

}On fp30 i got no compile failures but i see nothing. I've checked the code and it's rendered ... On fp20 i got the compile Error that normalize will not work ... but i can't belive that this simple and nesessary function will not work ...

Knows anyone whats happend and could help?

Thanks in advance,

Christian

I've implemented a dot3 cgShader and it works fine on my GeforceGT 6800 with vp/fp40. But i've got several problems with running that shader on older hardware ...

After some tests i've figured out, that the fragmend program is the part which will not run. Here is my code:

// input structure

struct vert2frag

{

float2 TextureCoords :TEXCOORD0;

float3 TangentSpaceLightPos :TEXCOORD1;

};

void main(const vert2frag IN, out float3 oColor:COLOR,

float4 AmbientLight,

float4 LMs : TEXCOORD4,

const uniform sampler2D NormalMap,

const uniform sampler2D DecalMap )

{

// normalize Light

float3 normTangentSpaceLightPos = normalize(IN.TangentSpaceLightPos);

// Do Dot3 calculation (N.L) (multiplication for more reflection)

float3 nmap= 2*(tex2D(NormalMap,IN.TextureCoords)-0.5).rgb;

//adding decal color (multiplication for better color results)

oColor = dot(nmap.xyz, normTangentSpaceLightPos)*tex2D(DecalMap,IN.Textur eCoords);

}On fp30 i got no compile failures but i see nothing. I've checked the code and it's rendered ... On fp20 i got the compile Error that normalize will not work ... but i can't belive that this simple and nesessary function will not work ...

Knows anyone whats happend and could help?

Thanks in advance,

Christian