XaiJu
Gliden64
Gliden64

patreon


New 2D fixes early access alpha build

Hello,

I spent this weekend on polishing our new HLE implementation of S2DEX microcode. This microcode used by many games to render sprites and backgrounds.

Current HLE implementation for backgrounds commands is too high level. Actual commands are very complex. The microcode is documented, but the documentation does not cover some tiny details in internal mechanics. Thus, existing implementation does not always work right. olivieryuyu decided to not rely on documentation and decode the microcode itself. The goal of that new decoding project was to implement commands in HLE as close as possible to LLE and obtain the result, which is as good as with LLE or better.

It was very long and hard project, which took circa six months. It is not finished yet, but we are close. Both background commands implemented and they produce exactly the same result as in LLE mode on all games we tested.

The picture above shows one of results of our work - correct background in Neon Genesis Evangelion. From one side, it is great result because the commands are very large and complicated. From the other side, LLE by itself not always gives perfect result.

You may run current versions of the plugin in LLE mode and find numerous graphics glitches in 2D games. Some of glitches caused by errors in texture loading code. Backgrounds commands do texture loading in quite weird manner, which "normal" game code never uses. I fixed several hard issues in plugin's texturing subsystem during development of that project. However, many glitches remained after these fixes. These glitches can be called "the curse of hardware rendering". There are two main groups of such glitches:

* gaps between polygons. Background commands can not draw background by one piece because of limited texture memory. Background image becomes split on narrow strips. Each strip is loaded in texture memory and rendered by separate rectangle. There are no gaps between rectangles, but gaps between images in them may appear when rendering resolution is higher than game's native resolution. It usually happens when size of the image is not exactly the same as size of area where it will be rendered. Texture scaling in higher resolution may cause fetching texels out of texture image bounds, thus cause artifacts, which look as gaps between polygons.

* garbage between polygons. Looks like a line of colored garbage between two polygons. Is is seldom kind of glitches, but it does not fixed by switching to native resolution. I did not find yet, how it can be cured.

So, new implementation has issues, but most of them appears only in non-native resolutions. GLideN64 already has tool to eliminate issues with 2D graphics in high resolutions. You may enable "Render 2D elements in native resolution" option to activate it. I adopted that tool to work with new background commands. Result is quite good in general, see attached screen shot. StarCraft backgrounds have glitches in high-res, but "Render 2D elements in native resolution" eliminates them. However, the tool is not bug-free by itself and in some games its use may cause disappearance of part of graphics. Besides, sometimes it is slow.

Patrons of GLideN64 project already can test our work as early access build. As you may guess from my explanations above, it is in rather alpha state. We tested it a lot, but with only two of us we could miss some regressions. Please test and leave bug reports here or on GitHub: https://github.com/gonetz/GLideN64/issues/1898. I suggest to start with  "Render 2D elements in native resolution" disabled and enable it only when you see aforementioned glitches. If use of  "Render 2D elements in native resolution"  causes new glitches, please report about it. Also, if you see glitches, please switch to LLE mode and compare. It is important for us to know about cases where LLE is still better.


New 2D fixes early access alpha build New 2D fixes early access alpha build

More Creators