GameBoy Shaders?

This topic contains 35 replies, has 11 voices, and was last updated by Profile photo of k4r7u k4r7u 1 year, 6 months ago.

Viewing 35 posts - 1 through 35 (of 36 total)
  • Author
    Posts
  • #90289
    Profile photo of blockaboots
    blockaboots
    Participant

    Is there any shaders that replicate the GB display that dont effect performance on the RPi for the Gameboy emulator?

    #90303
    Profile photo of Roo
    Roo
    Participant

    No. All shaders come with a performance hit. That said, I use the bead shader and an overlay and it runs at full speed, I don’t notice any lagging on a RPi 2 model B. I messed with shaders on the older B+ before the 2 came out and I found that the older Pi’s just didn’t have enough processor power to run the emulator and add shaders on top.

    Here’s my /opt/retropie/configs/gb/retroarch.cfg for 1920 x 1200 resolution

    
    # All settings made here will override the global settings for the current emulator core
    
    video_shader_enable = true
    video_shader = /opt/retropie/emulators/retroarch/shader/bead.glsl
    
    input_overlay_enable = true
    input_overlay = /opt/retropie/emulators/retroarch/overlays/gb.cfg
    input_overlay_opacity = 0.70
    input_overlay_scale = 1.0
    
    aspect_ratio_index = "22"
    custom_viewport_width = "645"
    custom_viewport_height = "648"
    custom_viewport_x = "637"
    custom_viewport_y = "275"
    

    and here’s a cfg that works for 1920 x 1080 (1080p) resolution

    
    # All settings made here will override the global settings for the current emulator core
    
    video_shader_enable = true
    video_shader = /opt/retropie/emulators/retroarch/shader/bead.glsl
    
    input_overlay_enable = true
    input_overlay = /opt/retropie/emulators/retroarch/overlays/gb.cfg
    input_overlay_opacity = 0.70
    input_overlay_scale = 1.0
    
    aspect_ratio_index = "22"
    custom_viewport_width = "642"
    custom_viewport_height = "581"
    custom_viewport_x = "638"
    custom_viewport_y = "248"
    

    I’m using the overlays from http://retroarchborders.blogspot.com

    #90305
    Profile photo of Floob
    Floob
    Member

    Thanks to Roos suggested config, I’ve had a go, and think these overlays look pretty good.
    http://dai.ly/x2is5kt

    Here is my config:

    video_shader_enable = true
    video_shader = /opt/retropie/emulators/retroarch/shader/bead.glsl
    
    input_overlay_enable = true
    input_overlay = /opt/retropie/emulators/retroarch/overlays/gb.cfg
    input_overlay_opacity = 0.70 # 1.0
    input_overlay_scale = 1.0
    
    aspect_ratio_index = "22"
    custom_viewport_width = "432"
    custom_viewport_height = "389"
    custom_viewport_x = "423"
    custom_viewport_y = "165"

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #90329
    Profile photo of Roo
    Roo
    Participant

    Hi floob, haven’t seen you for a while 🙂 nice video!

    #90406
    Profile photo of blockaboots
    blockaboots
    Participant

    is there a way to add the ‘pea green’ colour to the screen though?

    #90411
    Profile photo of Roo
    Roo
    Participant

    I have not found a RetroArch shader in RetroPie that has the puke green color of the original GB.

    On my Windows PC, the RetroArch shader “gb-shader.cgp” is a really nice shader for GB, complete with puke green color. But cgp shaders are not compatible with RetroArch on Pi which uses *.glsl shaders. I read somewhere they can be converted, but it never bothered me enough to spend the time to figure out how.

    Attachments:
    #90433
    Profile photo of Floob
    Floob
    Member

    Hi floob, haven’t seen you for a while :) nice video!

    Thanks, I’ve just extended it.
    Also, looks like conversion steps are here:

    Convert CG Shader to GLSL ?

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #90439
    Profile photo of Roo
    Roo
    Participant

    It is necessary to convert cg shaders to glsl shaders. To do this you need the nvidia cg toolkit. The toolkit is only available for x86 platforms. So you need a ubuntu live cd and a PC to convert a shader.

    If everything is installed download and run cg2glsl.py:

    https://github.com/libretro/RetroArch/blob/master/tools/cg2glsl.py

    Yep – that’s where I read about converting cgp to glsl. I gave up when I saw that it required a Ubuntu x86 desktop 🙂 I figured after a bunch of work, I would just end up with an over-aggressive shader for the Pi’s limited resources.

    I don’t know much about cgp vs glsl…? Is it just the difference between linux and windows retroarch installations?

    Edit – I see now. glsl is the standard for arm-based libretro

    http://emulation-general.wikia.com/wiki/Shaders_and_Filters

    #90491
    Profile photo of gizmo98
    gizmo98
    Participant
    #90527
    Profile photo of Roo
    Roo
    Participant

    Surprise surprise!

    https://github.com/retropie/RetroPie-Setup/pull/722

    That’s awesome gizmo98, thanks for converting them all!

    I downloaded them to my pi, set owner and group to pi, set them all as executable, and pointed RA to them. Some work, some don’t.

    For example, I updated /opt/retropie/configs/all/retroarch.cfg
    video_shader_dir = /opt/retropie/emulators/retroarch/convertedshaders

    And /opt/retropie/configs/gb/retroarch.cfg
    video_shader = /opt/retropie/emulators/retroarch/convertedshaders/handheld/gameboy/gb-shader.glslp

    But when I launch RA, I get this:

    pi@retropie ~ $ /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/gbclibretro/gambatte_libretro.so --config /opt/retropie/configs/all/retroarch.cfg --appendconfig /opt/retropie/configs/gb/retroarch.cfg "/home/pi/RetroPie/roms/gb/Tetris (World) (Rev A).gb"
    RetroArch: rarch_log_libretro: [libretro INFO] :: Plain ROM loaded.
    RetroArch: rarch_log_libretro: [libretro INFO] :: cgb: 0
    RetroArch: rarch_log_libretro: [libretro INFO] :: rambanks: 0
    RetroArch: rarch_log_libretro: [libretro INFO] :: rombanks: 2
    RetroArch: rarch_log_libretro: [libretro INFO] :: [Gambatte]: Got internal game name: TETRIS.
    RetroArch [ERROR] :: compile_program :: Failed to link program #0.
    RetroArch [ERROR] :: compile_programs :: Failed to create GL program #0.
    RetroArch [ERROR] :: gl_shader_init :: [GL]: Failed to initialize shader, falling back to stock.
    RetroArch [WARN] :: gl_glsl_init :: [GL]: Stock GLSL shaders will be used.
    

    Maybe I’m missing something? But I’m thinking the convert script didn’t work on this one… I looked at the glsl code, but I don’t see anything that stands out. I’m a pretty noob programmer though.

    So close! I’m really hoping we can all work together to figure this out 🙂 RetroPie would rock with some nicer shaders!

    #90529
    Profile photo of gizmo98
    gizmo98
    Participant

    Some do not work because the raspy gpu is not capable. I strongly recommend using RGUI for shader experiments because ini file editing takes too long.

    I have tested some blur, eagle, sai, pixilation and crt shaders. Only some gameboy shaders are running fine.

    #90533
    Profile photo of Roo
    Roo
    Participant

    It’s actually much easier and faster for me to modify the cfg files 🙂 To each their own.

    Just FYI, there was some issue with finding the files before. I was able to get around that by pointing RA directly to the full path. Here’s where I’m at now.

    /opt/retropie/configs/gb/retroarch.cfg

    # All settings made here will override the global settings for the current emulator core
    
    video_shader_enable = true
    video_shader_dir = /opt/retropie/emulators/retroarch/convertedshaders/handheld/gameboy
    video_shader = gb-shader.glslp
    

    and when I launch RA i get this

    pi@retropie ~ $ /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/gbclibretro/gambatte_libretro.so --config /opt/retropie/configs/all/retroarch.cfg --appendconfig /opt/retropie/configs/gb/retroarch.cfg "/home/pi/RetroPie/roms/gb/Tetris (World) (Rev A).gb"
    RetroArch: rarch_log_libretro: [libretro INFO] :: Plain ROM loaded.
    RetroArch: rarch_log_libretro: [libretro INFO] :: cgb: 0
    RetroArch: rarch_log_libretro: [libretro INFO] :: rambanks: 0
    RetroArch: rarch_log_libretro: [libretro INFO] :: rombanks: 2
    RetroArch: rarch_log_libretro: [libretro INFO] :: [Gambatte]: Got internal game name: TETRIS.
    RetroArch [ERROR] :: gl_glsl_init :: [GL]: Failed to parse GLSL shader.
    RetroArch [ERROR] :: gl_shader_init :: [GL]: Failed to initialize shader, falling back to stock.
    RetroArch [WARN] :: gl_glsl_init :: [GL]: Stock GLSL shaders will be used.
    

    I still say the conversion script didn’t work on this shader due to “gl_glsl_init :: [GL]: Failed to parse GLSL shader.”

    Some do not work because the raspy gpu is not capable. … I have tested some blur, eagle, sai, pixilation and crt shaders. Only some gameboy shaders are running fine.

    Have you got any of the converted multipass shaders to work (glslp vs glsl)? I’ve only spot checked a few, but I have yet to see any of these working.

    #90539
    Profile photo of Roo
    Roo
    Participant

    ok, I’ve hacked up a solution

    I found that convertedshaders/handheld/gameboy/shader-files/gb-pass-1.glsl through 4 were working. gb-pass-0.glsl is the one that gives RA fits.

    According to the author’s git page https://github.com/HarlequinVG/shaders/tree/master/gameboy_shader, pass 0 is for the dot-matrix screen of the GameBoy.

    Then I noticed that convertedshaders/handheld/dot.glsl was working 🙂 So I substituted dot.glsl for gb-pass-0.glsl as the 1st pass in gb-shader.glslp

    I’ve attached my files for anyone who likes the results. Copy “dot.glsl” and “gb-shader.glslp” from the attached zip to /opt/retropie/emulators/retroarch/shader (overwrite the originals), set the files as executable, and change owner and group to pi.

    Then with this /opt/retropie/configs/gb/retroarch.cfg you should be set

    # All settings made here will override the global settings for the current emulator core
    
    video_shader_enable = true
    video_shader = /opt/retropie/emulators/retroarch/shader/gb-shader.glslp
    
    input_overlay_enable = true
    input_overlay = /opt/retropie/emulators/retroarch/overlays/gb.cfg
    input_overlay_opacity = 0.70
    input_overlay_scale = 1.0
    
    aspect_ratio_index = "22"
    custom_viewport_width = "642"
    custom_viewport_height = "581"
    custom_viewport_x = "638"
    custom_viewport_y = "248"
    

    The picture doesn’t do it justice. It a nice simulated dot matrix grid pattern with a lovely puke green color.

    [edit] after some more testing, I’ve noticed it does lag a bit… 🙁

    Attachments:
    1. gbshader.zip
    #90559
    Profile photo of Floob
    Floob
    Member

    Thanks so much for the conversions! I’ve put an updated video up here (on a B+):
    http://dai.ly/x2ixtdp

    I played about with the setup a bit as I’ve only pulled down the shaders I was after, I’m not too sure this would be straightforward for some users though.

    I think the easiest way would be to follow Roos instructions above (and use his edited files), although I think you will also need to get the 4 shader files (not 0) here https://github.com/gizmo98/RetroPie-Setup/tree/7fa6d471361ff882bcfb2bdc11e20e4b438ef064/supplementary/RetroArchShader/handheld/gameboy/shader-files

    As well as putting the 2 png files here in your working (shader) directory:
    https://github.com/gizmo98/RetroPie-Setup/tree/7fa6d471361ff882bcfb2bdc11e20e4b438ef064/supplementary/RetroArchShader/handheld/gameboy/resources

    Did you test yours on a Pi2 Roo?
    It seems the framerate drops from 60 to 30 when the gb-shader is used (on a B+ at High overclock).

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #90570
    Profile photo of Roo
    Roo
    Participant

    Yes, Pi 2 model B, overclocked to “Pi2” setting. It’s lagging just enough to be annoying. Can you see it in this comparison?

    #90572
    Profile photo of Floob
    Floob
    Member

    Yes, it does seem a little sluggish. Can you turn the FPS monitor on via RGUI? Does it differ from 30fps on the gb-shader ?

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #90573
    Profile photo of Roo
    Roo
    Participant

    I dunno what secret sauce you’re pouring on your Pi B+…

    I’m getting around 45 FPS with just dot.glsl and around 13 FPS with gb-shader.glslp on a Pi2 OC’d to Pi2 setting

    #90592
    Profile photo of blockaboots
    blockaboots
    Participant

    Great work!!. If anyone interested I’ve made numerous GB, GBC and GBA system overlays from pictures found on the web, I’ll upload them later

    #90608
    Profile photo of Floob
    Floob
    Member

    Great work!!. If anyone interested I’ve made numerous GB, GBC and GBA system overlays from pictures found on the web, I’ll upload them later

    Would be good to see those, the handhelds do look good with these overlays.
    Even if it does seem to open a can of worms about exactly what resolution these should be played in 🙂

    I used these that Roo pointed to:
    http://retroarchborders.blogspot.com/

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #90639
    Profile photo of blockaboots
    blockaboots
    Participant
    #90669
    Profile photo of Floob
    Floob
    Member

    Here you go

    https://www.dropbox.com/s/xqd4crkihlpfidl/Nintendo%20Handhelds.rar?dl=0

    They look great, thanks very much.

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #90792
    Profile photo of koffieleut
    koffieleut
    Participant

    I just can’t get the shader to work.
    I followed everything on this topic, used all the files and edited my gb cfg file.

    cfg file:

    video_shader_enable = true
    video_shader = /opt/retropie/emulators/retroarch/shader/gb-shader.glslp

    input_overlay_enable = true
    input_overlay = /opt/retropie/emulators/retroarch/overlays/gb.cfg
    input_overlay_opacity = 0.70
    input_overlay_scale = 1.0

    aspect_ratio_index = “22”
    custom_viewport_width = “642”
    custom_viewport_height = “581”
    custom_viewport_x = “638”
    custom_viewport_y = “248”

    here is the gb-shader.glslp file:

    shaders = 5
    shader0 = shader-files/dot.glsl
    shader1 = shader-files/gb-pass-1.glsl
    shader2 = shader-files/gb-pass-2.glsl
    shader3 = shader-files/gb-pass-3.glsl
    shader4 = shader-files/gb-pass-4.glsl

    scale_type0 = viewport
    scale0 = 1

    scale_type1 = source
    scale1 = 1

    scale_type2 = source
    scale2 = 1

    scale_type3 = source
    scale3 = 1

    scale_type4 = source
    scale4 = 1

    filter_linear0 = false
    filter_linear1 = false
    filter_linear2 = false
    filter_linear3 = false
    filter_linear4 = false

    textures = COLOR_PALETTE;BACKGROUND
    COLOR_PALETTE = resources/palette.png
    COLOR_PALETTE_linear = false
    BACKGROUND = resources/background.png
    BACKGROUND_linear = true

    I store my shaders in opt/retropie/emulators/retroarch/shader/
    also in opt/retropie/emulators/retroarch/shader/shader-files/

    In both those folders are the png files and also in
    opt/retropie/emulators/retroarch/shader/resources/

    If I just change the shader in the gb cfg file to dot.glsl it works but without the green color. I tried changing the shader option in the emulator itself by pressing hotkey + F1 > options > shaders, but that doesn’t do a thing.

    I use a RPI1 model b

    Please help me.

    Cheers

    #90811
    Profile photo of Floob
    Floob
    Member

    Do these files and paths exist for you – as they are referenced in your file above?

    shader-files/gb-pass-1.glsl (etc..)
    resources/palette.png
    resources/background.png

    It could be easier for you to drop the paths above and just put the files in the same directory.

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #90824
    Profile photo of koffieleut
    koffieleut
    Participant

    Yes they all exist, another problem is when booted up a gameboy rom with the border on Retroarch keeps those settings for the other roms like Nes roms display in the bottom right corner of my tv screen until I change the ratio within retroarch.

    Fixed the palette problem, but it can’t open the background.png strangely enough they are in the same folder.

    Fixed2 ratio issue: forgot to put save per core on enable :s

    #90902
    Profile photo of Floob
    Floob
    Member

    Where you state your “cfg file:” file above, that should be

    /opt/retropie/configs/gb/retroarch.cfg
    Is that where you have put the entries?

    Make sure the user pi has access to the files mentioned above as well.

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #91003
    Profile photo of koffieleut
    koffieleut
    Participant

    the shaders are in /opt/retropie/emulators/retroarch/shader
    and the retroarch.cfg is in the folder you have mentiont above.

    Can someone upload the background.png again?
    It seems that some files will work and some don’t as in the palette.png wokrs but other palette files like dmg-palette-1.png doesn’t work.

    #91010
    Profile photo of Floob
    Floob
    Member

    You can grab the images you need here:
    https://github.com/libretro/common-shaders/tree/master/handheld/gameboy/resources

    RetroPie help guides --> https://goo.gl/Yfy8kj
    Please read this before asking for help --> http://goo.gl/eLErnl

    #91178
    Profile photo of muriani
    muriani
    Participant

    Whooowee, wish I’d found this thread a couple of days ago.
    I also did a manual conversion of the shaders and posted a .tar.gz here: http://www.kf5rsx.com/retroarch-quick-glsl-shader-recompile/
    It’s basically the exact same thing gizmo93 put up on github, whoo!

    I’ll have to look closer at all this later, I’m really interested in getting good GB shaders too, as well as GBC. lcd-shader is ok, but looks better for something like Game Gear instead of GB/GBC IMO.

    #99833
    Profile photo of footwo
    footwo
    Participant

    Fixed the palette problem, but it can’t open the background.png strangely enough they are in the same folder.

    Sorry for necroing this thread but this has been driving me mad for two hours now. How did you fix the palette problem? No matter what I try I cannot get the colour to work. I’m using the modified files from roo above, but changed for my own purposes, plus i’ve made sure all the paths are correct and the palette.png file is in the right place. No matter what, when I start I get errors in the runcommand log:

    RetroArch: rarch_log_libretro: [libretro INFO] :: [Gambatte]: Got internal game name: WIZARDS WARRIORS.
    RetroArch [WARN] :: resolve_extensions :: [GL]: GLES implementation does not have BGRA8888 extension.
    32-bit path will require conversion.
    RetroArch [ERROR] :: compile_program :: Failed to link program #1.
    RetroArch [ERROR] :: compile_programs :: Failed to create GL program #1.
    RetroArch [ERROR] :: gl_shader_init :: [GL]: Failed to initialize shader, falling back to stock.
    RetroArch [WARN] :: gl_glsl_init :: [GL]: Stock GLSL shaders will be used.
    RetroArch [WARN] :: resolve_extensions :: [GL]: GLES implementation does not have BGRA8888 extension.
    32-bit path will require conversion.
    RetroArch [ERROR] :: compile_program :: Failed to link program #1.
    RetroArch [ERROR] :: compile_programs :: Failed to create GL program #1.
    RetroArch [ERROR] :: gl_shader_init :: [GL]: Failed to initialize shader, falling back to stock.
    RetroArch [WARN] :: gl_glsl_init :: [GL]: Stock GLSL shaders will be used.

    this is on retropie 3.0 BETA 3 on a pi2, using the stock emulator choice for gb.

    Can anyone assist?

    #99866
    Profile photo of footwo
    footwo
    Participant

    nvm fixed it.

    on 3.0 beta 3 its just a matter of copying dot.glsl into /shader-files and then editing the gb-shader.glslp thusly:

    shader0 = shader-files/dot.glsl
    

    then set your shader as normal in retroarch.cfg, or using the in-emu retroarch gui menu.

    Attachments:
    #100868
    Profile photo of blockaboots
    blockaboots
    Participant

    How do you get glslp shader config to work with RetroPie??, i select ‘load shader preset’ and then select the glslp shader but nothing happens?

    #109407
    Profile photo of LodanZark
    LodanZark
    Participant

    How do you get glslp shader config to work with RetroPie??, i select ‘load shader preset’ and then select the glslp shader but nothing happens?

    Yeah 🙁 I am having the same issue

    Overlays/Pillarboxs and other goodies for Retropie:
    https://www.dropbox.com/sh/3a7ylhwy3an2xrl/AAD-dOH-BXGuBrl6zphmJvyYa?dl=0

    #109766
    Profile photo of gizmo98
    gizmo98
    Participant

    @lodanzark
    Update retroarch. There is a gameboy shader in the main shader directory now.

    #109816
    Profile photo of dustloop
    dustloop
    Participant

    For those having issues setting it up or not getting it working, I discovered last night in the QUICK MENU and CORE SETTINGS that in lr-gambette you can emulate GameBoy colors without shaders and still achieve practically the same effect of the muddy green color which is all I wanted and now I have achieved it 😀

    #111004
    Profile photo of Dinofly
    Dinofly
    Participant

    Hi,

    Thanks for all the informations you provided in this topic. This was driving me mad for two weeks. But i’m curious: why bother including shaders in the Retropie distribution that are known to be crashing on the Raspberry Pi and Pi 2 ?
    Couldn’t we just remove all the useless and misleading shaders that we cannot use ?

Viewing 35 posts - 1 through 35 (of 36 total)

Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/

Skip to toolbar