How to get perfect video scaling and list of recommended resolutions

Home Forums RetroPie Project Video Output on RetroPie How to get perfect video scaling and list of recommended resolutions

This topic contains 29 replies, has 8 voices, and was last updated by Profile photo of dragonjab dragonjab 1 year, 10 months ago.

Viewing 30 posts - 1 through 30 (of 30 total)
  • Author
    Posts
  • #97150
    Profile photo of patrickm
    patrickm
    Participant

    How to get perfect video scaling

    On a fixed-pixel display, you have to stretch the native resolution of a game by a whole integer amount, otherwise you will get ugly scaling artifacts; some pixels will be larger or of a different shape than others. Scaling artifacts are particularly noticeable when a game is scrolling, and they ruin the look of scanlines. To eliminate scaling artifacts, do the following:

    1. Hold “x” or “m” when launching a game to bring up the launch menu. By default, “video mode” should be blank. If it is not blank, select “remove video mode choice.” This will tell Retroarch to automatically detect the native resolution of your display.
    2. Now scroll to “retroarch render resolution.” Set this to “use video output” if using a raspberry pi model 2. Otherwise leave as is (640×480).
    3. Launch game.
    4. go to RGUI -> settings -> video settings -> integer scale ON
    5. RGUI -> options -> video options -> set custom ratio
    6. Set to whatever looks best. You can’t get to a perfect 4:3 aspect ratio but you can get close if you use the right scaling ratio. For NES for example, 6×5 scaling gets you close to a 4:3 aspect ratio with the top and bottom cropped off (see below)

    A note on 5x scale: If you use 5x scale and wish to use a scanline overlay, you need to use one designed for 5x, which I’ve provided here. It is desirable to set the Y axis to 5x scale for many systems, cropping off the top and bottom of the picture. On a CRT, the “safe area” was 90% of the picture. The safe area was the zone in which important graphics were displayed. The rest was occupied by overscan, which wasn’t meant to be displayed and which was cropped off by CRTs. With 5x scale on the Y axis, or 1200 pixels, you are cropping off 120 pixels on a 1080 display. This is 24 pixels on a 240p console, or 10%, equivalent to the entire overscan area.

    Important Note: depending on the core, crop overscan may need to be turned either ON or OFF. Crop overscan can cause problems with scaling if not set right.

    Note: these resolutions are for a 1080p display.

    NES:
    1024×960
    1280×960
    1280×1200
    1536×1200

    Genesis:
    960×896
    1280×896
    1280×1120
    1600×1120

    SNES:
    1024×896
    1280×896
    1280×1120
    1536×1120

    Doom:
    1280×1000

    Quake:
    1280×1000

    N64:
    1280×960
    1280×1200
    1600×1200

    PSX:
    1280×960
    1280×1200
    1600×1200
    *note: it doesn’t seem possible to get perfect integer scaling with psx at the moment. The sharp-bilinear shader with one of the above resolutions is your best bet for minimizing artifacts, but it will cause a dip in performance.

    PC Engine:
    960×696
    1280×1160
    1600×1160

    More systems will be added as they are tested.

    #97161
    Profile photo of InsecureSpike
    InsecureSpike
    Participant

    awesome work mate

    #97165
    Profile photo of dishins
    dishins
    Participant

    do you know how i set these options directly in the *.cfg files?

    #97167
    Profile photo of patrickm
    patrickm
    Participant

    do you know how i set these options directly in the *.cfg files?

    Look for “integer scale” should be on
    “Crop overscan” should be off
    “Custom viewport” x and y
    “Video fullscreen” x and y

    #97171
    Profile photo of dishins
    dishins
    Participant

    i did not found “Custom Viewport” in retroarch.cfg, any help?

    #97176
    Profile photo of patrickm
    patrickm
    Participant

    i did not found “Custom Viewport” in retroarch.cfg, any help?

    custom_viewport_width

    custom_viewport_height

    #97840
    Profile photo of Floob
    Floob
    Member

    Lots of good (and heated!) discussion on custom ratios here:
    http://libretro.com/forums/showthread.php?t=1471

    As they mention, sticking to an arbitrary 4:3 for the sake of it isnt really that relevant, with the goal really being to get close to each systems native output resolution.

    For reference the “aspect_ratio_index” settings are:

    0: 4:3
    1: 16:9
    2: 16:10
    3: 16:15
    4: 1:1
    5: 2:1
    6: 3:2
    7: 3:4
    8: 4:1
    9: 4:4
    10: 5:4
    11: 6:5
    12: 7:9
    13: 8:3
    14: 8:7
    15: 19:12
    16: 19:14
    17: 30:17
    18: 32:9
    19: config (video_aspect_ratio setting)
    20: 10:9 (1:1 PAR)
    21: Core Provided
    22: Custom

    As an example, my Game Gear settings are (on a 720p TV):

    aspect_ratio_index = "22"
    custom_viewport_width = "432"
    custom_viewport_height = "389"
    custom_viewport_x = "423"
    custom_viewport_y = "165"

    As you can see the viewport width/height are a multiple of the native 160×144 to keep the ratio the same.

    Although the more I read the thread below, the more I think I should check out the affect of using Core Provided instead.
    The OP there has said:

    If you want the native core AR then use “core provided” whether they got it wrong or right.
    If you want the nostalgia look whether it’s right or wrong, don’t crop overscan and use 4:3 (display) aspect ratio.
    If you want accurate ratio, check my thread here.
    http://libretro.com/forums/showthread.php?t=1471

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #97855
    Profile photo of patrickm
    patrickm
    Participant

    As they mention, sticking to an arbitrary 4:3 for the sake of it isnt really that relevant, with the goal really being to get close to each systems native output resolution.

    I read over that thread and actually posted in it as Nesguy.

    That thread has very different goals than this thread. They want to display games in their native resolution, which is incorrect IMO. It isn’t how the games were displayed nor how they were meant to be displayed.

    This thread is about getting perfect video scaling, which is related to but a separate issue from aspect ratio.

    You can accomplish what that other thread is describing by just selected the 1:1 PAR option under video aspect ratio. This will result in perfect scaling, but will also make the picture appear in a small pillarboxed square, wasting a lot of screen space and making the graphics appear squished.

    To keep the perfect scaling with a more authentic and aesthetic aspect ratio, follow the instructions in this thread.

    I provided some example shots below of NES and SNES at 6×5 integer scale. As you can see, what gets cropped off corresponds to the overscan area. On SNES it’s very minimal. If you zoom in you will see that each pixel is the exact same shape and size. This is identical to the output using an XRGB Mini with the 5x profile.

    (Be sure to click enlarge for proper viewing)
    http://s1309.photobucket.com/user/Patrick_McCleery/media/image.jpg2_zpsuohwoiid.jpg.html

    http://s1309.photobucket.com/user/Patrick_McCleery/media/image.jpg1_zpssotkgues.jpg.html

    #99052
    Profile photo of zonitz
    zonitz
    Participant

    How to get perfect video scaling

    On a fixed-pixel display, you have to stretch the native resolution of a game by a whole integer amount, otherwise you will get ugly scaling artifacts; some pixels will be larger or of a different shape than others. Scaling artifacts are particularly noticeable when a game is scrolling, and they ruin the look of scanlines. To eliminate scaling artifacts, do the following:

    1. Hold “x” or “m” when launching a game to bring up the launch menu. By default, “video mode” should be blank. If it is not blank, select “remove video mode choice.” This will tell Retroarch to automatically detect the native resolution of your display.
    2. Now scroll to “retroarch render resolution.” Set this to “use video output” if using a raspberry pi model 2. Otherwise leave as is (640×480).
    3. Launch game.
    4. go to RGUI -> settings -> video settings -> integer scale ON
    5. RGUI -> options -> video options -> set custom ratio
    6. Set to whatever looks best. You can’t get to a perfect 4:3 aspect ratio but you can get close if you use the right scaling ratio. For NES for example, 6×5 scaling gets you close to a 4:3 aspect ratio with the top and bottom cropped off (see below)

    A note on 5x scale: If you use 5x scale and wish to use a scanline overlay, you need to use one designed for 5x, which I’ve provided here. It is desirable to set the Y axis to 5x scale for many systems, cropping off the top and bottom of the picture. On a CRT, the “safe area” was 90% of the picture. The safe area was the zone in which important graphics were displayed. The rest was occupied by overscan, which wasn’t meant to be displayed and which was cropped off by CRTs. With 5x scale on the Y axis, or 1200 pixels, you are cropping off 120 pixels on a 1080 display. This is 24 pixels on a 240p console, or 10%, equivalent to the entire overscan area.

    Important Note: depending on the core, crop overscan may need to be turned either ON or OFF. Crop overscan can cause problems with scaling if not set right.

    Note: these resolutions are for a 1080p display.

    NES:
    1024×960
    1280×960
    1280×1200
    1536×1200

    Genesis:
    960×896
    1280×896
    1280×1120
    1600×1120

    SNES:
    1024×896
    1280×896
    1280×1120
    1536×1120

    Doom:
    1280×1000

    More systems will be added as they are tested.

    patrickm, could you please provide your recommendations for, PSX, Mastersystem, PC-Engine as well? Sega CD seem to differ from genesis and 32x as well.

    #99083
    Profile photo of patrickm
    patrickm
    Participant

    patrickm, could you please provide your recommendations for, PSX, Mastersystem, PC-Engine as well? Sega CD seem to differ from genesis and 32x as well.

    I updated the op and added some more systems. Note that Floob’s video manager tool will soon make this obsolete. You will be able to easily configure all systems at once without having to edit config files 🙂

    #99087
    Profile photo of Floob
    Floob
    Member

    @patrickm
    Could you repost your patrickm-scanlines1920x1080-5x.png file so I can make sure I’ve got the right version in the video manager?

    I have your settings for SNES, Megadrive, NES, PSX, Doom, Quake in the tool using the image I mention above. This is all without shaders.

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #99090
    Profile photo of patrickm
    patrickm
    Participant

    @patrickm
    Could you repost your patrickm-scanlines1920x1080-5x.png file so I can make sure I’ve got the right version in the video manager?

    I have your settings for SNES, Megadrive, NES, PSX, Doom, Quake in the tool using the image I mention above. This is all without shaders.

    Here it is:
    https://www.dropbox.com/s/88bj4jqgeqzx1c6/scanlines1920x1080-5x.png?dl=0

    #99091
    Profile photo of Floob
    Floob
    Member

    Thanks, thats definitely in the tool now.

    Do you want me to add 4x options, or look at shaders next?

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #99092
    Profile photo of patrickm
    patrickm
    Participant

    Thanks, thats definitely in the tool now.

    Do you want me to add 4x options, or look at shaders next?

    Thanks Floob.

    Could you also incorporate the 5x settings for N64 and PCengine? Then we can work on the 4x settings, which I sent you the resolutions for. Let me know if you need anything.

    #99137
    Profile photo of Floob
    Floob
    Member

    New version up with PC Engine added. Want to try it?
    https://github.com/biscuits99/rp-video-manager

    Can you write a one sentence description of why the 5x or other version should be used? i.e. under what conditions would the 4x be more suitable.

    Then do you want a new option for 720p handhelds – which settings for the other systems here – the 3x?

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #99163
    Profile photo of patrickm
    patrickm
    Participant

    New version up with PC Engine added. Want to try it?
    https://github.com/biscuits99/rp-video-manager

    Can you write a one sentence description of why the 5x or other version should be used? i.e. under what conditions would the 4x be more suitable.

    Then do you want a new option for 720p handhelds – which settings for the other systems here – the 3x?

    New version up with PC Engine added. Want to try it?
    https://github.com/biscuits99/rp-video-manager

    Can you write a one sentence description of why the 5x or other version should be used? i.e. under what conditions would the 4x be more suitable.

    Then do you want a new option for 720p handhelds – which settings for the other systems here – the 3x?

    thanks Floob, I’ll take a look.

    I think 5x is preferable for most systems that displayed on a CRT TV such as NES, SNES, and Genesis because it doesn’t show any of the overscan that was cropped on a real CRT and it doesn’t result in any letterboxing of the image, which takes full advantage of the screen/TV’s display area.

    However, some people might prefer 4x because the scanlines are slightly bolder/thicker at that scale, and some people like bolder scanlines. Or, someone might simply want to see every line put out by the console, even if it wasn’t meant to be displayed.

    Actually, I was hoping to have the issue with my aperture grill overlays solved by now, so that there could be a separate option for that. But, I’m still seeing a strange diagonal line down the middle when it’s applied in Retroarch.

    eventually, I would like to see the following options:

    configure consoles for 1080p/i displays:
    -5x w/scanlines
    -4x w/scanlines
    -5x w/aperture grill
    -4x w/aperture grill

    configure consoles for 720p/i displays:
    -3x w/scanlines
    -3x w/grid (at this resolution, the aperture grill becomes a regular grid. I’ll send this to you)

    configure handhelds for 1080p/i displays:
    (6x overlay for GBA, 7x for Gameboy, Gameboy Color, Game Gear)
    -w/scanlines
    -w/grid

    configure handhelds for 720p/i displays:
    (4x overlay for GBA, 5x for GB, GBC, Game Gear)
    -w/scanlines
    -w/grid

    So, a total of 10 options in 4 categories. I think that should cover it for the overlays.

    #99185
    Profile photo of Floob
    Floob
    Member

    Thats helpful. Will keep me busy for a while! 🙂

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #102168
    Profile photo of bazola
    bazola
    Participant

    Hi patrickm, can you please provide your recommended resolutions for neo geo?

    #102521
    Profile photo of shadowmoses
    shadowmoses
    Participant

    It doesn’t work well here.

    I have problems to keep my settings saved in Retroarch GUI. When i use the “save new config” option, it will save but not in retroarch.cfg

    #102532
    Profile photo of Floob
    Floob
    Member

    It doesn’t work well here.

    I have problems to keep my settings saved in Retroarch GUI. When i use the “save new config” option, it will save but not in retroarch.cfg

    Yes, you’ll need to rip some settings out of the file that was created (or you could just rename it retroarch.cfg, but that will screw with a few things.).

    If you are feeling brave you can use this tool (although PLEASE make a backup – as I cant guarantee it wont break other settings):
    https://mega.co.nz/#!2NAUwbAL!BrgkCCWMerAxKDDE_0LYtR2qKjkDN26QZbDrIuIJ_28

    Put it in your home (/home/pi) directory and

    unzip -o rp-video-manager-11-JUL-2015.zip
    rm rp-video-manager-11-JUL-2015.zip
    cd /home/pi/rp-video-manager
    chmod 755 videomanager.sh
    ./videomanager.sh

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #102596
    Profile photo of shadowmoses
    shadowmoses
    Participant

    wow this tool is the solution, very easy to install and apply.

    You should start a specific topic to document it online for noobs like me.
    (I noticed the info.txt file now i understand a bit more the different settings)

    The only issue i had is that i was unable to quit and had to shutdown the pi.

    thank you very much floob

    #102599
    Profile photo of Floob
    Floob
    Member

    Thanks for the feedback. I really need to write more documentation for it and update it a bit more. The issue is that it is really difficult not to get it to affect users settings if they have heavily customised them. I’ll try to update it soon, and when its a bit more stable I’ll create a new topic.

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #102886
    Profile photo of dragonjab
    dragonjab
    Participant

    ok so after finally having time to work on this all day, since school is out. I figure it out. Thanks to all the good posts and people that help out. Thanks Patrickm, Floob, and patl. I’m going to post what I did.

    I first follow floobs video.

    and I also added patrickM scanlines both the regular and 5x. I generated a cfg file for both and then I put them in the folder 16-9 found in floobs guide.
    http://smartretro.co.uk/forums/viewtopic.php?f=3&t=85

    I then use this thread to find the correct scaling I found out that for the snes 1280×1120 is perfect 5×5 scaling. I didn’t want to go through the whole RGUI setup because I could never find how to save it. So in the idividual retroarch file for everysytem I put this created by patl

    This one is for the snes, but you can easily adjusted for other systems just change the width and height. I also added video_scale_interger = “true” to the list of commands. Without this on my retroarch file I was getting a crop image from the bottom. Below is the edited code.
    video_shader_enable = false
    # We dont need them
    video_fullscreen_x = 1920
    # Horizontal Monitor resolution
    video_fullscreen_y = 1080
    # Vertical Monitor resolution
    custom_viewport_width = 1194
    # Horizontal emulator resolution
    custom_viewport_height = 896
    # Vertical emulator resolution
    custom_viewport_x = 363
    # The first X pixel of the emulator image
    custom_viewport_y = 92
    # The first Y pixel of the emulator image
    aspect_ratio_index = 22
    # Aspect Ratio set to custom
    video_scale_interger = “true”
    # This is to what I added to the instructions
    input_overlay = /opt/retropie/emulators/retroarch/overlays/16-9/TV_16-9_SNES-MD.cfg
    # Overlayimage
    input_overlay_enable = true
    # Overlay Image enable
    input_overlay_opacity = 1.000000
    # opacity of the overlayimage
    input_overlay_scale = “1.000000”
    # Scalesize of the overlay image
    video_smooth = true
    # Smoth the emulated image, not the overlay, If you set it to false, it will remain sharp but blocky.

    #102887
    Profile photo of dragonjab
    dragonjab
    Participant

    Ok so after trying everthing out. I can’t seem to make the n64 emulator work.

    *Never mind I got it to work I just had forgotten to add it to the videomodes.cfg file. Everything works flawlessly. I just added to video modes. lr-mupen64plus_render=”config”

    #102916
    Profile photo of dragonjab
    dragonjab
    Participant

    Ok so here my settings for videomodes.cfg
    settings for all emulators.
    and FBA settings it works for most games, you just have to mess around with the width and height.

    Attachments:
    #102920
    Profile photo of dragonjab
    dragonjab
    Participant

    here are my N64 settings and snes settings

    Attachments:
    #102923
    Profile photo of dragonjab
    dragonjab
    Participant

    here are my megadrive and psx settings

    Attachments:
    #102926
    Profile photo of dragonjab
    dragonjab
    Participant

    Here are Mame settings. Can someone please merge all this posts into one. Thanks.

    Attachments:
    #103173
    Profile photo of patrickm
    patrickm
    Participant

    Here are Mame settings. Can someone please merge all this posts into one. Thanks.

    For accurate video scaling, video smooth needs to be turned off. Nearest neighbor filter displays the source material without altering it. Bilinear filter runs the source material through an algorithm and distorts the image by finding an average color based on adjacent pixels.

    You might prefer the smoother image, but it causes pixels to bleed over the scanlines, and it alters the source material, making it less accurate.

    In addition, bilinear filter/ video smooth WILL introduce additional input lag vs. nearest neighbor, although the difference probably isn’t significant enough to be noticeable to most.

    #103269
    Profile photo of dragonjab
    dragonjab
    Participant

    Here are Mame settings. Can someone please merge all this posts into one. Thanks.

    For accurate video scaling, video smooth needs to be turned off. Nearest neighbor filter displays the source material without altering it. Bilinear filter runs the source material through an algorithm and distorts the image by finding an average color based on adjacent pixels.

    You might prefer the smoother image, but it causes pixels to bleed over the scanlines, and it alters the source material, making it less accurate.

    In addition, bilinear filter/ video smooth WILL introduce additional input lag vs. nearest neighbor, although the difference probably isn’t significant enough to be noticeable to most.

    Yeah you are right. I did some tweaks to my system last week that I didn’t post here. Yes is noticeable on fighting games like street fighter 3rd strike.

Viewing 30 posts - 1 through 30 (of 30 total)

Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/

Skip to toolbar