Visual Studio and effect files

Hello,

I was wondering what the best/most common practice is when it comes to working with *.fx effects.

Currently the process I’m using is adding some overhead to the development. I manually compile my effects using the 2MGFX.exe tool and then manually add them/overwrite them in a content folder within my project which I then load during run time as follows:

var effectBytes = File.ReadAllBytes("Content/effect.mgfxo");
_effect = new Effect(graphicsDevice, effectBytes);

I haven’t wrapped my head around how the pipeline tool works using effect files, surely there has to be a better approach than the one I’m using.

Ideally I’d like to be able editing my .fx files in Visual Studio and load them using the ContentManager.

Thanks in advance!

it works like all the other assets in the contentmanager.

-> Add existing files
-> select your *.fx file

done.

In your game code, you can use it like this

PostprocessEffect = content.Load(“FX/PostProcessing”);

Doh, you’re right.

I was always specifying the file extension which threw me exceptions saying that the file wasn’t found, didn’t bother reading it properly, my bad.

Thank you! :slightly_smiling: