Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
2  
Are you using the develop3d branch? I have an outstanding question on the MonoGame forums about this which no one has touched. Essentially as soon as I even modify one of the pre-built effects the content importer wont process the file correctly. I did every step that you did with similar results. – RobCurr Feb 27 at 17:10
Yes, I am compiling the latest source from the develop3d branch. – Jon Feb 27 at 19:06

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.