Cannot retrieve LightVector in Pixel Shader

Started by
2 comments, last by Buckeye 13 years, 6 months ago
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?
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.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Ohhh, thank you very much!!!

I guess I need sleep!!!!!
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.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement