hit tracker

The Shader Thread

Discussion in 'PS3 Homebrew Corner' started by Bothrops, Dec 24, 2011.

  1. 6
    0
    0
    Bothrops

    Bothrops Loyal Member

    Joined:
    Sep 30, 2011
    In this thread you'll find some tips about the use of shaders on PS3 emulators. Feel free to post any new shaders.

    I'll describe some shaders already in use by some emulators so that you'll have an idea of what is happening to the screen and what should be your configuration to get good results.

    If you find any wrong information here, feel free to point and I'll fix asap.

    The recommended configurations below were tested only in 1080p displays.

    So, let's begin!


    Stock

    This shader just do the Nearest Neighbor filtering. Depending on the scale factor chosen, the stock shader will zoom all pixels in a squarely manner. This filter is good as a second slot shader. Besides, it works well when you enable bilinear filtering by setting the hardware filtering option to LINEAR.

    Recommended configuration (when standalone):

    Shader #1: stock.cg
    Shader #2: stock.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Linear
    Scale Factor: 2x

    best slot: second


    Quilez

    This shader is similar to stock, but when bilinear hardware filtering is enabled, Quilez interpolation is sharper than stock. Because of this, Quilez preserves sharpness much more than stock. It's ideal as a second shader when combined with other shaders which use 4x scale factor.

    Recommended configuration (when standalone):

    Shader #1: Quilez.cg
    Shader #2: stock.cg
    Hardware filtering #1: Linear
    Hardware filtering #2: Linear
    Scale Factor: 5x

    best slot: second


    AdvancedAA

    This shader aims to reduce visible jaggies encountered on games when upscaled by 2X. The filter look at the pixel's direct neighbors (horizontal, vertical and diagonal) and do some anti-aliasing math. The result is an imaging a bit soft. It doesn't discriminate pixels, that is, all pixels are equally processed. For this reason, this filter is very fast, though some picture details are lost in the process.

    Recommended configuration (when standalone):

    Shader #1: AdvancedAA.cg
    Shader #2: bicubic-sharper.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Point
    Scale Factor: 2x

    best slot: first


    Bicubic

    This shader interpolate the picture by using a matrix of 4x4 neighbors around the main pixel. The result seems like bilinear filtering, but it's more advanced and less blurred. This shader comes in three flavors: normal, sharp and sharper. They diferentiate from each other only in sharpness. This filter along Lanczos are the best general interpolators and are recommended as second slot shaders along other shaders that use 2x scale factor.

    Recommended configuration (when standalone):

    Shader #1: bicubic-sharper.cg
    Shader #2: stock.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Point
    Scale Factor: 5x

    best slot: second


    Lanczos

    This shader uses sinc functions to interpolate the image. The results are similar to bicubic, but it has a drawback: the filtered image presents some rings around its contours. There are some variants implemented in shaders, but the only worth to use is Lanczos16.cg. This filter is recommended as second slot shaders along other shaders that use 2x scale factor (use this if bicubic presents slowdown).

    Recommended configuration (when standalone):

    Shader #1: lanczos16.cg
    Shader #2: stock.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Point
    Scale Factor: 5x

    best slot: second


    CRT-caligari

    This shader simulates the process by which the image signal pass through in old CRT display. It creates an ellipse around the main pixel. This ellipse
    provides some weights that are used to blend some neighbor pixels in horizontal and vertical directions. This shader is very good with any kind of game.

    Recommended configuration (when standalone):

    Shader #1: crt-caligari.cg
    Shader #2: stock.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Point
    Scale Factor: 5x

    best slot: first


    CRT-cgwg

    This shader simulates the process by which the image signal pass through in old CRT display. It works by simulating a gaussian propagation from each pixel through its neighbors. Because of this, the result presents an image less jaggy than the caligari's crt. This shader is very good with any kind of game. Due to the gaussian math involved, this shader only run fullspeed at a max 4x scale factor on PS3.

    Recommended configuration (when standalone):

    Shader #1: crt-cgwg.cg
    Shader #2: Quilez.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Linear
    Scale Factor: 4x

    best slot: first


    xSoft

    This shader has the same objectives of AdvancedAA. The most noticeable difference is that xSoft takes into consideration the secondary neighbors along the main pixel's direct neighbors. And it aims at 4x scale factors instead 2x. It comes in several flavors: 4xsoft, 4xsoftHD, etc. It's recommended to use the HD version because it shows a less blurred image.

    Recommended configuration (when standalone):

    Shader #1: 4xSoftHD.cg
    Shader #2: Quilez.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Linear
    Scale Factor: 4x

    best slot: first


    HQx

    This shader works looking at the eight main pixel's direct neighbors. It labels every neighbor as "near" or "distant" according to a threshold which is calculated after converting the pixel's RGB values to its YUV counterparts. The main pixel is interpolated according to the classification. Bilinear Interpolation is applied to the neighbors labeled as "near" and a high quality interpolation is applied to the "distant" neighbors, so that the image contours (edges) are preserved. There are two implementations in PS3 emulators: HQ2x and HQ4x.

    Recommended configuration for HQ2x (when standalone):

    Shader #1: HQ2x.cg
    Shader #2: bicubic-sharper.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Point
    Scale Factor: 2x

    best slot: first

    Recommended configuration for HQ4x (when standalone):

    Shader #1: HQ4x.cg
    Shader #2: Quilez.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Linear
    Scale Factor: 4x

    best slot: first


    xBR


    This shader has some similarities with HQx shaders. It detects edges too, though a bit different. It compares two diagonal directions around the main pixel and uses direct and secondary neighbors to this task. Then it uses the same HQx threshold to choose the predominant direction. After detecting the edge, it uses some rules to interpolate pixels along it. The main difference with HQx is that xBR doesn't use bilinear interpolation. Due to the way edges are detected and interpolated, even anti-aliased games are well processed by xBR. There are many implementations and this algorithm is updated often by me. Consider this shader as a WIP shader. Main variants: 2xBR-v3.5 and 5xBR-v3.5a. Others experiments: 4xBR-v3.5+CRT and 5xBR-v3.5+CRT (these are combined with crt-caligari shader).

    Recommended configuration for 2xBR-v3.5 (when standalone):

    Shader #1: 2xBR-v3.5.cg
    Shader #2: bicubic-sharper.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Point
    Scale Factor: 2x

    best slot: first

    Recommended configuration for 5xBR-v3.5a (when standalone):

    Shader #1: 5xBR-v3.5a.cg
    Shader #2: stock.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Point
    Scale Factor: 5x

    best slot: first

    Recommended configuration for 4xBR-v3.5+CRT (when standalone):

    Shader #1: 4xBR-v3.5+CRT.cg
    Shader #2: Quilez.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Linear
    Scale Factor: 4x

    best slot: first

    Recommended configuration for 5xBR-v3.5+CRT (when standalone):

    Shader #1: 5xBR-v3.5+CRT.cg
    Shader #2: stock.cg
    Hardware filtering #1: Point
    Hardware filtering #2: Point
    Scale Factor: 5x

    best slot: first

    OBS: Latest xBR pack is attached. I strongly recommend downloading this pack and update your emulators, specially FBAnext. I've figured out a sweet spot for the xBR+CRT shader. All arcade games will look as beautiful as ever with 5xBR-v3.5+CRT.cg in this new update.
     
  2. 24
    0
    0
    AugustSKY

    AugustSKY Loyal Member

    Joined:
    Aug 26, 2011
    Wait, so none of these shaders come with the packs?
    Will they be added to future updates or will these always need to be installed manually?
     
  3. 6
    0
    0
    Bothrops

    Bothrops Loyal Member

    Joined:
    Sep 30, 2011
    No! Almost all of them already come with PS3 emulators. At least those emulators developed by twinaphex.
     
  4. 3
    0
    0
    Bigby

    Bigby Loyal Member

    Joined:
    Oct 29, 2011
    Thanks for explaining all these shaders and which combinations work best.
     
  5. 6
    0
    0
    Bothrops

    Bothrops Loyal Member

    Joined:
    Sep 30, 2011
    Latest xBR pack is attached in the first post. I strongly recommend downloading this pack and update your emulators, specially FBAnext. I've figured out a sweet spot for the xBR+CRT shader. All arcade games will look so beautiful you won't believe with 5xBR-v3.5+CRT.cg in this new update.

    To get the best size in arcade, use this configuration:

    resize mode (this is to get rid of any scaling glitches) for FBAnext:

    viewport X: 192
    viewport Y: -20
    viewport Width: 1536
    viewport Height: 1120


    On snes-next, use:

    viewport X: 320
    viewport Y: -20
    viewport Width: 1280
    viewport Height: 1120

    On genesis-next, use:

    viewport X: 160
    viewport Y: -20
    viewport Width: 1600
    viewport Height: 1120
     
  6. 6
    0
    0
    Bothrops

    Bothrops Loyal Member

    Joined:
    Sep 30, 2011
    I took some pictures and made a CRT shader comparison for you:

    5xBR-v3.5+CRT
    [​IMG]


    CRT-cgwg
    [​IMG]


    CRT-caligari
    [​IMG]


    5xBR-v3.5+CRT
    [​IMG]


    CRT-cgwg
    [​IMG]


    CRT-caligari
    [​IMG]
     
  7. 50
    0
    0
    PS3emulators

    PS3emulators Loyal Member

    Joined:
    Nov 8, 2011
    Location:
    Brazil Goiania-Go
    I love arcades. FBANext with 5xBR-v3.5+CRT is fantastic! thank you Bothrops.

    I would like a shader crt curved, that simulated a real arcade as what was used in Mortal Kombat Arcade kolection.

    seems to work well with 5xBR-v3.5-plus-CRT in retroarch!

    Any tips to use in retroarch 0.9.9?
     
  8. 65
    0
    0
    JediKnight007

    JediKnight007 Loyal Member

    Joined:
    Jul 16, 2012
    Occupation:
    Grocery store stocker,MILF hunter, cougar bait
    Location:
    USA

Share This Page