Custom shader example


I have been trying to find a simple working custom shader example that will work with Monogame. I have found many XNA examples and some Monogame ones but none work or the examples are incomplete.

Can anyone please provide a link of a working Monogame custom shader example? I’m more interested in how to use the shader from the Draw() method rather than the HLSL coding.


Here’s an example that uses a custom shader to do some effects like normal mapping, horizontal flip, color mask, etc.


Best I’ve found is RB Whitaker’s tutorials, they cover both the HLSL and the use in XNA, but are still valid for Monogame.

Thank you to both dmanning23 and Avan_Madisen.

I have already looked at RB Whitakers tutorials but I couldn’t get them to work with Monogame. An error I often see with XNA tutorials is the shader inputs expect a POSITION whereas Monogame is sending a Sv_Position. Changing that is straight forward but then I hit mutiple other problems and/or I could get my code to run but nothing was rendered.

I’ll read through both suggestions again as I might have missed something.

I found a typo in my code setting a shader parameter with the wrong name which caused my quads not to render. I’m surprised there are no runtime errors shown when this happens.

Does anyone have any tips or weblinks for debugging shaders or is this something that cannot be debugged during runtime?

!!! “” you know… the most used engine search on the web… nope ?