gonetz / GLideN64

A new generation, open-source graphics plugin for N64 emulators.
Other
754 stars 174 forks source link

2D images misalignment #800

Open gonetz opened 8 years ago

gonetz commented 8 years ago

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

weinerschnitzel commented 8 years ago

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 commented 8 years ago

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

Shader cache is unrelated.

oddMLan commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

@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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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

gonetz commented 8 years ago

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

gonetz commented 8 years ago

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

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

RibShark commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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

oddMLan commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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. https://github.com/gonetz/GLideN64/commit/1580aa040d6e389a3dc33dc84ce190d59a9ce903

gliden64_wonder_project_j2_003

gonetz commented 8 years ago

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 commented 8 years ago

-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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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:

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 commented 8 years ago

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 commented 8 years ago

:(

GyoMan commented 8 years ago

Both optimized builds break Yoshi's Story...

RibShark commented 8 years ago

@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 commented 8 years ago

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

ghost commented 8 years ago

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).

ghost commented 8 years ago

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

theboy181 commented 5 years ago

Loads of these images are fixed with the latest s2dex commits. :)

theboy181 commented 5 years ago

Claire's Picture in resident evil looks ok in GLideN64 3.0 but not current 2dfix ???

Jj0YzL5nvJ commented 3 years ago

Top Gear Overdrive can be "fixed" with dithering. But is very tricky. #2451

https://imgur.com/5RaYWvg https://imgur.com/ljguGDO https://imgur.com/NS09McZ https://imgur.com/4gT8WdF

In low or native resolution, it needs:

EnableNativeResTexrects = 1
EnableCopyColorToRDRAM = 1
EnableCopyColorFromRDRAM = True
EnableDitheringPattern = True
RDRAMImageDitheringMode = 1

In high-resolution or cropped, it needs:

EnableNativeResTexrects = 1
EnableCopyColorToRDRAM = 1
EnableCopyColorFromRDRAM = True
EnableDitheringPattern = True
EnableHiresNoiseDithering = True (Can help... can break too...)
RDRAMImageDitheringMode = 1
UseNativeResolutionFactor = 4 (or more...)