Page 1 of 1
Background image sizes
Posted: Tue Jan 20, 2015 5:13 am
by phkb
I'm making some new backgrounds for myself but I can seem to work out how to get a better resolution. Using BGS as an example, for most of it's backgrounds it uses an image size of 1024x513. This is quite small on my 1600x900 display. Oolite zooms this image, which results in a bit of fuzziness. But if I create a background at 1600x900, Oolite still zooms it.
Is there a special size I should be using? I've tried various sizes but they all get zoomed.
Re: Background image sizes
Posted: Tue Jan 20, 2015 8:03 am
by cim
The "main area" - the bit the default HUD and GUI screens fits in - has a size of 512x512 units. Images will be scaled so that the central 512x512 pixels of the image correspond to those units. This is necessary to ensure that one single background image works on any size of display window.
The problem, of course, is that on modern screens especially, 512 pixels is not a lot.
Increasing the size of the "main area" - say to 1024x1024 units - would of course mean that all existing backgrounds ended up half-size. I've been thinking on and off about solutions for this for quite a while now, without really getting anywhere, so suggestions for backward-compatible approaches to the problem are welcome.
Re: Background image sizes
Posted: Tue Jan 20, 2015 2:20 pm
by Norby
I vote for the 1024x1024 main area and I think there are 2 different solutions:
1. If the height of a background is less than a number (768?) then assume old picture and resize it, otherwise display without changes.
2. Define new keys in plist like equip_ship_hires for the new images which displayed as is and resize others in old keys if no large variant given.
No worry about large pixels produced by resize, it is easy to make proper large pictures using a converter with lanczos filter which make good work during enlarging, similar with antialiasing, so a new set of BGS pictures can be done instantly.
Re: Background image sizes
Posted: Tue Jan 20, 2015 6:53 pm
by cim
Norby wrote:I vote for the 1024x1024 main area and I think there are 2 different solutions:
1. If the height of a background is less than a number (768?) then assume old picture and resize it, otherwise display without changes.
2. Define new keys in plist like equip_ship_hires for the new images which displayed as is and resize others in old keys if no large variant given.
I'd rather not go for a solution which involves having two possible sizes of static main area, since monitors with 2048 height are already on sale. Support for more than two options in future without having to change the specification again I think is necessary.
Re: Background image sizes
Posted: Tue Apr 14, 2015 9:12 am
by Vincentz
What about using the same way images is shown in HUDs?
Even though format says 640x480, when adding hires, it automatically scales, even with widescreens, using Y res as base.
Re: Background image sizes
Posted: Fri May 15, 2015 6:41 pm
by Day
cim wrote:The "main area" - the bit the default HUD and GUI screens fits in - has a size of 512x512 units. Images will be scaled so that the central 512x512 pixels of the image correspond to those units. This is necessary to ensure that one single background image works on any size of display window.
The problem, of course, is that on modern screens especially, 512 pixels is not a lot.
Increasing the size of the "main area" - say to 1024x1024 units - would of course mean that all existing backgrounds ended up half-size. I've been thinking on and off about solutions for this for quite a while now, without really getting anywhere, so suggestions for backward-compatible approaches to the problem are welcome.
Pseudo-code:
Code: Select all
var picWidth = getWidth(pic); // we get the size of the pic
var picHeight = getHeight(pic);
var guiWidth = getOption(guiWidth); // we get the size of the gui, as wanted by the player in its game options
var guiHeight = getOption(guiHeight);
var factor = min(guiWidth / picWidth, guiHeight / picHeight); // we use min so the whole pic is used, even if the ratio width/height isn't the one of the screen
var newPic = resize(pic, factor) // pic * factor
What do you think of this?
It's backwards-compatible, lets the player choose his gui resolution so small configurations have no problem, and the pics may be resized when loaded, and when the player modifies its guiSize game options.
Re: Background image sizes
Posted: Fri May 15, 2015 8:27 pm
by Norby
I found a perfect solution
here. In short:
Make an image using FullHD resolution (1920x1080) at least. Maybe better to use UHD (3840x2160) when a 28" UHD monitor is $400 in the local store.
Then follow this example in screenbackgrounds.plist:
Code: Select all
equip_ship = { name: "hdpic.png"; height: 480; };
Another example in js (where must use comma and not semicolon):
Code: Select all
setScreenBackground({ name: "hdpic.png", height: 480 });
Do not give the height of the picture! Always use 480 and in this case the game will resize the image to match to the height of the current resolution, leaving out the sides if the display is narrower than widescreen (16:9). I tested successfully with a hd image in my 2048x1152 display. In windowed mode always filled the height regardless of I resized the window.
As
Tichy said there is almost nothing improvement if somebody remake the current background images in BGS due to the antialias-like resize routine do nice job in realtime when enlarge a small image. I tried to enlarge one with Lanczos filter which is the best imho and the result was only a bit sharper. But If somebody make new UHD images or mission screens then this solution is well usable for any image and display resolution.
phkb wrote:I'm making some new backgrounds
Let's see!
Re: Background image sizes
Posted: Fri May 15, 2015 8:55 pm
by Day
Good idea. I didn't think of javascript/browsers auto-resize.