agg23 / openfpga-arduboy

Arduboy for Analogue Pocket
GNU General Public License v3.0
57 stars 2 forks source link

Video outputs at 6X scale of actual resolution, causing issues with display filters #13

Open HeyItsLollie opened 9 months ago

HeyItsLollie commented 9 months ago

This core appears to internally upscale the image by 6×, which can unfortunately mess up display filters under the wrong conditions.

(This game is "Catacombs of the Damned", aka "Arduboy3D", from the ArduboyCollection repo.)

Arduboy-1

"Grayscale LCD" in particular breaks when Integer+ scaling is toggled. While there isn't any functional reason to use Integer+ (it crops a large amount of the screen), something here appears to be too much for the display filter to handle. Arduboy-2

Close-up crop, six lines per pixel Arduboy-3

And a direct screenshot from the Pocket, no upscaling applied. This core includes a lot of black space around the 128×64px screen - though admittedly, I actually prefer how this looks when using display filters, compared to the flat black bezel that other cores produce. 4f1a02dd-907f-4bd0-8110-4a99232e994b

agg23 commented 9 months ago

The scaling is there to work around Pocket scaler bugs and to force an integer scale, which would not occur with the default Pocket scaling. This is where the black borders come from.

I can't do anything about Integer+ scaling. Based on your screenshot, it seems like Analogue's video pipeline is dying, which is their bug, unfortunate as it may be.

As for the Trinitron showing 6 lines per pixel, I suppose I could introduce a built in Pocket scaler mode, but it seems unnecessary for me (why do you want scanlines for a LCD?). I guess the GB filters would be nice though.

HeyItsLollie commented 9 months ago

The scaling is there to work around Pocket scaler bugs and to force an integer scale, which would not occur with the default Pocket scaling. This is where the black borders come from.

Would it be enough to place the 128×64 output inside a 160x144 container? That ought to force 10× integer scale.

As for the Trinitron showing 6 lines per pixel, I suppose I could introduce a built in Pocket scaler mode, but it seems unnecessary for me (why do you want scanlines for a LCD?). I guess the GB filters would be nice though.

Yeah, personally I don't care for the Trinitron filter in this case - I was actually more interested in the "Backlit Color LCD" filter, I figured it'd be a close-enough approximation of the Arduboy's OLED display. ("Pinball Neon Matrix" would also probably work pretty great for this core.) Unfortunately right now, the internal scaling causes all the filters to look more like broken palettes.

agg23 commented 9 months ago

That's how I would have thought it was scaled (though maybe to a higher 320x288 or something resolution), but that doesn't appear to be the case. The code is hard to read, and it was my first port, so I really didn't know what I was doing...

HeyItsLollie commented 9 months ago

Looking closer, I've realized that your current setup does mean the video can take up way more of the screen with perfect scaling, as long as all you want is raw pixels. Maybe a built-in Pocket scaler option would be the way to go, so you can have the original behavior to fill the screen as much as possible, plus 1× and 2× scaling options that are filter-safe. edit: Had a later realization, this shouldn't even be necessary anymore as of Pocket's OS 2.0, see below.

HeyItsLollie commented 9 months ago

The scaling is there to work around Pocket scaler bugs and to force an integer scale, which would not occur with the default Pocket scaling.

Sorry to come back to this, but it just occurred to me: As of OS 2.0, this should no longer be an issue. Since Display Mode options are available for all OpenFPGA cores, this also includes the "Normal" unfiltered display mode. "Normal" does default to the "Fit" Size option, but you can also use "Integer" and "Integer+" options. This means that you don't have to manually force Integer scaling.

DrAvedi commented 8 months ago

Would love to see support for lcd filters on this core. Thanks for all that you do, Adam!