Problems porting xna to monogame: Strange Textures (windows)

I ported my minecraft clone from xna to monogame.
This is how it looked in XNA:

This is how it looks now:

The textures seem to be nearly gone, just sometimes colored stripes.

Alpha Textures are not displayed at all (for example the window or the water in the background). The texture files itself loaded correctly as one can see at the screen bottom where the are rendered as sprite.

This is my vertex declaration, I had to remove byte4 since it wasn’t supported.

        public readonly static VertexDeclaration VertexDeclaration = new VertexDeclaration
            new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
            new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),
            new VertexElement(24, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0)
            //new VertexElement(32, VertexElementFormat.Byte4, VertexElementUsage.Color, 0)// portingissue

struct VS_INPUT 
	float3 Position : SV_POSITION0;
	float3 Normal	: NORMAL0;
	float2 Texcoord : TEXCOORD0;	
	//byte4 Color		: COLOR0;

Iam rendering my blocks as triangle lists with DrawIndexedPrimitives.

What could cause such strange looking?

I even simplified my pixelshader to this but the problem stays the same:

float4 ps_main(PS_INPUT input) : COLOR
float4 c = tex2D(baseMap, input.Texcoord);
return c;

It looks like the UV coordinates aren’t correct. Another thing to try is using the more common float4 for the Color element.

But I pass the same UV coordinates as I do on the xna version, I didn’t change that. Could there be a bug in monogame so that vertexdeclaration is incorrectly interpreted?

I hope that did not change struct packing in visual studio 2015 I have to check that…

Please show us your VS_INPUT, VS_OUTPUT, and PS_INPUT structs. (Direct3D 11 handles some things differently compared to Direct3D 9. The problem might be in your struct declarations.)

This is the complete shader I am using.

float4x4 ViewProjection;
float4 LightDir;
float4 AmbientColor;
float4 DiffuseColor;
float4x4 World;
float ClipThreshold;

float FogStart;
float FogEnd;
float3 FogColor;

texture UserTexture;
texture DamageTexture;

float Damage;

sampler baseMap = sampler_state 
	texture = <UserTexture>;

sampler damageMap = sampler_state 
	texture = <DamageTexture>;

struct VS_INPUT 
	float4 Position : SV_POSITION0;
	float2 Texcoord : TEXCOORD0;
	float3 Normal	: NORMAL0;
	//float3 Position : SV_POSITION0;
	//float3 Normal	: NORMAL0;
	//float2 Texcoord : TEXCOORD0;	
	//float Color		: TEXCOORD1;

struct VS_OUTPUT 
	float4 Position:	SV_POSITION0;
	float3 Color:		COLOR0;
	float2 Texcoord:	TEXCOORD0;
	float Depth:		TEXCOORD1;

struct PS_INPUT
	float4 Color	: COLOR0;
	float2 Texcoord	: TEXCOORD0;
	float Depth		: TEXCOORD1;

VS_OUTPUT vs_main(VS_INPUT Input)

   float4 gp = mul(Input.Position,World);  

   // Compute the projected position and send out the texture coordinates
   Out.Position = mul(gp, ViewProjection);
   // Diffuse using Lambert
   float DiffuseAttn = max(0, dot(Input.Normal, LightDir) );
   // Output Final Color
   Out.Color = saturate(AmbientColor + DiffuseColor * DiffuseAttn) ;//* (Input.Color/256.0);

   Out.Texcoord = Input.Texcoord;  
   Out.Depth = Out.Position.z;

   return Out;

float4 ps_main(PS_INPUT input) : SV_TARGET 
	float4 c = tex2D(baseMap, input.Texcoord);
	clip(c.a - ClipThreshold);   

	c = c-Damage * tex2D(damageMap, input.Texcoord);

	float val = saturate( (input.Depth-FogStart) / (FogEnd-FogStart) );

	return lerp(/*input.Color* */ c, float4(FogColor,1), val);

technique TransformTechnique
    pass P0
        vertexShader = compile vs_4_0_level_9_1 vs_main();
        pixelShader = compile ps_4_0_level_9_1 ps_main();

VS_OUTPUT should be the input for ps_main(). You have a different structure for input to ps_main(). Try changing ps_main() to take VS_OUTPUT.

VS_OUTPUT should look like this:

struct VS_OUTPUT 
    float4 Color: COLOR0;
    float2 Texcoord: TEXCOORD0;
    float Depth: TEXCOORD1;
    float4 Position: SV_POSITION0;

The first parameters (type and semantic) need to match the parameters in PS_INPUT.
Optional parameters, i.e. parameters that do not appear in PS_INPUT, need to be at the end of the struct.

Thank you that was it, now it works!

I have more porting issues, but will make new posts for them.