I run this code in PIX in Debugger window and for some pixel i have
ShadowMapPixelShader | ( 0.161, 0.000, 0.000, 1.000 ) | float4
but in Render window all pixels are black.
If i change code
float4 ShadowMapPixelShader(SMapVertexToPixel PSIn) : COLOR
{
return float4(0.5f, 0, 0, 1);
}
Can you check in pix that your matrices are definitely being set?
May I also ask why Output.Position and Output.Position2D are identical? Seems a bit of a waste of space and resources...
Hello.
My matrices are set. I can see it in Mesh window of Pix (Pre-vertex shader, Post-Vertex shader and Viewport is correct).
Output.Position and Output.Position2D are identical because i thought that after vertex shader i can't use a Position field in the Pixel Shader.
You can use the position value in the pixel shader, it'll be interpolated between the vertices so it will be the position at that pixel.
Looks to me like you're outputting depth at that point. What are you near and far plane values? If you have a really large range then the object might appear with a very dark colour due to how far away it is. Could you set it to return 1 - depth to make sure it's definitely setting the pixel colour there?
Sole Creator of Pigment - a procedural, block-base space trading sim.
PhD student working on medical imaging at the University of Southampton.