Hi! Is there an equivalent to this tool within MonoGame ? Or should i update it by myself to figure out what needs to be done to assign an effect onto a model at build time ?

I think the tool should work since the format of xnb is the same in MG for XNA compatibility (maybe needs mapping to platforms that were not supported in XNA if that’s shown nicely in the tool, the fourth byte in an xnb is a target platform byte). I submitted a PR yesterday to fix the problems I encountered when trying to assign an effect to a model with a custom processor as done here. You can try out the build from the PR or wait for it to be merged. Thanks for the link, it helped me with the PR :slightly_smiling:

Our XNB files are forwards compatible with those produced by XNA. We have extended the range of platforms supported and added a second compression type, but aside from that the XNB files are the same between XNA and MonoGame.

We had reverse engineered most of the XNB file format before Microsoft published that document and sample. It allowed us to fill in the last few details in our support.

@Jjagg Nice ! Thanks, i’ll give a try as soon as I have some spare time after work. Do I need to pass the effect as an fx file or a reference to an xnb ?

string fxfilepath = "Shaders/Renderer/MRTRender.fx";
string effectfilepath = Path.GetFullPath(fxfilepath);
ExternalReference<EffectContent> extref = new ExternalReference<EffectContent>(effectfilepath, material.Identity);

@KonajuGames ok, I just need to use this one then.

My problem was lying in the ConvertMaterial method, where nothing worked as with XNA to assign the effect.
For instance, as the assignment of an effect to a model was too much of a hack for me, (I did not want to loose time figuring out how to get the right way to do it with GetRuntime(), writers, readers, etc, as i have been already working on my engine for 2 years with XNA and almost finished it when XNA died) I wrote a small app.
It is a sort of a small droppable box, where I drop the content folder, which is scanned for xnbs.
It then enables me to assign an effect to a model, specifying the right textures for deferred or pbr. It saves a sort of config file containing all the models and the effects to be assigned at load time.
I tested it with 10000 models (without parallelization), it took about 5s which is fine.
I was planning to use http://xbox.create.msdn.com/en-US/sample/xnb_format to look at the effect members of a file but… it seems I can stop my work on this.

But if the new pipeline allows this, i’ll switch to it :slightly_smiling:

I’ve just tested your PR, it has built my custom effect without error. When i have more time, I’ll modify my references to your dlls for the reader and test the in-engine part.
Thanks a lot, I can’t stand waiting for the merge :wink:

Awesome :slight_smile: Note that you don’t have to pass the full path if you pass a content identity to the external reference. Relative to the identity will work (E.g. new ExternalReference<…>(“Shaders/MyEffect.fx”, identity) )

Hum… I did no see I had left GetFullPath(). It was when only there to do some test.
The content of the generated xnb seems like my xna version, it should pass with monogame.
While waiting for the merge, I’ll carry on moving my engine to monogame to run after my lost time :smirk:, some parts need to be rewritten.

Hi :slightly_smiling: Do you have an idea about when your PR will be merged if it will be please ? By the way, it would be a nice update to monogame.
For instance, I’m using your build, but if meanwhile, more updates are merged to Monogame I’m afraid to be not up to date.

I hope very soon. I bumped Tom, but seems he’s busy.

Ok, thanks :wink: I’ll cross my fingers and my toes…

KonajuGames merged it :slight_smile:

Thanks ! :smile: I will put it at good use.