
It should be the right way up in the very centre of the screen like how my Directional light is:

I think it has something to do with how I get the screen position coordinates in my shader. Originally it was like this:
struct VertexShaderInput
{
float3 Position : POSITION0;
};
struct VertexShaderOutput
{
float4 Position : POSITION0;
float4 ScreenPosition : TEXCOORD0;
};
VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output;
//processing geometry coordinates
float4 worldPosition = mul(float4(input.Position,1), World);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);
output.ScreenPosition = output.Position;
return output;
}
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
//obtain screen position
input.ScreenPosition.xy /= input.ScreenPosition.w;
// calculate light, snip
}
But the compiler would say this whenever I tried to access TEXCOORD0.w outside the vertex shader:
Quote
Direct3D9: VS->PS Linker: X446: (Error) Current pixel shader declares input texture coordinate t0.xyzw. However the current transformed vertex declaration (vertex proc. disabled) only provides texcoord0.xy
So then I moved
input.ScreenPosition.xy /= input.ScreenPosition.w;
into the vertex shader just above the return output line, and it no longer complained about anything, however it looks wrong, I believe the rest of the code is fine, however if anyone wishes to see the code I use to render the point light in C++ or HLSL please ask. I've spent at least a week trying to figure this out, so thank you in advance for any ideas, suggestions or help you may have.












