Elvas Tower: Letterboxing for 2D cabs - Elvas Tower

Jump to content

  • 4 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Letterboxing for 2D cabs Proposal and patch Rate Topic: -----

#1 User is offline   YoRyan 

  • Conductor
  • Group: Status: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 15 April 2020 - 10:04 AM

Hi folks,

One of the biggest headaches regarding legacy MSTS content is that the 2D cabs are designed with a 4:3 aspect ratio, whereas contemporary systems invariably have widescreen monitors. Open Rails handles the aspect ratio mismatch by allowing you to scroll the cab viewport up and down with the arrow keys. But this doesn't work very well whenever the cab has a small window to begin with, or when the display uses an ultra-wide (21:9) aspect ratio. In either case, you're forced to choose between keeping the controls visible or maintaining a forward view out of the window.

So, what if you wish to keep the entirety of the cab visible? Currently, this isn't possible because Open Rails always uses the current resolution of the desktop; it is not possible to select a custom resolution with, say, a 4:3 aspect ratio to match the cab. There are workarounds, like using windowed mode or changing your desktop resolution before you start the game, but these are quite inconvenient, which I think is why users have been asking for the ability to set a custom resolution in fullscreen mode.

I propose another solution: letterboxing the 2D cabs. And I have written some code to make it work.

My 1920x1080 monitor, with the feature turned off:

Attached Image: 2dlb_no.jpg

And turned on:

Attached Image: 2dlb_yes.jpg

With my patch, the simulator removes the letterboxing when you switch to a 3D view, whether it be an external view or a 3D cab.

I have submitted a pull request to GitHub. However, it was brought to my attention that significant new features require discussion, approval from the developers, and a Trello card. So, with some apologies, I thought I'd get that discussion rolling. ^_^

#2 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,000
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 15 April 2020 - 11:58 PM

Hi Yo,
first of all, thank you for your work on this!
Some points:
1) I'd suggest that the selection between letterboxing and usual view, instead of being made through a menu option, be done with a runtime toggle command. Ctrl-1 could be a possible candidate key for that.
2) Thinking a bit more about your PR, the two features you propose, that is letterboxing and improved windows shading, seem to be quite unrelated. So maybe having two separate PRs would be a cleaner solution. And I'd be happy to get separate .diff files for them.
3) Is your PR Monogame ready?

P.S.: I can reply to my first point: yes, it's Monogame ready, see picture
Attached Image: Letterbox.jpg
However I have a question: as can be seen, the Track Monitor window is constrained within the letterboxed window, consuming precious space while there is black space at the right and at the left. Would it be possible (probably much has to be changed) to improve the code, so that the Track Monitor Window can be moved into the side black stripes?

#3 User is offline   YoRyan 

  • Conductor
  • Group: Status: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 16 April 2020 - 10:34 AM

View PostCsantucci, on 15 April 2020 - 11:58 PM, said:

1) I'd suggest that the selection between letterboxing and usual view, instead of being made through a menu option, be done with a runtime toggle command. Ctrl-1 could be a possible candidate key for that.


I like this idea and will try implementing it!

View PostCsantucci, on 15 April 2020 - 11:58 PM, said:

2) Thinking a bit more about your PR, the two features you propose, that is letterboxing and improved windows shading, seem to be quite unrelated. So maybe having two separate PRs would be a cleaner solution. And I'd be happy to get separate .diff files for them.


Actually, they are not independent. The window shading patch is required by the letterboxing patch because of the use of ResolveBackBuffer in the current code. To be honest, I was not sure about the best way to communicate this, hence I put them in the same PR.

View PostCsantucci, on 15 April 2020 - 11:58 PM, said:

3) Is your PR Monogame ready?


Define "Monogame ready." From your testing, I gather it applies cleanly against the unstable branch. It should take me a day or two to rebase against your NewYear-MG-NoWD branch.

View PostCsantucci, on 15 April 2020 - 11:58 PM, said:

However I have a question: as can be seen, the Track Monitor window is constrained within the letterboxed window, consuming precious space while there is black space at the right and at the left. Would it be possible (probably much has to be changed) to improve the code, so that the Track Monitor Window can be moved into the side black stripes?


It would be nontrivial, yes; the way the letterboxing code works is that it imposes a viewport on the entire simulator, including the windows. It might be possible to set a different viewport for the window drawing so that windows can occupy the black bars. This might even remove the "dependency" on the window shading rework.

#4 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,000
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 16 April 2020 - 11:14 AM

Hi YoRyan,
good that you will provide a solution where the selection of the letterbox display is made through a key! I'll wait for this before releasing next OR NewYear MG revision.
You don't need to rebase what you have done for OR NewYear MG. The picture I have published is already taken starting from the OR NewYear MG code, after having applied your patch and adjusted some merge issues.

#5 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,000
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 17 April 2020 - 08:46 AM

Revision 58 of OR NewYear MG is out, which has already the letterboxing option, although selectable by menu option.

#6 User is offline   YoRyan 

  • Conductor
  • Group: Status: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 17 April 2020 - 08:39 PM

I have submitted a Trello card for the window shading change. I believe this is the right place? This patch isn't a "bug," but it's also not exactly a "feature request."

#7 User is offline   YoRyan 

  • Conductor
  • Group: Status: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 18 April 2020 - 12:32 AM

Okay, I have replaced the menu option with an in-game keyboard shortcut: Control+1, as was suggested. I will look into restructuring the viewport code. I've just discovered that for some reason, it cuts off the content in the F1 dialog.

Csantucci, I have submitted a pull request against your branch for this change.

#8 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,000
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 18 April 2020 - 01:49 AM

Thank you YoRyan,
I have merged your PR, so that this will appear in nex OR NEwYear MG revision.

#9 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,000
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 20 April 2020 - 12:20 PM

Letterboxing activated with Ctrl-1 is now available in OR NewYear MG rev. 59.

#10 User is offline   YoRyan 

  • Conductor
  • Group: Status: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 21 April 2020 - 07:40 PM

Reimplemented the letterboxing code, this time by drawing rectangles over the camera instead of changing the viewport. I probably should have thought of that earlier. :sweatingbullets:

Windows can now be positioned over the letterboxed areas:

Attached Image: 2dcab_windows.jpg

And the dependency on the window drawing revamp has been dropped, so the new patch is drastically simpler. (Csantucci, you have another pull request.)

  • 4 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users