2D images misalignment #800

Open
gonetz opened this Issue Nov 19, 2015 · 84 comments

Projects

None yet
@gonetz
Owner
gonetz commented Nov 19, 2015

Large 2D images (e.g. backgrounds) rendered with TexRect command often have alignment issues between parts of the image. Example:
gliden64_mariokart64

@AmbientMalice
Contributor

I'm assuming this somewhat more drastic alignment problem is related? #471

c679e270-f0f4-11e4-9499-d13667380d73

edit:
Nope, doesn't seem to be.

@gonetz
Owner
gonetz commented Nov 19, 2015

Yes Rocket is related, but not fixed by this fix. I'll check why.

@AmbientMalice
Contributor

Yes Rocket is related, but not fixed by this fix. I'll check why.

On the bright side, it's not just Rocket affected by that particular misalignment "look", so if that bug is fixed, it'll identical squash texture bugs in a bunch of other games, too.

@gonetz
Owner
gonetz commented Nov 19, 2015

I suppose that Rocket has a specific bug, otherwise it would be fixed as well.

@AmbientMalice
Contributor

Anyhow, @gonetz, it's a really good bit of coding you've done. It's a huge visual improvement.

@purplemarshmallow
Contributor

Conker's BFD does not like this feature. The minimap is broken. The circles are not round. During scenes with a lot of text performance drops below fullspeed. I'll do more testing.
gliden64_conker_bfd_000
gliden64_conker_bfd_001

@gonetz
Owner
gonetz commented Nov 19, 2015

I forgot to mention: Pokemon Stadium 2 is incompatible with that technique.

@gonetz
Owner
gonetz commented Nov 19, 2015

2D in Rocket does not use bilinear filtering. The new drawing method applied only to filtered textures. Unfiltered textures must be aligned. So, this is really specific bug.

@purplemarshmallow
Contributor

In OOT some items are invisible. I put the lens of truth on the right c button but it's invisible.
gliden64_the_legend_of_zelda_004

@purplemarshmallow
Contributor

Super smash bros many images are missing
gliden64_smash_brothers_000

@purplemarshmallow
Contributor

F-Zero X
gliden64_f-zero_x_000

@gonetz
Owner
gonetz commented Nov 19, 2015

Thanks! I'll look is it possible to fix.

@gonetz
Owner
gonetz commented Nov 20, 2015

Please give me save for Super smash bros.

@LuigiBlood

Mario Artist Paint Studio still fails with transparency with black (also the stamps that clearly is still not working right as it overlays the screen with white). I should note 2D fix didn't change anything. It was like this before.
gliden64__001

I also notice that setting the plugin while emulating makes it very buggy, loses all textures for no reason unlike older versions.

(I also suggest trying Mario Artist for testing features related to frame buffer because it overuses that stuff.)

@gonetz
Owner
gonetz commented Nov 20, 2015

All known graphics issues fixed. Performance issues are possible, if you have weak hardware.
Thanks purplemarshmallow for testing.

Updated binaries:
https://drive.google.com/file/d/0B0YqMPjGo3B2WmtmalVFOEJCSGc/view?usp=sharing

@purplemarshmallow
Contributor

Glover has depth problems and black borders
savestate: https://drive.google.com/file/d/0B7Y6r4SpC_QQZTIwcllNMjJRQ0U/view?usp=sharing
gliden64_glover_002

@purplemarshmallow
Contributor

Pokemon Stadium 2 boxes are black
gliden64_pokemon_stadium_2_009
gliden64_pokemon_stadium_2_014

@purplemarshmallow
Contributor

Top Gear Overdrive intro. At the snowblind studios logo it runs very slow I get 8 VI/s. The snow kills performance.

@gonetz
Owner
gonetz commented Nov 20, 2015

Wow, you're fast in bugs hunting! :)

Yes, if frame uses lots of separate texrects, it will work slow.

I'll check other issues. Thanks!

@LuigiBlood

Mario Artist Polygon Studio
Regular GLideN64 (2015/10/12) [I should mention that's the one I use regularly]:
polymenu_1
GLideN64 2Dfix2:
polymenu_2

There's also missing graphics in Talent Studio.

By the way should I make several issues for each Mario Artist games or should I do all-in-one? There are still bugs to begin with.

EDIT: Just tested a master build from 2015/11/14. Actually that bug is also there. So nevermind about 2Dfix.
EDIT2: However most 2D graphics aren't visible in 2Dfix2.

@gonetz
Owner
gonetz commented Nov 21, 2015

By the way should I make several issues for each Mario Artist games or should I do all-in-one? There are still bugs to begin with.

Please open a ticket for this regression bug. Other issues with this game can be described in another single ticket.

@standard-two-simplex

Great bugfix!
Excitebike 64 was unaffected by the changes though.
gliden64_excitebike64_000
There are a few more alignment issues in the intro and main menu.
Savestate in the main menu: https://drive.google.com/file/d/0B8aIJkrbGl-zVXZHN3NxZzhfaEU/view?usp=sharing

@gonetz
Owner
gonetz commented Nov 21, 2015

Excitebike 64 needs this fix from master:
f7ee508

I'll merge it to the next build.

@MelonSpeedruns

In Ocarina of Time, the HUD textures seems to render more blurry than usual. Probably rendering at a smaller size?

@gonetz
Owner
gonetz commented Nov 23, 2015

Yes, small objects look worse than with usual method, not sure why.
They look worse with software render as well.
Comparison screen shot: GLideN64 with regular texrect drawing - new drawing method - software lle
hearts

@standard-two-simplex

gliden64_ogrebattle64_000

Ogre battle backgrounds still render wrong.
I don't know if the sprites not matching might be related.
Savestate; https://drive.google.com/file/d/0B8aIJkrbGl-zNW9Jd0lYaHhseVk/view?usp=sharing

@gonetz
Owner
gonetz commented Nov 23, 2015

Problem with sprites is not related to this feature. The feature fixes only texrects. Sprites are not texrects.

@standard-two-simplex

gliden64_marioparty3_000
Mario Party 3 has been broken. Maybe this changes had something to do with it.

@gonetz
Owner
gonetz commented Nov 26, 2015

It's very possible.

@theboy181

What's updated?

Sent from my iPhone

On Nov 28, 2015, at 11:46 AM, Sergey Lipskiy notifications@github.com wrote:

Updated binary:
https://drive.google.com/file/d/0B0YqMPjGo3B2bUhkR1ZWYi0tYjA/view?usp=sharing


Reply to this email directly or view it on GitHub.

@LuigiBlood

Mario Artist Talent Studio has no menu visible in the talent mode (top mode in the main menu).
It was like this before (only on 2Dfix).

@standard-two-simplex

MP3 issue fixed.

@AmbientMalice
Contributor

As a side effect, likely of 1580aa0, the black lines in issues such as #450 have been half-fixed. Not perfect, because they're sometimes visible, but the alignment is better.

gliden64_tetrisphere_001

I did notice a problem, however. The text in 40 Winks, another game with black lines tends to be cut off at end right hand side, and I'm 99% sure it didn't do that before.

gliden64_40_winks_001

The FOUN will flash and then turn to FOUND and then back again over a few seconds.

@SwinglesMan

Thanks for this. It even improves speed when using texture filtering options like smoothing 4 and x2. However, anything used from that section still cause lag spikes. Way less than before, but it still happens.

Also, 4K doesn't seem to give errors anymore :)

@oddMLan
Contributor
oddMLan commented Dec 1, 2015

oh
oh2

Conker's BFD is affected, too.

@SwinglesMan

Killer Instinct Gold as well. VS screen, characters get divided into sections. And while fighting, Heads can get chopped off.

@frankyfife

Super Mario 64 give me some strange font errors with the plugin provided up above (the pre-fix version too). PJ64 2.2.0.9999, RSP Interpreter by Iconoclast, Azimer XA2 WIP6, NRage 2.4. Exept a custom resolution set by me all settings r vanilla.

gliden64_super_mario_64_001
gliden64_super_mario_64_000

@theboy181

I noticed this weird character bug on MK64 too. If you full screen and return it will display normally. Does it display properly if you switch to full screen and back?

@frankyfife

Tried that, but nothing changed. With jabos direct3d 8 plugin everything is fine.

@gonetz
Owner
gonetz commented Dec 9, 2015

@AmbientMalice @oddMLan @frankyfife
I can't reproduce the issues you reported. Do you use NVidia cards?

@SwinglesMan I can reproduce KI problem, thanks

@frankyfife

@gonetz - yes, i use an gtx 980Ti nvidia card

@gonetz
Owner
gonetz commented Dec 9, 2015

Anybody with ATI or Intel graphics - please test issues with missing last character in CBFD and 40 winks. SM64 issue also does not reproduced on my ATI card.

@weinerschnitzel

SM64 pre-level text is invisible on Intel, it is visible for maybe 1 frame, then disappears. Pause menu text looks fine, but some textures flash/flicker. (U)[!] version.
Conker's BFD text is readable.
40 Winks last letter OK.

@baptiste0602
Contributor

I can't reproduce CBFD, 40 Winks or SM64 bug, everything is OK for me.
I have a Nvidia card (GTX670) with latest drivers (359.06).

@oddMLan
Contributor
oddMLan commented Dec 10, 2015

I actually have an AMD Radeon R7 200, so I don't think this issue is vendor-exclusive.

@gonetz
Owner
gonetz commented Dec 10, 2015

Ok, it's not vendor specific, good. Please reset settings to defaults, set shades cache off and test again.

@weinerschnitzel

m64etext

Still get the SM64 issue with shader cache disabled. The (E) version has the messed up text, (U) has invisible text before levels.

@oddMLan
Contributor
oddMLan commented Dec 10, 2015

@gonetz Disabling Antialasing fixes the missing last letter issue in Conker's BFD. Also 40 Winks as well. @AmbientMalice

Shader cache is unrelated.

@oddMLan
Contributor
oddMLan commented Dec 10, 2015

2D Fix version:
bilinear bad

GlideN64 rev.34fa719
bilinear good

Is it just me or the 2D fix version is applying bilinear filtering to textures that shouldn't have it? I don't see the same problem in @frankyfife 's screenshot though.

I tested Super Mario 64 (U) version.

@gonetz
Owner
gonetz commented Dec 10, 2015

Disabling Antialasing fixes the missing last letter issue in Conker's BFD. Also 40 Winks as well.

Thanks!

Is it just me or the 2D fix version is applying bilinear filtering to textures that shouldn't have it?

It should not be. 2D fix applied only for texrects with bilinear filter. It can be my bug of course, as with AA.

@gonetz
Owner
gonetz commented Dec 10, 2015

Missing gfx with AA: found and fixed.

"applying bilinear filtering to textures that shouldn't have it" : can't reproduce

SM64 text issue: yes, it happens in LLE mode. The issue is not related to this feature, it presents in master also.

@weinerschnitzel

@oddMLan are you referring to the black border that appears on the HUD objects? I suppose this is the same result that happens with the hearts in Zelda. These "black borders" show up in the U version, the E version's are left unfiltered.

Thanks for clearing that up Gonetz. I should have been able to confirm that against master before reporting it.

@oddMLan
Contributor
oddMLan commented Dec 11, 2015

@oddMLan are you referring to the black border that appears on the HUD objects?

Yes.

These "black borders" show up in the U version, the E version's are left unfiltered.

Interesting, haven't tested the E version. Let me check on that.

Edit: You're right, E version doesn't seem affected.
bilinear good e

But J version is as affected as the U version
bilinear bad j

GlideN64 rev.34fa719 shows correct filtering in all cases.
Before anyone asks, yes, I tested each time with default settings (clicked "Reset settings") and in addition with Shader Cache disabled

EDIT: Huh? I managed to get this result in the J and U version if I used GlideN64 rev.34fa719 and switched to 2D Fix version inmediately afterwards without resetting settings:
huh

Result although no longer filtered, is still wrong with black borders.

When I switched back to 2D Fix version with Shader Cache support, it got enabled automatically and generated cache file but even disabling it from the settings doesn't seem to make a difference.

Deleting shader cache still gives same result.

Only way to "fix" (which means just returning to the wrong bilinear filter with black borders) is resetting settings to defaults.

@weinerschnitzel

Maybe the texture cache with the black borders is leftover, and the the unfiltered textures are drawn on top? That would explain why a few black pixels would remain. Could you recreate a clean unfiltered and clean filtered screenshot for comparison with this anomaly?

I suppose the plugin would have to clear and rebuild texture cache on plugin switch?

@oddMLan
Contributor
oddMLan commented Dec 11, 2015

I wanted to test Earthworm Jim 3D because I know this game's logo had an issue that this 2D Fix intended to address:

m good 2d
Using GlideN64 rev.34fa719 you can clearly see the logo is broken up into tiles here that don't seem to align quite well.

But I tried it with 2D fix version.

missing 2d

There's no logo. Or any 2D elements at all.
m menu

This is supposed to be the game's file menu.

E version is affected with the same issue.

@weinerschnitzel

Does turning AA off resolve the issues with Earthworm Jim? I think gonetz said he has a commit on the way

That background does look misaligned though

@oddMLan
Contributor
oddMLan commented Dec 11, 2015

I don't have AA or Anisotropic filtering enabled.

also
zzzzzzzz

I noticed both U and J versions dont filter the text in the file select menu so that won't serve as good comparison.

but I created a new comparison
2D Fix default settings + shader cache disabled
bilinear bad

2D Fix after running game with GlideN64 rev.34fa719 without resetting settings to defaults. Shader cache disabled. Before running game made sure there was no trace of htc cache or shader cache left.
wrooong

@weinerschnitzel

do these filtering issues have anything to do with how close the texture is to the front of the viewport? Perhaps SM64 (E) draws the HUD items closer to the screen than (E) and (J.) I do recall Rice Video having to translate the beating heart via hack to show up on screen. Would that explain why the last heart (that beats) is unfiltered why the others are filtered? Maybe a threshold can be modified or certain textures can be idenified by CRC to disable filtering?

(Sorry if my jargon is off, I only know so much about computer gfx, and I am stabbing in the dark)

@purplemarshmallow
Contributor

Viewport problems only happen in HLE. In LLE the RSP does this work. If it's a viewport problem it should be correct in LLE.

@weinerschnitzel

LLE or HLE does not make a difference in filtering the HUD objects in SM64. Guess that rules that one out.

@gonetz
Owner
gonetz commented Dec 12, 2015

Yes, all texrects in Earthworm Jim 3D disappeared. Bad.

@gonetz
Owner
gonetz commented Dec 13, 2015

New build:
https://drive.google.com/file/d/0B0YqMPjGo3B2NEU4cUgwZEdSWVE/view?usp=sharing

Fixed AA issues, Mario Tennis issue and Earthworm Jim 3D issue.

@RibShark

On the topic of the SM64 HUD being filtered on NA and JP, this also happens on the Virtual Console releases (with the HUD being unfiltered on the EU version), so this is likely not an emulation error.

You can get the HUD to become unfiltered by changing Texture Enhancement to Store.

@oddMLan
Contributor
oddMLan commented Dec 13, 2015

fixed
Nice work! The logo is fixed and also not misaligned anymore.
But, I notice now there's some distortion around the end of the yellow letters that didn't happen without the 2D Fix. Is this some sort of side effect that can't be avoided?

On the topic of the SM64 HUD being filtered on NA and JP, this also happens on the Virtual Console releases (with the HUD being unfiltered on the EU version), so this is likely not an emulation error.

dac

Well, Nintendo's emulators aren't known for being the most accurate, either.
But Angrylion's pixel-accurate plugin shows the HUD as unfiltered in the U version so

@gonetz
Owner
gonetz commented Dec 13, 2015

Yes, text in Earthworm Jim looks worse than without 2D fix, can't say why.

@oddMLan
Contributor
oddMLan commented Dec 13, 2015

Could you end up reproducing the filtered HUD problem in Super Mario 64 (U)?
Me and @weinerschnitzel could reproduce it

You can get the HUD to become unfiltered by changing Texture Enhancement to Store.

Just tested that and you're right. And it keeps filtering textures where it should. Weird.

@oddMLan
Contributor
oddMLan commented Dec 13, 2015

help
Using the "store" option under texture enhancements seems to fix the text in EWJ3D, but then the seams in the logo become noticeable again, although not as much as without the 2D Fix version.

@AmbientMalice
Contributor

The 2D fix cleans up RE2 portraits, but causes a problem -- ugly lines around the edges. Like the texture is incorrectly wrapped.

re2_n64

Wonder Project J2 has a problem. Note the window in the background. This is with Glide64 or GLideN64 with "store" textures enabled.

glide64_wonder_project_j2_01

Now this is the window with 2D fix. The overall image is improved, but the top right corner of the window is missing.

gliden64_wonder_project_j2_000

The above is a partial regression introduced between 21 November (2DFix2) and 30 November. (2DFix4), looking through my files. Below is how it looks with the 21 November build. Notice the correct window, but green lines above. Very likely this commit is responsible. 1580aa0

gliden64_wonder_project_j2_003

@gonetz
Owner
gonetz commented Dec 14, 2015

Using the "store" option under texture enhancements seems to fix the text in EWJ3D, but then the seams in the logo become noticeable again, although not as much as without the 2D Fix version.

2D fix does not applied to enhanced textures. That is it just not used with "store" enabled .

Actually it's not quite correct, because "store" mode is an optimization, not enhancement.

@SwinglesMan

-Turning on AA during games in 4K crashes the emu (only tried with Bomberman 64)

-Bomberman 64 2nd attack has 2D alignment issues

-Cruising World intro logo

-Dr Mario, don't know if it is related but lines are around character speech bubble on menu screen
(could be a trans or uprez issue i dunno)

-Fighter's Destiny 2, effects in background effects in stages are segrated by lines

-Fighter's Destiny, little man top left has extra lines when you win a round and it shows replay. Background stage image doesn't blend gracefully.

-Flying Dragon, horizontal lines across screen

-KI Gold, better but lines still in characters on select screen

-Mace TDA, Verticle line down middle of screen in menu

-Mischief Makers, black lines around things

-Tetris Sphere

-Majora's mask, line in title screen logo

@gonetz
Owner
gonetz commented Dec 15, 2015

Very likely this commit is responsible. 1580aa0

Yes, it is this commit. The game renders this scene in "unfair" order, and one rect (with the green lines on the last screenshot) overwrites the other one with the part of the window. My algorithm can't handle overlapping rects. I see no good solution atm.

@AmbientMalice
Contributor

The game renders this scene in "unfair" order, and one rect (with the green lines on the last screenshot) overwrites the other one with the part of the window. My algorithm can't handle overlapping rects. I see no good solution atm.

For what it's worth, it's a very small visual artifact on an otherwise MUCH better looking scene. For example, look at the right pole of the ladder. It's clipped before, but correctly rendered now. Such subtle errors are fixed all over the place, and accumulate to greatly improve the image quality.

@gonetz
Owner
gonetz commented Dec 20, 2015

Most of issues with this feature are fixed. However, it has performance issues in some games. Thus I decided to make another experimental version, which should work faster. I've made two optimizations:

  • currently each texrect is rendered right to aux buffer. It requires additional GL state changes. New version just stores rect info and renders all rects as a batch when whole image is loaded. Number of GL state changes reduced greatly.
  • The optimization above will not work if image consist of only one rect. For this case I"ve made another optimization: single rect images will be rendered with traditional method, that is without rendering them to aux buffer with native resolution. It should reduce overheads when lots of separate texrect are used on scene.

The new build is there:
https://drive.google.com/file/d/0B0YqMPjGo3B2UUI1QjJBZUdqUWs/view?usp=sharing

Unfortunately, optimization for single rects is incompatible with some games, e.g with Pokemon Stadium. I planned to make that optimization optional, but since the feature currently has no handles for users, I've just build a version with only the first optimization:
https://drive.google.com/file/d/0B0YqMPjGo3B2dmlJcldhVEk5WUE/view?usp=sharing

Build GLideN64_2DFix6-2.7z should work as good as previous GLideN64_2DFix5.7z, only bit faster.
GLideN64_2DFix6-1.7z should be almost as fast as regular (master) version.

Delayed rendering is quite hard to implement and new bugs are possible. If there will be too issues, I'll return to previous version.

@AmbientMalice
Contributor

Both optimised builds suffer from HUD flickering in Turok 3 when looking at flickering light sources. (New game, look right. Pause and unpause to bring up HUD.)

@gonetz
Owner
gonetz commented Dec 21, 2015

:(

@GyoMan
GyoMan commented Dec 25, 2015

Both optimized builds break Yoshi's Story...

@RibShark

@gonetz FYI: The latest compiled versions of this branch are being flagged as a virus by Google Drive, so it is currently impossible to download them.

@gonetz
Owner
gonetz commented Jan 16, 2016

Hmm, strange. Anyway, I need to solve reported issues or revert the optimizations.

@gonetz gonetz added the enhancement label Jan 30, 2016
@standard-two-simplex

I noticed flickering in 2D in many games in this branch. Some people have reported flickering before. Is it supposed to be fixed?

An easy way to reproduce it for me is to get into Excitebike 64s rider select menu, but I seen it in Smash Bros 64 too in-game (percentages and characters logo).

@standard-two-simplex

After testing a little bit I noticed the flicker only happens with the mupen64plus version. Can anyone else reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment