Moving old game from XNA to MonoGame

Hello guys, well, I am very new to the community and started with monogame some weeks ago.
Btw, by updating an old project from XNA to monogame there already came the first bug. I also need to say, that I am very new to shader programming, but I think I learn fast :slight_smile:

The project I am trying to update was already treated in another post but really someone did not think that thought quite to the end and considered the consequences or posted an answer. Maybe(I hope) you guys could help me.

Here are some infos about. in XNA it looks like this. Everything is colored right:

Here is the same thing after I merged the files in a new ganerated monogame project. As you can see on the picture, some items are rendered black instead of a color. I need to say, that everything without any color (hue:0) is rendered correctly. Everything what should be hued is rendered black. Furthermore gumps and fonts aren’t rendered correctly.

Everything I needed to do was to change the vertex- and pixelshader from:
vs_2_0
to
vs_4_0_level_9_1
and
ps_2_0
to
ps_4_0_level_9_1

Here is the shader I am currently using:

Maybe you guys know, what I am doing wrong?

Thank you for your time!!!

1 Like

Hey, and welcome to the community! :slight_smile:

Someone else was working on porting Ultima some time ago: https://github.com/hifi/UltimaMono

The issue you run into is probably this one:

It was opened by the person that tried to port UltimaXNA before. As a workaround you should explicitly declare both a texture and a sampler as written in this document (the first method): https://gist.github.com/Jjagg/096c5218d21c5e2944a88dbc1b6947b3

1 Like

Hello Sir, and thank you for the quick feedback. I really want to learn more about monogame and especially for this example, maybe also I am really new to shaders and so on.
To your reply. I read all about his posts in the past. Btw, it is a bit confusing to me because he es writing everything because he is trying to convert it over to linux.
You mentioned the first point on the link you posted. Do you mean “Using the old sampler syntax” or “Using the new sampler syntax”. I don’t understand the correct syntax for this. Sorry about this :frowning:
The original author is also using a SpriteBatch3D file for this, which I think is in relation to the renderer fx file right? Could you guys maybe have a look at this? I really want to understand what is happen in background. I am coming from C# and also C++ with a big experience in Unreal Engine 4 and I am planning to switch over to MonoGame for projects like this.
Thank you for the help again !!!

Greetings

Afterburner :
I don’t know if this is the right solution for this problem. It seems that the texture is maybe rendered but only with a wrong color.
Before is

After setting the hue to “0” of the robe in game:

BTW it is really hard to debug shaders and textures and so on. So I am looking for best practices to do this.At the moment I am a bit confused and I personally miss the starting point :frowning:

To your reply:
This is what it is currently doing as you can see in the link you posted here https://gist.github.com/Jjagg/096c5218d21c5e2944a88dbc1b6947b3#do-not-declare-textures-explicitly

Here is the function of my SpriteBatch3D:

And here are my samplers :
sampler DrawSampler : register(s0);
sampler HueSampler0 : register(s1);
sampler HueSampler1 : register(s2);
sampler MiniMapSampler : register(s3);

Here is a small update.
According to your provided link:

and the samplers:
sampler DrawSampler : register(s0);
sampler HueSampler0 : register(s1);
sampler HueSampler1 : register(s2);
sampler MiniMapSampler : register(s3);

I added this:

This is also the used technique behind and brings me a bit closer to my target. Now I need to fix the rest. Strange colored and some black color left:

BTW this is not a solution but at least a part of a solution. It would make life easier if I knew what monogame is doing different than XNA. At the moment I think its a bit more than close to „out of the box“.