I am using for the first time the Monogame. (Ver 3.5)
I was using in the XNA (SM3.0), but was ported to MonoGame (SM4.0).
In XNA it was displayed properly.
Cause I do not know, but it disables the color values in the shader.
test code A Comment out (test code B is Comment)
The output color of VertexShader, even if forced assignment, color is still black.
test code B Comment out (test code A is Comment)
The output color of PixelShader, if you force assignment, the color is white.
Why?
Vertex Shader of color, it seems not to have been passed to the Pixel Shader.
It is pitch black, but since the vertices are depicted, vertex data is no problem.
Both, to become white is the correct answer.
to pass the position to the pixel shader.
Now obviously you won’t get a color, since in your input you only ask for Normal and Position. Your input must also define a Color which you then pass to the output like this
SV_POSITION is required.
I usually use texture coordinates in my VertexShaderOutput like this
struct VertexShaderOutput
{
float4 Position : SV_POSITION;
float4 Color : COLOR0;
float2 TextureCoordinates : TEXCOORD0;
};
Don’t forget to set the values to the members of the struct at the end of the VertexShader as kosmonautgames said.
You can test your texture coordinates contained in the output by returning something like return float4(TextureCoordinates, 0,0);
If the result is uniformely filled with the same color (all red or all green for ex), your coordinates are wrong !
Delivery of color, has written of course.
Because the problem is not there, in the sample code, it has been omitted.
Rather than in the calculation of the color is a problem, but has put the color just prior to return,
Not be reflected in the pixel shader is is the problem.
Just to be sure, it has been modified the sample code
Way to avoid it was found, why I do not know.
In VS, without touching the COLOR0, and use the Vertex Color in COLOR1, there is no problem!
Then, when the output of the PS even COLOR1, will be displayed properly.
To try, to remove the COLOR0, also try only to COLOR1, will cause problems.
To imagine, register contents of COLOR0 it is, seem to have been destroyed.
data that follows the position data is, seems to be destroyed.
When i move the position data to the end of the structure, it has moved in the same way as the XNA.
Was good.
Although not a real solution, not perhaps of the Shader Compiler bug.
(So no other person becomes, only such to be my project …)