• Advertisement
Sign in to follow this  

Cannot retrieve LightVector in Pixel Shader

This topic is 2657 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Why when I use this in my HLSL shader, everything work fine:


struct vertexOutput {
float4 HPosition : POSITION;
float2 UV : TEXCOORD0;
float3 LightVec : TEXCOORD1;
float3 WorldNormal : TEXCOORD2;
float3 WorldTangent : TEXCOORD3;
float3 WorldBinormal : TEXCOORD4;
float3 WorldView : TEXCOORD5;
};

/*Pixel Shader*/
float4 depthMap_PS(vertexOutput IN) : COLOR
{
float3 Ln = normalize(IN.LightVec);
float c = length(Ln);
return float4(c,0,0,1);
}



but when I use this I get an "E_FAIL" error: ?


struct vertexOutput {
float4 HPosition : POSITION;
float2 UV : TEXCOORD0;
float3 LightVec : TEXCOORD1;
float3 WorldNormal : TEXCOORD2;
float3 WorldTangent : TEXCOORD3;
float3 WorldBinormal : TEXCOORD4;
float3 WorldView : TEXCOORD5;
};

/*Pixel Shader*/
float4 depthMap_PS(vertexOutput IN) : COLOR
{
float c = length(IN.lightVec);
return float4(c,0,0,1);
}



Why can't I get IN.LightVec in Pixel Shader?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
float c = length(IN.lightVec);

Did you try IN.LightVec? HLSL is case-sensitive. [wink]

EDIT: You'll get more information in you check the error message buffer when you compile the shader.

Share this post


Link to post
Share on other sites
Compare very carefully:

IN.lightVec

and

IN.LightVec

There's a capital letter you're missing in the first line.

(cross-post) glad you got it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement