xBR algorithm tutorial

Actually, xBR-hybrid and SABR aren’t comparable. They have distinct goals. You should compare it with xBR pure (3.8 versions).

The hybrid means it uses two algorithms to filter. It compares the results between ReverseAA and xBR and chooses what’s more suitable to give a depth feel to a 2D image.

Pure xBR and SABR are specialized in 2D flat images only, while ReverseAA was designed to highlight depth of a 2D image in perspective. The weak point of xBR is the strong point of ReverseAA and vice-versa. They complement each other. That’s why I’m developing this hybrid.

So, the transition between xBR and ReverseAA algorithms isn’t completely seamless yet. My task now is to minimize these small transitions.

For you to have an idea of 2d depth, play Donkey Kong Country or Killer Instinct with xBR 3.8 or SABR and then with xBR-hybrid. You’ll see more depth on textures.

Are you using 0.9.8? Pretty sure that bug was fixed quite some time ago.

[quote=“Hyllian”]

Actually, xBR-hybrid and SABR aren’t comparable. They have distinct goals. You should compare it with xBR pure (3.8 versions).

The hybrid means it uses two algorithms to filter. It compares the results between ReverseAA and xBR and chooses what’s more suitable to give a depth feel to a 2D image.

Pure xBR and SABR are specialized in 2D flat images only, while ReverseAA was designed to highlight depth of a 2D image in perspective. The weak point of xBR is the strong point of ReverseAA and vice-versa. They complement each other. That’s why I’m developing this hybrid.

So, the transition between xBR and ReverseAA algorithms isn’t completely seamless yet. My task now is to minimize these small transitions.

For you to have an idea of 2d depth, play Donkey Kong Country or Killer Instinct with xBR 3.8 or SABR and then with xBR-hybrid. You’ll see more depth on textures.[/quote]

I see, didn’t know that, very interesting, i would love to see some more depth in 2d games, and only the more reason for me to keep watch on this. A question, you said, and i quote:

Retroarch provides hardware filtering (GPU builtin), like linear or point. Linear interpolation uses the bilinear algorithm. Point interpolation uses the nearest neighbor algorithm.

Where exactly is that option enabled in RetroArch?

Speaking only for the PS3 version, those options are available in the video options (the same screen where you choose shaders). For PC or other systems, I don’t know. Ask maister or Squarepusher.

On PC/Mac/Linux, under Settings > Video, you can check/uncheck a box to enable/disable bilinear filtering. Bilinear is enabled by default, but if it is disabled, RetroArch will use point filtering instead.

There is a second bilinear box for the 2-pass/FBO option in the shader settings. It functions the same but applies only to the second shader.

Individual shaders can also override those settings if they are designed to work with one or the other.

First version of xBR-Hybrid plus CRT is done. It’s in beta stage yet.

If you wanna test, 4xBR-Hybrid+CRT.cg -> https://anonfiles.com/file/325895016131af9e5b087c88d29b3d4e

It only works fullspeed on PS3 at 4x scaling.

The best config for me is:

Shader 1: 4xBR-Hybrid+CRT.cg Shader 2: stock.cg Scale Factor: 4x hardware filter 1: point hardware filter 2: point

Hi Hyllian,

Could you post it on pastebin so i can test it out, all the file sharing sites are blocked for me unfortunately.

Regards,

Spin

Sure. I’ll give three shaders. Two are hybrid-crt candidates e and the last is a naked hybrid.

crt1: http://pastebin.com/q5bySjs4 crt2: http://pastebin.com/ku7tRvRc last: http://pastebin.com/yf4xJxF5

I’d like to know which of the crt versions do you like more.

I think crt1 looks slightly better. crt2 seems a little more prone to odd behavior where scanlines intersect with in-game lines.

Hi, hunterk.

Could you use these two parameters from CRT1 in the CRT2 shader and see if the odd behaviors disappear?

    #define SPOT_HEIGHT 0.54
    #define COLOR_BOOST 1.48

@Hyllian That didn’t seem to fix it.

Here’s a picture showing the issue: http://www.mediafire.com/download.php?t853jek3dc3jbbj

It’s in PSD format, but GIMP should open it, too, if you don’t have Photoshop. Toggle the visibility of the top layer, which is crt1 and it will make the background layer, crt2, visible with circles drawn around some of the problem spots.

Are you sure it’s running at 1024x896? By the picture, I’d say it’s a resolution issue.

These xBR-derived filters only work properly with integer multiple scale.

That could be. The pictures were taken in windowed mode, so I would assume I had set an even integer scale, but I can double-check.

It looks great, i cannot see a huge difference between CRT1 and 2. CRT1 does seem to look more clear to me.

Two more for tests:

Hybrid: http://pastebin.com/7mgmDPvi

CRT: http://pastebin.com/aBNLk9pb

Use the same config recommendations I made before.

This new hybrid is more clean than the last version (v4). Some comparison: http://minus.com/mbc77JLTpfZqQs

Thanks Hyllian, once i have some time i shall test it.

There’s another shader I’m working called ddt.cg.

Today I tweaked a bit and added gamma correction based on ideas from someone from other forum. I think the results are interesting.

Here’s a beta: http://pastebin.com/cJ9TPbHU

And now a ddt+gamma using xBR edge detection: http://pastebin.com/pZwerMr0

Added gamma correction to xBR:

https://github.com/libretro/common-shaders/tree/master/xBR

They’re the three files with “gamma” in the name.

I just found an improved rule to detect corners. It gets the quality of C version without most of its artifacts.

I’m implementing in shader only: http://pastebin.com/QMR4De9a