Pixel-shader problems! [Dropped]

EDIT: this is basically a flawed / outdated tutorial problem, I think. Even the ones linked from here have errors / typos in variable names.

Especially frustrating because the examples “should” be simple… Eventually with a little guesswork I made it though.

I have a working SIMPLE pixel shader… I can now turn things white, regardless of their actual texture color… Amaze!


I can’t get any tutorial to work… Even the ones on this site don’t help me… Been programming for YEARS, so I shouldn’t be hopeless, but I always make ZERO progress with shaders for the same reason. I can’t find ONE working example… The one on this site with the bunny sprite is just another example of this… -The comments try to clear it up, but it leads nowhere.

I know all I need to know about what shaders are. I don’t think I need info. I need practical implementation.

Can someone post a complete .fx file here, just a real simple one, like make everything red…

And then show how it is implemented / used from my game code… -Some will have you put “effect1.CurrentTechnique.Passes[0].Apply();” inside Draw, some say include the effect as an overload in Begin()…

I cannot for the life of me find ONE example or tutorial that actually produces anything… Stumped.

Several hours spent, on multiple occasions, this nut won’t crack, here is your chance to be a hero!

The overload applies to a pixel shader used with spritebatch. I would recommend to get started you draw a white texture with spritebatch and pass in an effect with a Pixel shader. I think the MonoGame pipeline tool (I always forget the correct name but the GUI tool where you can compile content to xnb) provides the functionality to create a working (Pixel)shader effect file which can be used for spritebatch / spritebatch.Begin(…) overload.

I have used that tool to create an Effect… And I have then coded several simple tutorial shaders (one at any given time) in that file, even one that does NO manipulations, and it runs, but however I use it, whatever I try, using the shader just makes my sprites VANISH… sad face. …Even the sample shaders on github produce nothing on my end… Copy pasted even does nothing.

So I can write a shader, and load it in my game, and apply it when drawing, but the ONLY thing that ever happens, is that nothing is drawn when using the shader… Its exactly like I wrote a succesful shader to turn things invisible. LOL.

Post your code and we can have a look. :slight_smile:

Hi, I fixed the title to “dropped” because I cracked it :slight_smile: -By which I mean I can now change pixel colors, based on their colors… Lol… It’s not much but it’s a start…

It took all day though… But hey, I can make my sprites WHITE now, which I couldn’t do before. So It’s cool I guess…