2xBRZ shader for RetroArch?

I have a bit of a conundrum that I’ve been stuck with for the last couple years. Ever since I discovered the xBRZ filter, it has become my definitive shader that I prefer to use for all my retro pixel art games. I think it does the best job of smoothing out the pixels to give them an HD-looking makeover while maintaining a reasonable sharpness and consistency.

Problem is, my preferred setting for xBRZ is the fixed 2x preset as featured in SNES9X and VBAM, but my preferred emulator for my SNES titles is BSNES for the superior color contrast, accuracy, and sound quality. By default, BSNES emulator only comes with the freescale version of the xBRZ filter, which renders at something that looks more closely like the 4x setting on the standard version of xBRZ. It’s too powerful for my taste, smoothing out the pixels too much and distorting the game’s original art style.

I later learned that this freescale version can be easily modified to limit the scaling factor on it, but even after applying these changes, it still doesn’t look right. It seems to be using a fundamentally different algorithm from the fixed 2x - 6x preset options that we see in SNES9X and VBAM. So, that’s when I decided to try looking into RetroArch. While I was initially ecstatic to find that it has more fixed scaling xBRZ options than standalone BSNES, they still are only limited to 4x - 6x, for some reason missing 2x and 3x. I am not sure why these two are omitted, as to me they are vastly preferred for improving the picture quality of 16-bit era games.

I have tried desperately to examine the code over and over again to see if there were some easy tweaks I could make in order to say, re-adapt the 4xBRZ filter into 2x by simply flipping a few values around and changing some lines of code, but after careful combing through it, I still just don’t understand nearly enough of how it works to make the modifications. I would be eternally grateful if anyone could provide a proper 2xBRZ option for RetroArch; one that isn’t just a tweak of the freescale version, or if they could point me in the right directions of how to achieve this myself. Though I must warn you regarding the latter option, my brain has already melted trying to understand this code, so if it requires any extensive knowledge of how the smoothing algorithm works I’m probably not going to be able to follow it. I’m just not at that level yet.

1 Like

Wow! It seems like you’re working too hard. Try this instead:

Just use my “CyberLab__Composite-Sharp__PVM-Edition”, “CyberLab_Computer_Monitor-Sharp_ADV” or “Cyberlab__RGB-Sharp__PVM-EDITION__ADV” presets. I think you’ll find that at least one of those has the right balance of smoothing without being excessive that you’re looking for.

You can even try my new CyberLab__Composite-Pure__Soqueroeu-TV_Special_Edition_SNES_ADV preset + Blargg_NTSC_TurboDuo_SNES_PSX_Composite_CyberLab_Special_Edition video filter which is also included in my preset package.

I appreciate the help, though I could not get these shaders to run. It would just crash back to desktop. I should note that I’m using a 10+ year old gaming PC that I have converted into a RetroArch media center for my living room TV. Though it does have a GTX 660 TI running in it, the processor is a pretty anemic 1st gen core i7 by today’s standards, but that’s all I need it to be for my needs on this device.

I should also mention that I have very little regard for nostalgia. I play these retro games because I think their gameplay still holds up and is worth revisiting, but I have no interest for replicating the glory days of CRTs and scanlines. I just like to clean up the visuals for modern displays as much as possible, and 2xBRZ is all I really need for that. These shaders look really nice for what they do, but seem a bit over-designed for my needs from what I’ve seen of the screenshots.

The frustrating thing for me is, I know the code is already out there and written. It’s just not in the glsl or slang format for RetroArch.

Does RetroArch still accept .CG? Because I see there is already a 2xBRZ script written in it that I presume used to work on older versions of RetroArch:

1 Like

Cg support isn’t included in recent releases, but I went ahead and ported the 2x version to slang: https://github.com/libretro/slang-shaders/blob/master/xbrz/shaders/2xbrz.slang

It should be fetch-able via the online updater soon (probably take a few hours).


With a little patience and a few settings adjustments you might be able to get HSM Mega Bezel Reflection Shader to run on your system and adjust the presets to your liking.

There’s an alternative upscaling shader called ScaleFX that’s included in HSM Mega Bezel Reflection Shader that isn’t as harsh as xBR.

I’ve never used it standone but I think you might like it. It does similar things to xBR just in a better way in my opinion.

If you’re interested and have the time we can still try to see why HSM Mega Bezel Reflection Shader isn’t loading for you for curiosity sake. It’s always nice to get additional hardware compatibility info to help with its development and improvement. If so, can you post a log?

I REALLY appreciate your help with this. Unfortunately, after trying out the updated slang shaders it still seems to be different from the algorithm used in standalone SNES9X and VBAM. Take a look at these screenshots.

Here is SNES9X standalone with 2xBRZ shader:

And here is RetroArch running its own version of 2xBRZ:

You can see that with RetroArch there is a blurring effect over everything that greatly diminishes its sharpness (you might need to open the image in a full size tab in order to see the difference). Almost as if a bilinear filter or something is running on top of it as well?

This gives me an idea. Might see if I can modify the slangp file to turn off a linear filter setting if present and see if that’s the culprit.

Thanks again, Cyber. I might check out that ScaleFX shader as well and compare it to xBRZ.

As it stands right now though, I just got RetroArch up and running for the first time with my media center machine and I want to get it in working order with the basics first before I fiddle around with any more experimentation and troubleshooting. I don’t even know where the logs are located and how to generate them, and I have to navigate everything with a controller which is a bit cumbersome over a mouse / keyboard setup whenever I have to switch back to my Windows desktop, so the less tinkering with that the better.

1 Like

Yeah, that’s exactly what’s going on. The 2xbrz pass is followed by a stock pass with the filter set to “linear”. If you change that to “nearest” and apply settings (you might have to do it 2x to get it to stick), it should look chunkier.


I got it! I just removed the second shader pass entirely which was the one that included the linear filter, and now it runs exactly as I want it!

You just helped me solve a multi-year long frustration. Now I don’t have to compromise between the accuracy of BSNES and the quality of xBRZ. Thank you.

1 Like

heh, yeah, that works, too. I’m glad that got you fixed up.


On a somewhat unrelated note, one other thing I wanted to look into was stretching the image to always be at full height. Sometimes SNES titles have a black bar across the bottom during certain segments, likely due to an aspect ratio shift I’m guessing, but I’d like to just stretch the image as much as possible anyway while maintaining aspect ratio, even if the pixels may not always perfectly line up. Is that a feasible option, or are these emulators just not capable of intelligently adjusting that?

Or at the very least, can the viewport be centered to the middle of the screen rather than having a black bar only across the bottom?

Edit: Also-also, is there any meaningful difference between “gl” and “glcore” for the driver? Only difference I noticed was that glcore seems to support slang while gl doesn’t, but aren’t they both just implementations of OpenGL?

gl is “legacy” OpenGL (v2.0+) while glcore is “modern” OpenGL (v3.0+), and yes, the most obvious difference is which kind of shaders work with them. Otherwise, they should be largely interchangeable on modern GPUs.

The black bars are typically part of the image. Most cores will have a “crop overscan” setting in quick menu > options, which will usually take care of it for the most part. Another option that works well on 1080p screens is to go to settings > video > scaling and turn on integer scaling and “overscale”, which will bump it up to 5x scale. This means some of the image bleeds off of the visible screen, but it all stays well within the “safe” area that Nintendo recommended developers use to accommodate the differing levels of overscan that individual televisions would have.


Hello each and every single 1 of you :slight_smile:

First of, iam an new member and therefor can’t create any new topic atm.
Hence me being here asking for some help, pretty please.

It’s been clear to me that later builds of retroArch doesn’t support .cg shaders anymore .
And that’s plain awfull !! Read on why…

Out of litterally hundreds of shaders i’ve have tested .glsl, cg, .slang etc… i have FOUND but 1 jewel i REALY realy would like to get to work with retroArch … :grin: .

Iam using it currently in Bizhawk but later builds have somewhat broken that shader in bizhawk , for wich currently is pending an issue at github…

The shader is used for PSX emulation, and realy polishes the graphics to gorgeous levels :kissing: .

The shader is called “4xbr-hybrid-crt.cgp” If some one could help me out to convert this shader into .slangp to get it to work with vulcan renderer in beetle hw , that would be awesome.

Here’s the link to the shader package …

Iam looking forward to try it in retroArch → beetleHW :yum:

Take care for eachother , and yourselfs

cheers, ToiletDuck

1 Like

Hmmm :thinking:

There is already a “shaders_slang\xbr\4xbr-hybrid-crt.slangp”

looks like it moved a bit, but yeah: https://github.com/libretro/slang-shaders/blob/master/xbr/other%20presets/shaders/4xbr-hybrid-crt.slang

And I just re-ported it for them. No wonder it felt so familiar lol. deja vu

1 Like


Hmmm :thinking:

There is already a “shaders_slang\xbr\4xbr-hybrid-crt.slangp”



looks like it moved a bit, but yeah: https://github.com/libretro/slang-shaders/blob/master/xbr/other%20presets/shaders/4xbr-hybrid-crt.slang

And I just re-ported it for them. No wonder it felt so familiar lol. deja vu

I’dont get it… You lost me right there ↑ :expressionless:

All i see, is a bunch of script notes …

But actual links to working .slangp files and what not i need to get it to work i DONNOT SEE/FIND :roll_eyes:

I mean, what am i suppose to do with one page with notes ? Cook em in boiling water with an pinch of salt, and steer it every 5 min or so untill it’s done :face_with_head_bandage:

C’mon, already … what is this… rocket science :point_up::nerd_face: ?

Fyi Duimon , i have actually have found the “shaders_slang\xbr\4xbr-hybrid-crt.slangp” at some other forum … Guess what, DID NOT WORK aka (failed to load message) !!!

thanks anyway…

cheers, TD

1 Like

I think you need to settle down a bit.

You did not need to find the shader at a different forum, it is included in the slang shaders in the folder I posted.

If it fails to load, perhaps you could take the time to post a log so we can see the error.

What do you mean, “settle down” ? Iam cool → see :cold_face:

Furthermore its my own → Personal ← Computer a.k.a PC i have browsed and searched for.
I mean, i’ll know what’s there and what’s not on my desktop, right?

“It failed to load” is what RetroArch ONLY the lOnely told me. Sure, i can enable logging this and that… But realy… thats NEXT LEvel troubleshooting … :thinking:

No, whats the proper action is to recieve the proper files from someone like … dunno … hunterK :slightly_smiling_face: and get it done without the hassle…

And he DID :smile: :ok_hand:

cheers, TD

this xbrz will never be correct because it is not true xbrz. xbrz is a scaler. The one called xbrz in retroarch is a shader version. if you want it to look identical to standalone emu xbrz, you must use scalefx. It’s still a shader, but it does the visual results better.

EXACTLY ↑ , what i had to do to get correct spaced scanlines to appear on my monitor and HDTV aswell… But the settings in the core do screw up scanlines in shaders too, that and / or wrong parameters in the shader !!!