I have been trying to load this custom FX file into a Monogame project, and everything I try fails. (code taken from http://www.david-gouveia.com/scrolling-textures-with-zoom-and-rotation/)
sampler TextureSampler : register(s0);
float2 ViewportSize;
float4x4 ScrollMatrix;
void SpriteVertexShader(inout float4 color : COLOR0, inout float2 texCoord : TEXCOORD0, inout float4 position : POSITION0)
{
position.xy -= 0.5;
position.xy = position.xy / ViewportSize;
position.xy *= float2(2, -2);
position.xy -= float2(1, -1);
texCoord = mul(float4(texCoord.xy, 0, 1), ScrollMatrix).xy;
}
technique SpriteBatch
{
pass
{
VertexShader = compile vs_2_0 SpriteVertexShader();
}
}
If I convert it to an XNB file, and attempt to load it via the Content processor, it says "Could not load asset!", indicating that the file cannot be found. The XNB file is there along with the rest of the content, it is just not being loaded.
Next, I compiled the FX files into a MGFX file using 2MGFX. I included the MGFX files as an embedded resource and attempted to load the file by doing:
Effect test = new Effect(GraphicsDevice, Properties.Resources.parallax);
This crashed at Effect.cs saying argument out of range error.
What do I need to do to use this shader in Monogame?