6743fe7c582f8

Page: « 1 [2]
6743fe7c59449
4 Guests are here.
 

Topic: Question on HUD scaling.
Page: « 1 [2]
Read 10544 times  

6743fe7c59afaSimplex

6743fe7c59b63
When your graphics card is hooked to widescreen display  using dvi cable then you can enable (in graphic card control panel)  scaling for 4:3 resolution to preserve aspect ratio (black bars on sides).  Otherwise,  the picture is stretched on the whole screen becoming distorted.
Gpu scaling option is not available when vga cable is used.
« Last Edit: 03. March 2013, 22:40:42 by Simplex »
6743fe7c59c88
I've tried both variations on the option, and only specifying a resolution works. Entering a number doesn't appear to scale the HUD at all. I'm running at 1440x900... And I just realized that it doesn't do anything because 480 only goes into 900 once. Is that why it doesn't work or is there some other issue I might be having?

6743fe7c59e24voodoo47

6743fe7c59e82
yeah, to use d3d_disp_scaled_2d_overlay 2, your vertical resolution must be at least 960. you are at 900, so all you can do is specify it manually. it seem like it just works this way.

6743fe7c5a35abluemess

6743fe7c5a3ab
@Simplex: You are going to far. From all the issues that are discussed here, aspect ratio distortion in widescreen is definitely not one of them. Engine will always show UI properly in every aspect ratio, by moving UI elements to screen edges, not by stretching it out of proportion. This two screens explain it:

4:3:
Image: http://i.imgur.com/c5UYlHC.png
16:9:
Image: http://i.imgur.com/cigtO0q.png

It seems to me that people here are entering some values at random without the idea how it works. This UI scaling is pretty confusing at first. It took a moment for me before I wrapped my head around it. I'll try to explain how it works:

d3d_disp_scaled_2d_overlay with two parameters:

For example: game is running at 1024x768 resolution and d3d_disp_scaled_2d_overlay 768 576 is set. This is what happens:

Step 1 – the game interface was originally designed to fit 640x480 resolution. This is the base from which scaling begins. (Image 1)

Step 2 – engine takes a virtual screen with 768x576 resolution. Then it's placing the UI elements by moving them to screen edges. No scaling is applied yet. UI is still in its original size, but moved around a little bit. (Image 2)

Step 3 – The resulting image from step 2 is now stretch to actual screen resolution, which is 1024x768. This is where scaling happens and it's what we finally see on the screen. (Image 3)

It comes down to that UI will be 768 (screen height) / 576 (virtual screen height) = 1.33 times upscaled. If we would like to have 1.5 times upscaled UI, we would have to set d3d_disp_scaled_2d_overlay to (1024 / 1.5) (768 / 1.5) = 683 512.

d3d_disp_scaled_2d_overlay with one parameter:

For example: game is running at 1920x1440 resolution and d3d_disp_scaled_2d_overlay 2 is set. This means that engine will try to fit two times upscaled UI in the screen. It is essentially equivalent to setting d3d_disp_scaled_2d_overlay to (1920 / 2) (1440 / 2) = 960 720. For d3d_disp_scaled_2d_overlay 3 engine will try to fit UI 3 times upscaled and its equivalent to (1920 / 3) (1440 / 3) = 640 480.

If we set it to 4, engine will not be able to fit UI 4 times because (1920 / 4) (1440 / 4) = 480 360, so the “virtual screen” would have to be smaller that original 640x480 UI size, and it wouldn’t fit in. In this case, engine will choose maximum value that fits, which is 3. Same would happen if we set it to 64. 1280x960 is the lowest resolution that can fit UI two times: (1280 / 2) (960 / 2) = 640 480, so it's the lowest resolution for d3d_disp_scaled_2d_overlay 2 (or 64) to have any effect.
Acknowledged by: Briareos H

6743fe7c5a8adSimplex

6743fe7c5a903
That's a really great and detailed analysis. Thanks for that.

@Simplex: You are going to far.
In what sense? I  do not understand what you meant.

I am mostly concerned about the "pixel perfectness" of the scaling, i.e. to avoid uneven scaling. The only way to do it is to scale by even multipliers, i.e. 2 or 3, etc. So from 640x480 the only pixel perfect enlargements would be 1280x960, 1920x1440, 2440x1920, etc. This means that for my 1920x1080 resolution the only acceptable option is hud scaled to 1280x960, if I am not mistaken? (I recall that 960x540 was also suggested, which is exactly half of 1920x1080).

So thanks for your post, because it confirmed my assumptions.

6743fe7c5b29ebluemess

6743fe7c5b2f3
That's a really great and detailed analysis. Thanks for that.

@Simplex: You are going to far.
In what sense? I  do not understand what you meant.
Perhaps I expressed myself a bit unfortunately. What I meant was that any scaling/blurring problems are not related to widescreen/aspect ratio. Engine do proper scaling of UI elements without stretching regardless of aspect ratio. I think this is a wrong place to look for issues, in this case anyway.

I am mostly concerned about the "pixel perfectness" of the scaling, i.e. to avoid uneven scaling. The only way to do it is to scale by even multipliers, i.e. 2 or 3, etc. So from 640x480 the only pixel perfect enlargements would be 1280x960, 1920x1440, 2440x1920, etc. This means that for my 1920x1080 resolution the only acceptable option is hud scaled to 1280x960, if I am not mistaken? (I recall that 960x540 was also suggested, which is exactly half of 1920x1080).
Precisely. The only pixel perfect scaled UI that “fit in” 1920x1080 is x2. It can be accomplished by setting d3d_disp_scaled_2d_overlay to 2 or 960 540 (16:9) or 720 540 (4:3) – all three ways will have the same effect: UI will be scaled from 640x480 to 1280x960, and its elements will be aligned to screen edges to fit nicely in 1920x1080.

So thanks for your post, because it confirmed my assumptions.
Thanks and you're welcome.

6743fe7c5b438Simplex

6743fe7c5b485
I made some test, mainly testing the bilinear filtering (d3d_disp_force_filter_scale2d option) and while graphical elements look ok (if blurry), the scaled font looks not so good, I wonder if it is possible to replace the default font with a bigger one, that would look better in a higher resolution?
Bilinear filtering is the simplest and least effective scaling algorithm, it would be really cool if some more advanced algorithms could be used, akin to ones used in SCUMMVM (SAI, SuperEagle, etc). But is not a big issue, just a nice to have feature.

Anyways, non-filtered 960 540 is fine be me, it is slightly smaller than the default 640x480, but perfectly legible.

6743fe7c5b5b7bluemess

6743fe7c5b603
I would disagree that bilinear filtering is least effective algorithm. E.g. for mipmap generation many have tried different algorithms to have better result. When more complex algorithms are generating better results for some cases, in other they're not so good and produce artifacts and visual errors. In the end it always came down to use bilinear, as it's best in general and produce relatively good results for most cases. Scaling by definition involves some quality/visual loss, and applying complex math to mess around more in the process doesn't automagically give better results. I think bilinear filtering has by far been proven to be pretty good in its simplicity.

There's only so much we can do to make low res bitmap fonts look good after scaling. Actually scaling of any bitmap font will make them blurry/less sharp. In order to look good bitmap font would have to be generated in desired resolution from vector font with antialiasing and whatnot, and displayed on the screen in 1:1 scale.

6743fe7c5b6ddSimplex

6743fe7c5b835
I agree that bilinear filtering offers acceptable loss at very low performance penalty. Howeve, I made some comparisons - I upscaled part of the screen containing description of hazard suit  using old Paint Shop Pro 7 ("smart resize" option) and the quality was much better than the bilinear filtering applied in the game (which is very blurry and produces "thin" text) - at least for text in descriptions of objects. I will provide a comparison when I get home.

6743fe7c5b968ZylonBane

6743fe7c5b9b7
All "smart resize" does in PSP is automatically select between bilinear or bicubic interpolation, depending on whether you're scaling up or down.

6743fe7c5bc7fvoodoo47

6743fe7c5bcd5
number two (first row in the middle). that one is like oh god my eyes are bleeding.

6743fe7c5c10cSimplex

6743fe7c5c15c
So now you understand why I was complaining about bilinear filtering used in System Shock 2 HUD scaling :)
Because - surprise, surprise! - number two is taken straight from the game :(
I hope blueness can comment on that, considering his previous defense of bilinear filtering. Because either scaling in SS2 is not done using bilinerar filtering, or bilinear filtering is not the greatest scaling alogorithm in the world.
To put it bluntly - piss-poor quality of HUD filitering/scaling makes it a useless feature (well, maybe if you are scaling by an uneven number then it may look better then nearest neighbour, but in case of 2x or 3x scaling it looks bad compared to nearest neighbour which simply enlarges the pixels).

My settings: "d3d_disp_force_filter_scale2d" is enabled, "d3d_disp_scaled_2d_overlay" is set to "960 540" and screen resolution is 1920x1080.

Also, when you look at the name of the image you can see what filtering algorithm was applied. I suppose that using a dedicated algorithm designed for scaling low resolution pixellates images (such as Super SAI, Super Eagle, etc) the result could be even better.

I was too lazy to test how the inventory or minimap looks after applying various scaling filters, If someone is curious, you can download a free image viewer xnView and see for yourself.

I also tested scaling using "bspline" but it produced a very blurry result (but still better than the one in SS2, imo) - I did not put it in the comparison because I was afraid that someone might point it out as the worst one and then my whole "experiment" will be ruined ;) Here it is:

Image: http://www.abload.de/img/ss2_bsplinerzrve.png

« Last Edit: 12. March 2013, 19:52:06 by Simplex »

6743fe7c5c4ebZylonBane

6743fe7c5c53e
So now you understand why I was complaining about bilinear filtering used in System Shock 2 HUD scaling :)
Apparently you never noticed that scaled text only looks like that in the left info pane, and only in views that also show a 3D object. So clearly there's some sort of compositing problem. All other scaled text looks fine. Calling the HUD scaling "useless" is arm-flailing hyperbole.

6743fe7c5c617Simplex

6743fe7c5c671
Yeah, you're absolutely right - I did not notice it because that was the first thing I checked when I used scaling was the text in the window (because I wanted to be able to read comfortably). Yeah, I exaggerated when I called scaling useless, but as long as this "compositing problem" remains, it is useless for me because I often read the text in that window for entertainment value.

6743fe7c5c7e8bluemess

6743fe7c5c832
I stand corrected, bilinear would not be the best in this case. However, the first image (top-left) is a result of scaling by nearest neighbor or bilinear filtering. That's because scaling x2 is one unfortunate case in which both of this algorithms will give exactly the same result. About second image, which you say it's from the game - I don't know what the game has done to that poor image, but it's definitely not bilinear filtering. If the game claims otherwise it's lying ;) Anyway filtering algorithms are not like exact science, result may vary between applications depending on implementation (even if perhaps they shouldn't).

What bilinear is doing here is that it takes already pixelated image and makes it bigger, but still pixelated. This way it preserves its original nature, even if it's not best looking. Other algorithms makes it more or less blurry, which one of them looks good is arguable. Probably one of the pixel art scaling algorithms that you mentioned would give better results.

I don't think that trying to implement some fancy scaling algorithms in the game would be a good approach, when effects might be not so obviously good. Better solution would be to add option to swap this hard coded 640x480 UI for something in bigger resolution. I imagine that any of this would not be trivial.

6743fe7c5c9bbSimplex

6743fe7c5ca09
Yeah, that's the best option, but apart from the technical challenge, someone would also have to redraw this UI in the higher resolution. And you are right that bilinear filtering is simply enlarging the pixel (I called that nearest neighbour in my post), maybe I understood something in a wrong way and thought that this filtering (scaling) done by the game is bilinear.

EDIT: nope, I was mislead by the comments in cam_ext.cfg file:
; force scaled menu and 2D overlay graphics to always use bilinear filtering, even when scaled an even multiple
; (smoothness/fuzziness vs pixel perfectness)
d3d_disp_force_filter_scale2d

Info from new_config_vars:
d3d_disp_force_filter_scale2d
    only works in combination with "use_d3d_display", forces scaled 2D (menus and overlay) to always use bilinear
    filtering. Normally no filtering is applied when the scale is detected to be an even pixel multiple of the
    original size, in order to get sharper pixel perfect results.
« Last Edit: 13. March 2013, 02:43:36 by Simplex »
4 Guests are here.
Fucking doughnut! Mock me? You fried cyclops!
Page: « 1 [2]
Contact SMF 2.0.19 | SMF © 2016, Simple Machines | Terms and Policies
FEEP
6743fe7c5fb7e