PrismaticFlower / shaderpatch

Improved shaders (and fun stuff for modders) for Star Wars Battlefront II (2005) - Incompatible with Classic Collection
MIT License
39 stars 2 forks source link

Better resolution support #123

Closed IdamkinI closed 3 years ago

IdamkinI commented 3 years ago

This is more of feature request, but I don't know a better place to put it.

I have a 4K display and I find the way resolution is handled a bit inconvenient. The 800x600 on such display is very tiny and 4K in-game has a bunch of UI bugs and unreadable text.

The way i workaround it right now - is changing Windows resolution to 1920x1080 before launching the game, which is inconvenient.

It would be great if we could specify the target resolution in the settings (or in the .yml) file. And the game would be displayed in that resolution stretched to the native Windows one. It would be also great if menu 800x600 resolution could be stretched to fill in native Windows one, preserving aspect ratio and putting blackbars on sides.

I read the FAQ and understand that it is not the focus right now. Especially since there is a workaround for it. Though I do believe as more and more people switch to 4K this will become more of a popular demand.

PrismaticFlower commented 3 years ago

Hi! As it would happen one of focuses of the next version (v1.4) is about exactly this. Below are the current change log notes relating to it.

  • Reworked some aspects of resolution, most specifically with how Treat 800x600 As Interface works. By default it'll now cause the game to be fullscreen but with the game thinking it is renderering at 800x600 when it is really rendering at native resolution.
  • Added Windowed Interface option to shader patch.yml. Enables the classic 1.3 interface handling behavior.
  • Added Game Perceived Resolution Override option to shader patch.yml. Enables overriding the resolution the game thinks it is rendering at.
  • Added a basic form of DPI awareness so that the game no longer stops rendering at native resolution on high DPIs when Shader Patch is enabled.
  • Added Display Scaling Aware option to shader patch.yml. Enables or disable marking the as DPI aware, disabled mirrors 1.3 behavior.
  • Added Display Scaling option to shader patch.yml. Enables or disables scaling the game's perceived resolution based on DPI, has the effect of scaling the UI and HUD without changing the resolution the game is actually being rendered at.
  • Added scalable fonts (and accompanying shaders to use them) for text rendering. Their use can be toggled on and off using Scalable Fonts in shader patch.yml, they default to on.

I believe the first thing listed should addresses the first key problem you list. And I believe some of the other changes will have addressed some of the others. The key thing that is missing is the ability to preserve the aspect ratio of the menu in my tests the stretching caused hasn't been noticeable enough for me to even think about implementing it if you try out the v1.4 preview and feel it'd be important to have let me know and it can be looked at further.

The latest preview release for v1.4 can be found over here https://github.com/SleepKiller/shaderpatch/releases/tag/v1.4.0-preview.5, if you're cool with a couple minor bugs (iirc they're all to do with the modder specific features) give it a go and feel free to let me know what you think.

As an aside the solution I chose for scalable fonts performs poorly in some specific circumstances (if the scaling factor is too low for instance) so I am considering replacing it with a new solution. The general feature and end results should be hear to stay however.

IdamkinI commented 3 years ago

Wow, should've definitely checked the releases section first

I've tried the prerelease and it works great! The UI scaling is the most unexpected and awesome feature. It is a shame that I (and I presume other people) wasn't able to find your mod when looking for UI improvements for 4K displays.

The stretching is indeed not really noticeable though I believe it can be more of an issue for an ultrawide monitor. So it is definitely not a big issue for me, but I would still appreciate if you could handle it some time in the future.

I'll stay on the prerelease version for now, many thanks to you for all the work!

IdamkinI commented 3 years ago

On the side note, I've tried to mess with this section:

Enable Game Perceived Resolution Override: yes
Game Perceived Resolution Override: [1920, 1080]

And it doesn't makes any difference. I assumed that if I put override as yes and change the perceived resolution it will render UI same way it rendered it in that resolution in vanilla game but it is not the case.

Maybe I've just misunderstand this option.

IdamkinI commented 3 years ago

I've messed with it a bit more and it works fine and as expected when Treat 800x600 As Interface: no is set. It seems that the rest of the game was using that special 800x600 logic as it is the only available resolution in options.

Previous versions of shader patch had 1024 x 768 as the second resolution which disabled 800x600 logic for the rest of the game.

PrismaticFlower commented 3 years ago

Ah yeah that. I changed the fake display mode passed to the game from 1024x768 to whatever your monitor resolution is.

  • Changed the last pseudo display mode presented to the game be the primary monitor's resolution instead of 1024x768. Changes no functionality but hopefully makes it clear to users that get stuck with game profiles with resolutions set to 800x600 that they should select the other option.

The game however has this display mode cache it creates on first encountering a GPU (this is the vidmode.ini file in data\_lvl_pc). When it falls out of date (because available display modes have changed) annoying things like this can happen, the solution is as simple as deleting the file and letting the game recreate it. But perhaps I should look into adding some logic to Shader Patch to make sure the file contains correct information as well.

The stretching is indeed not really noticeable though I believe it can be more of an issue for an ultrawide monitor.

That is a good point that I had not considered.

IdamkinI commented 3 years ago

Removing the vidmode.ini did the trick, thank you!

Feel free to close the issue, or restructure it in any way you find fit, as I'm really happy with the way prerelease works and the aspect ratio is really minor compared to the rest of this feature request.

PrismaticFlower commented 3 years ago

Glad to hear! Thank you for for giving the preview a go and leaving your feedback as well. I've opened a new issue for the aspect ratio preservation support #124, it certainly won't be at the top of my todo list for now but it'll be important not to forget it as well.