Background image sizes

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4829
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Background image sizes

Post 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.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Background image sizes

Post 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.
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Background image sizes

Post 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.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Background image sizes

Post 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.
User avatar
Vincentz
Deadly
Deadly
Posts: 174
Joined: Sun Mar 22, 2015 11:26 pm

Re: Background image sizes

Post 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.
"There is a single light of science, and to brighten it anywhere is to brighten it everywhere." - Isaac Asimov
User avatar
Day
---- E L I T E ----
---- E L I T E ----
Posts: 545
Joined: Tue Mar 03, 2015 11:35 am
Location: Paris

Re: Background image sizes

Post 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.
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Background image sizes

Post 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! :)
User avatar
Day
---- E L I T E ----
---- E L I T E ----
Posts: 545
Joined: Tue Mar 03, 2015 11:35 am
Location: Paris

Re: Background image sizes

Post by Day »

Good idea. I didn't think of javascript/browsers auto-resize.
Post Reply