How to do fog with HLSL

Posted By: BionicHero

How to do fog with HLSL - 03/06/05 23:51

Just when I thought I understood HLSL there's always something to throw me back to zero. All I wanted to do is add fog to the water shader. So what I did was turning this:
Code:
 
struct VS_OUTPUT
{
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
float3 eyeLinear: TEXCOORD1;
};


into this:
Code:
 
struct VS_OUTPUT
{
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
float3 eyeLinear: TEXCOORD1;
float fog: FOG;
};


If I'm already wrong here please tell me. Then (for testing) the vertex shader for calculating fog looks like this:
Code:
 Out.fog=1.0; 


Yes, I know it's stupid, but it's just for testing.
And my pixelshader just multiplies the output color with this value:
Code:
 reflection *= In.fog; 


But when I run it I get "error X4502: invalid reference to the input semantic 'POSITION0'". The line given is the declaration of the vertex shader output "float4 Pos: POSITION;".
Could anyone help me on this one? I really don't get it...
Posted By: BionicHero

Re: How to do fog with HLSL - 03/08/05 09:31

Anyone???
© 2024 lite-C Forums