Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

Teach me the basics of using Shaders in Libretro emulators



  • Helloo! Currently I'm experimenting a bit with shader settings. I've read the article on the wiki and searched the forum, but I'm not 100% sure about these questions. If anyone could answer these questions or point me to a related article, it be much appreciated!

    1 Can I use a shader to get a game to run faster?
    2 What exactly are shader passes? Currently I'm using only one..... is that good? Should I use two? or more?
    3 The default filter setting, what exactly does this do? Linear and nearest?
    4 And finally the shader scale? I'm guessing its how big the shader effect looks, but it doesn't seem to visibly change anything with the shaders I've tried?

    Thanks

    Using
    Pi Model: Pi 3 - Model B
    RetroPie Version Used: 4.1.19
    Built From: Pre-made image on official RetroPie website + then updated through setup
    USB Devices connected: 2x Bluetooth PS3 controller
    Controller used: 2x PS3 Controller
    Guide used: https://retropie.org.uk/docs/Shaders-and-Smoothing/#shaders
    Emulator: All Libretro emulators



  • @goodpi31 I am by no means an expert, but I think I can answer #1: It is unlikely that a shader would ever actually make a game run faster, as it is asking the computer to do more than it would without the shader. It may not always slow a game down, depending on what the specific calculations are and whether there is any processing headroom or memory access performance constraints.

    #2, my understanding is that passes are effectively the number of times the image is processed. More passes would be like layering multiple shader effects.

    Without much digging I found a guide to OpenGL Shading Language that you might find interesting. I suggest looking for similar resources, as you are basically asking about OpenGL programming details.


  • Global Moderator

    @goodpi31 said in Teach me the basics of using Shaders in Libretro emulators:

    Helloo! Currently I'm experimenting a bit with shader settings. I've read the article on the wiki and searched the forum, but I'm not 100% sure about these questions. If anyone could answer these questions or point me to a related article, it be much appreciated!

    1 Can I use a shader to get a game to run faster?

    no. shaders change each frame after it has been rendered by the emulator. they will only ever slow it down (although the crt-pi shader should be light enough that an RPI3 can do all the operations before the next frame, so no slow anything down)

    2 What exactly are shader passes? Currently I'm using only one..... is that good? Should I use two? or more?

    usually you'd load a shader preset (.glslp) file which has a preset configuration of the number of passes of different shader scripts. don't manually set each pass unless you know exactly what you're doing. a typical 'shader' is a .glslp preset containing one or more passes of one or more shaders.

    3 The default filter setting, what exactly does this do? Linear and nearest?

    again, the glslp file will have the setting for this.

    4 And finally the shader scale? I'm guessing its how big the shader effect looks, but it doesn't seem to visibly change anything with the shaders I've tried?

    again i wouldn't change this :)



  • @dankcushions @caver01 thanks!

    Doh! I completely missed the preset files. Thanks for pointing that out. Those are much more userfriendly. I found one that I like for the SNES but after applying changes and restarting the emulator the changes are gone.

    Do I need to 'save core preset' or 'save game preset' before closing the game? I havent tried it, cause I dont want to f* something up.

    Also, any shader recommendations for the PSX system?


  • Global Moderator

    @goodpi31 instructions for choosing and saving shaders are on the wiki page in the first post :)

    Also, any shader recommendations for the PSX system?

    i use crt-pi for some psx games.



  • @dankcushions got it to work, thanks :D



  • Re. speed gains :
    What about running games at low resolutions, but then using shaders to make it look acceptable? Or do the shaders always run at the emulated resolution?



Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.