RetroArch – Introducing the Mega Bezel Reflection Shader

Article written by HyperSpaceMadness



RetroArch keeps introducing innovations to the retrogaming world, constantly building simple roads for players to enjoy classic games in new and sometimes better ways.

Getting the sweet spot between ease of use and customization can be a time-consuming process, and sometimes requires a deep insight of how old technologies worked: refresh rate, aspect ratio, scaling, overscan, deconvergence are terms which we may or may not be familiar with, and these all play an important part in building a retro gaming experience that feels better, yet passionately authentic.

How do we get a handle on this?

Building an idealized CRT (cathode ray tube) like display experience. Getting the best out of post-processing with the latest CRT shaders fused into a “one stop” solution. Making it incredibly easy to customize, and yet performant. A fresh and unique starting point for the retro game lover.

Console branded tv by Soqueroeu, great for playing on a big screen in the living room
Console branded tv by Soqueroeu, great for playing on a big screen in the living room

The Mega Bezel Project started back in July 2019 when developer HyperspaceMadness was looking at experimental shaders creating real-time reflections on emulated display bezels. More than two years later, the swiss-army-knife of visual simulation to enhance the retro game experience is ready for players!

Sonic with a Blended Waterfall, Genesis Preset and graphics by Duimon
Sonic with a Blended Waterfall, Genesis Preset and graphics by Duimon

The Mega Bezel is unique in that it bends the common definitions of shaders and overlays in an out-of-the-box experience: custom calculations take care of games native resolution and scaling, dynamically draw bezels around the gameplay area filled with curvature simulation and reflections, incorporating a unique pipeline of CRT simulation models and other visual conditioning of the game image, color correction, de-dithering, and adding responsive backgrounds and lots of additional features to enjoy.

The shader centralizes a lot of complex tasks and makes them instantly available for all cores: screen rotation and position, horizontal and vertical orientation, zooming, cutting away games black spaces to get a real full-screen, and filling the aspect ratio difference between the emulated screen and your monitor with interesting graphics. Mega Bezel even adds original solutions, like the ‘Night Mode’ to simulate a dimly lit room and ‘Glass Mode’ for a modern and dynamic way to fill the entire monitor.

Mega Man 8 with the Glass Preset, good for filling the screen, avoiding any worries of OLED burn-in
Mega Man 8 with the Glass Preset, good for filling the screen, avoiding any worries of OLED burn-in

Being based on contributions and discussions from the Libretro forums, Mega Bezel is a community project at its heart: shader writers and artists are actively developing features and customized presets which max out the shader capabilities, and making them freely available for retro players to enjoy and further customize, chasing the their ideal setup.

3DS Preset by Duimon with alternate layout and custom graphics
3DS Preset by Duimon with alternate layout and custom graphics

Easy to use for newcomers, deep in customization for emulation maniacs, flexible for artists: the Mega Bezel project is a fun ongoing journey that strives to bring wonderful features to everyone, minus the hassle of setup!

Game Boy Advance LCD Preset & Graphics by Duimon
Game Boy Advance LCD Preset & Graphics by Duimon

You can get the basic Mega Bezel shaders inside RetroArch by running Online Updater -> Update Slang Shaders then the shaders will be located inside shaders/shaders_slang/bezel/Mega_Bezel/Presets. Be sure to read the setup portion of the ReadMe.md to help you get started you can find it in the Mega_Bezel folder just mentioned.

A small group of talented artists has also come together using the Mega Bezel to create suites of shader presets with beautiful graphics covering many consoles, computers and PVMs to share with retro gamers.

If this sounds exciting head over to the Mega Bezel thread on the Libretro forum to find more about the Mega Bezel, and links to the artist’s pages and shader preset collections.

https://forums.libretro.com/t/hsm-mega-bezel-reflection-shader-feedback-and-updates/25512

Below are more examples of the Mega Bezel and artwork from the community.

OutRun preset and graphics by Orion's Angel
OutRun preset and graphics by Orion’s Angel
Star Wars with a lovely JVC PVM from TheNamec!
Star Wars with a lovely JVC PVM from TheNamec!
Garou: Mark of the Wolves with Smoothed Preset
Garou: Mark of the Wolves with Smoothed Preset
REZ with Dreamcast core upscaling with shader downscaling and cyberpunk style by TheNamec
REZ with Dreamcast core upscaling with shader downscaling and cyberpunk style by TheNamec
Monkey Island with some smoothing and deconvergence magic
Monkey Island with some smoothing and deconvergence magic
The Great Gianna Sisters with a preset and graphics by TheNamec
The Great Gianna Sisters with a preset and graphics by TheNamec
Tron's Deadly Discs showing supports for the game Image on top of backdrop
Tron’s Deadly Discs showing supports for the game Image on top of backdrop
Choplifter with the Glass preset and some scaling
Choplifter with the Glass preset and some scaling
Resolution info can be printed to the screen so you can see what resolutions are used
Resolution info can be printed to the screen so you can see what resolutions are used
Shadowgate on Macintosh with graphics by Duimon
Shadowgate on Macintosh with graphics by Duimon
Monochrome Amber mode applied
Monochrome Amber mode applied
Vib Ribbon on PS1 with color added and a nice PVM from TheNamec
Vib Ribbon on PS1 with color added and a nice PVM from TheNamec

RetroArch 1.7.7 – New OpenGL Core driver supports Slang universal shader spec!


When RetroArch added support for the Vulkan graphics API back in 2016, we made a new shader spec that was intended to replace the older shader specifications like Cg and GLSL moving forward.

The problem at the time was that only the Vulkan video driver could make use of these shaders. Therefore, if you were using the OpenGL video driver, you could not use the slang shaders but had to resort back to GLSL (or even Cg). This made it cumbersome to switch between video drivers, say starting one game/core that uses OpenGL, then switching back to Vulkan to start another core that uses Vulkan. You couldn’t just load a shader preset for one of the two and expect that to work as well for the other core with a new video driver.

A new OpenGL driver has been made that targets OpenGL 3.2 and up. And unlike the older GL driver, this one supports only slang shaders. This means that this OpenGL driver can now finally use the same shaders as Vulkan, Direct3D 10/11/12, and Metal. This marks an important milestone for us since we are well on our way to having a true universal shader spec now that can cross around graphics API barriers.

List of video drivers supporting slang

Here is a listing of video drivers that support slang in RetroArch:

    1. OpenGL (Core – requires 3.2 or higher)
    2. Vulkan
    3. Metal
    4. Direct3D 10/11/12
    5. WiiU

How to use it

In order to use this video driver, you need to have a GPU with modernday OpenGL drivers. By default, RetroArch starts out on most platforms with the regular GL driver, which requires OpenGL2. We will therefore have to switch over manually to GL Core in order to use it.

Once inside RetroArch, go to Settings – Drivers. Go to Video Driver. Select ‘glcore’. After this, go back to the main menu inside RetroArch, and select ‘Quit RetroArch’.

What platforms are supported as of v1.7.7?

So far, the Windows and Linux builds come with the GL Core driver. macOS might follow later for OSX 10.7 and up.

The GL Core driver is OpenGL ES 3.x compatible, so a port to mobile devices is not inconceivable. We would certainly like to see this driver appearing on Android and iOS.

If for whatever reason your GPU or driver does not supper OpenGL 3.2, RetroArch will quit and set your video driver to “gl”. You will then just have to restart the program in order to boot with the regular OpenGL 2 driver.

Important

Future plans/current limitations

    1. The glcore driver does not support GLSL or Cg shaders, only slang. If you still need to use such shaders, you have to go back to the older OpenGL video driver.
    2. We’d like slang to appear on even more platforms, such as the Microsoft Visual Studio builds below 2012. What prevents this from happening is the usage of C++11. Slang as a shader spec leverages several technologies such as the excellent SPIRV-Cross and glslang, both of which are also C++11 projects. Now, SPIRV-Cross has a C API, so this could be a potential solution towards making a wholly C based solution so that slang could appear in more builds. However, the C API for glslang has been abandoned and deprecated for one or two years. So after 1.7.7, we will have to research alternatives such as Google’s shaderc (which is supposed to still have a C API), and hope they will allow us what we want to do – have wholly C code for the slang shader code for the sake of backwards compatibility and being able to port it to more platforms.

Links

Developing Slang Shaders