libretro / FBNeo

FBNeo - We are Team FBNeo.
https://neo-source.com
Other
229 stars 136 forks source link

Flipped shader textures in vertical games #1044

Closed Starman99x closed 1 year ago

Starman99x commented 1 year ago

When loading some vertical aspect ratio games with FBNeo core, the texture image.png (bezel & overlay) of the applied shader might get flipped upside down, this problem does not occur with horizontal aspect games, nor does it occur with MAME core.

Here are some games affected by this bug:

And these are some games that are NOT affected by this bug:

My core settings are mostly default, my OS is Windows 7. And here's a shader preset for testing, unpack the .slangp file to RetroArch/shaders, and move the .png file to: shaders_slang/bezel/koko-aio/textures.

Screenshot of a wrong flipped example:

Screenshot_6

Screenshot of a correct example: Screenshot_7

barbudreadmon commented 1 year ago

the texture image of the applied shader might get flipped upside down, this problem does not occur with horizontal aspect games, nor does it occur with MAME core

Duplicate of https://github.com/libretro/FBNeo/issues/1036. MAME is the one being broken as explained in https://github.com/libretro/mame/issues/261 If you have doubts about the fact vertical games run on physically rotated monitor, you can look at https://youtu.be/YAxjdD0fnfk?t=23 to confirm that scanlines are vertical on vertical games. Closing.

Starman99x commented 1 year ago

I'm not talking about scanlines I'm talking about the overlay.png used by the shader, notice in the screenshot how the flames are upside down in Donkey Kong:

Picsart_23-03-25_13-23-55-097

Please read my issue again I've included a lot of details. This problem doesn't occur with every vertical game, I included a list of some affected vertical games, and other unaffected VERTICAL games.

And this problem doesn't occur with normal overlays, that are applied via the RetroArch Overlays feature, but it happens with Shaders that use overlays as one of it's textures.

barbudreadmon commented 1 year ago

Oh, i got misled because you said mame has the correct behavior, which is not the case as explained in https://github.com/libretro/mame/issues/261, sorry about that.

The answer remains the same though, FBNeo is sending the rotation through the libretro api, so that the frontend can decide how to handle that information. That rotation can be 0/90/180/270 depending on the running game, meaning it can be rotated vertically in both directions, which i suppose explain why those overlay textures can go both direction.

FBNeo is behaving as it should, the problem lies in how retroarch and that shader are handling this.

Starman99x commented 1 year ago

But why this doesn't happen with all vertical games? For example both Donkey Kong and 1943 are vertical games, yet Donkey Kong will flip the image, while 1943 will keep it as it should.

barbudreadmon commented 1 year ago

For example both Donkey Kong and 1943 are vertical games, yet Donkey Kong will flip the image, while 1943 will keep it as it should.

As i explained, some vertical games are rotated 90°, and some are rotated 270°, which probably explains that difference.

Additionally, the issue can probably be solved by having retroarch send the rotation index to the shader, so that the shader can account for whether the rotation is 90° or 270°. It's possible in glsl (i sent a PR for this 2 years ago : https://github.com/libretro/RetroArch/pull/12827), but someone still needs to port it to slang

Starman99x commented 1 year ago

Ok thank you, now I get it. If you could reach out to RA devs about it, would be great, since you know better than me about what should be done.

barbudreadmon commented 1 year ago

I was briefly in contact with @HyperspaceMadness when i wrote https://github.com/libretro/RetroArch/pull/12827. I think he is the author of the "megabezel pack" if that's what you are using. I remember he mentioned being interested in porting https://github.com/libretro/RetroArch/pull/12827 to slang but i'm not sure it's still on his roadmap.

I'll re-open this issue for now, even if it's not exactly a FBNeo issue.

MistyDreams commented 1 year ago

The mirrored games in that other mame issue absolutely need dealt wit, even fbneo shakes when using shaders on mirrored games like kick and dotron still have issues now. Aside form manually turning interlace off nothing can be done for any games with a higher resolution that causes this. Some work does need done manually unfortunately this cant be avoided for edge cases.

edit: Ive fixed mame2003-plus to work the same for the bezel on all vertical games with the libretro limitation we have. So its 100% doable on the core side to give ra the output it needs. I can send you a patch for plus if its needed. The ideal fix would be ra supporting all rotations and shader rotations follow that follow them. You have to work with what you have and its certainly attainable only took 4 lines of code in plus.

barbudreadmon commented 1 year ago

I'd rather have the feature implemented than using some weird workaround core side.

https://github.com/libretro/RetroArch/pull/15136 will allow rotation awareness in any shader. As for whether this is merged and shaders properly use it, this is not my call.

barbudreadmon commented 1 year ago

Feature merged into RA, i'll close.