├── README.md ├── RGC overlays ├── Jeltron_CRT.cfg ├── Jeltron_CRT.png ├── Jeltron_GB-Color.cfg ├── Jeltron_GB-Color.png ├── Jeltron_GB-DMG.cfg ├── Jeltron_GB-DMG.png ├── Jeltron_GBA.cfg ├── Jeltron_GBA.png ├── Perfect_GB-DMG.cfg ├── Perfect_GB-DMG.png ├── Perfect_GBA.cfg ├── Perfect_GBA.png ├── Perfect_GBC.cfg ├── Perfect_GBC.png └── README.txt ├── RGC palettes ├── README.txt └── palettes │ └── default.pal └── RGC shaders ├── README.txt ├── shaders_glsl ├── crt-1tap.glslp ├── shaders │ ├── crt-1tap.glsl │ ├── sharp-shimmerless.glsl │ └── zfast_crt_geo_svideo.glsl ├── sharp-shimmerless.glslp └── zfast_crt_geo_svideo.glslp └── shaders_slang ├── shaders └── sharp-shimmerless.slang └── sharp-shimmerless.slangp /README.md: -------------------------------------------------------------------------------- 1 | # RGC Overlay Pack 2 | A collection of 4:3 480p friendly shaders, palettes, and overlays 3 | 4 | These files were authored by and collected from the following repositories: 5 | 6 | Shimmerless shaders: https://github.com/Woohyun-Kang/Sharp-Shimmerless-Shader
7 | CRT shaders: https://github.com/libretro/glsl-shaders/tree/master/crt/shaders
8 | Jeltron overlays: https://github.com/Jeltr0n/Retro-Overlays
9 | Perfect overlays and palette from mugwomp93: https://github.com/mugwomp93/muOS_Customization 10 | 11 | Thanks to the original authors! These are compiled as part of the Retro Game Corps Shaders and Overlays guide, which you can find here: https://retrogamecorps.com/2024/09/01/guide-shaders-and-overlays-on-retro-handhelds/ 12 | 13 | Please consult that guide for installation instructions. 14 | -------------------------------------------------------------------------------- /RGC overlays/Jeltron_CRT.cfg: -------------------------------------------------------------------------------- 1 | overlay0_overlay = Jeltron_CRT.png 2 | overlay0_descs = "0" 3 | overlay0_full_screen = "true" 4 | overlay0_name = "overlay0" 5 | overlay0_normalized = "true" 6 | overlays = "1" -------------------------------------------------------------------------------- /RGC overlays/Jeltron_CRT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retrogamecorps/RGC-Overlay-Pack/df00c955f4055d558bb0bfef1125954dbb3b8de9/RGC overlays/Jeltron_CRT.png -------------------------------------------------------------------------------- /RGC overlays/Jeltron_GB-Color.cfg: -------------------------------------------------------------------------------- 1 | overlay0_overlay = Jeltron_GB-Color.png 2 | overlay0_descs = "0" 3 | overlay0_full_screen = "true" 4 | overlay0_name = "overlay0" 5 | overlay0_normalized = "true" 6 | overlays = "1" -------------------------------------------------------------------------------- /RGC overlays/Jeltron_GB-Color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retrogamecorps/RGC-Overlay-Pack/df00c955f4055d558bb0bfef1125954dbb3b8de9/RGC overlays/Jeltron_GB-Color.png -------------------------------------------------------------------------------- /RGC overlays/Jeltron_GB-DMG.cfg: -------------------------------------------------------------------------------- 1 | overlay0_overlay = Jeltron_GB-DMG.png 2 | overlay0_descs = "0" 3 | overlay0_full_screen = "true" 4 | overlay0_name = "overlay0" 5 | overlay0_normalized = "true" 6 | overlays = "1" -------------------------------------------------------------------------------- /RGC overlays/Jeltron_GB-DMG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retrogamecorps/RGC-Overlay-Pack/df00c955f4055d558bb0bfef1125954dbb3b8de9/RGC overlays/Jeltron_GB-DMG.png -------------------------------------------------------------------------------- /RGC overlays/Jeltron_GBA.cfg: -------------------------------------------------------------------------------- 1 | overlay0_overlay = Jeltron_GBA.png 2 | overlay0_descs = "0" 3 | overlay0_full_screen = "true" 4 | overlay0_name = "overlay0" 5 | overlay0_normalized = "true" 6 | overlays = "1" -------------------------------------------------------------------------------- /RGC overlays/Jeltron_GBA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retrogamecorps/RGC-Overlay-Pack/df00c955f4055d558bb0bfef1125954dbb3b8de9/RGC overlays/Jeltron_GBA.png -------------------------------------------------------------------------------- /RGC overlays/Perfect_GB-DMG.cfg: -------------------------------------------------------------------------------- 1 | overlay0_overlay = Perfect_GB-DMG.png 2 | overlay0_descs = "0" 3 | overlay0_full_screen = "true" 4 | overlay0_name = "overlay0" 5 | overlay0_normalized = "true" 6 | overlays = "1" 7 | -------------------------------------------------------------------------------- /RGC overlays/Perfect_GB-DMG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retrogamecorps/RGC-Overlay-Pack/df00c955f4055d558bb0bfef1125954dbb3b8de9/RGC overlays/Perfect_GB-DMG.png -------------------------------------------------------------------------------- /RGC overlays/Perfect_GBA.cfg: -------------------------------------------------------------------------------- 1 | overlay0_overlay = Perfect_GBA.png 2 | overlay0_descs = "0" 3 | overlay0_full_screen = "true" 4 | overlay0_name = "overlay0" 5 | overlay0_normalized = "true" 6 | overlays = "1" -------------------------------------------------------------------------------- /RGC overlays/Perfect_GBA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retrogamecorps/RGC-Overlay-Pack/df00c955f4055d558bb0bfef1125954dbb3b8de9/RGC overlays/Perfect_GBA.png -------------------------------------------------------------------------------- /RGC overlays/Perfect_GBC.cfg: -------------------------------------------------------------------------------- 1 | overlay0_overlay = Perfect_GBC.png 2 | overlay0_descs = "0" 3 | overlay0_full_screen = "true" 4 | overlay0_name = "overlay0" 5 | overlay0_normalized = "true" 6 | overlays = "1" 7 | -------------------------------------------------------------------------------- /RGC overlays/Perfect_GBC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retrogamecorps/RGC-Overlay-Pack/df00c955f4055d558bb0bfef1125954dbb3b8de9/RGC overlays/Perfect_GBC.png -------------------------------------------------------------------------------- /RGC overlays/README.txt: -------------------------------------------------------------------------------- 1 | These overlays are derived from the following community products: 2 | 3 | From mugwomp93 (adapted from 1playerinsertcoin): 4 | 5 | https://github.com/mugwomp93/muOS_Customization 6 | 7 | Perfect_GBA_bright_75_mugwomp93 8 | Perfect_GBC_RG35XX_mugwomp93 9 | Perfect_DMG-EX_RG35XX_mugwomp93 10 | 11 | From Jeltron: 12 | 13 | https://github.com/Jeltr0n/Retro-Overlays 14 | 15 | CRT 16 | GB_Color 17 | GB_DMG 18 | GBA_3x_Grid_25 19 | -------------------------------------------------------------------------------- /RGC palettes/README.txt: -------------------------------------------------------------------------------- 1 | This custom palette was derived from mugwomp93's overlay pack (adapted from 1playerinsertcoin): 2 | 3 | https://github.com/mugwomp93/muOS_Customization 4 | -------------------------------------------------------------------------------- /RGC palettes/palettes/default.pal: -------------------------------------------------------------------------------- 1 | [General] 2 | Background0=7723638 3 | Background1=2662284 4 | Background2=421260 5 | Background3=16005 6 | Sprite%2010=7723638 7 | Sprite%2011=2662284 8 | Sprite%2012=421260 9 | Sprite%2013=16005 10 | Sprite%2020=7723638 11 | Sprite%2021=2662284 12 | Sprite%2022=421260 13 | Sprite%2023=16005 -------------------------------------------------------------------------------- /RGC shaders/README.txt: -------------------------------------------------------------------------------- 1 | These shaders are derived from the following community products: 2 | 3 | From Woohyun-Kang: 4 | 5 | https://github.com/Woohyun-Kang/Sharp-Shimmerless-Shader 6 | 7 | sharp-shimmerless (GLSL and SLANG) 8 | 9 | From RetroArch: 10 | 11 | https://github.com/libretro/glsl-shaders/tree/master/crt/shaders 12 | 13 | crt-1tap 14 | zfast_crt_geo_svideo 15 | 16 | Chances are these shaders are installed on your device already, but I noticed they weren't installed on muOS by default. The crt-1tap is a nice subtle CRT effect, whereas the zfast-crt-geo-svideo is much more dramatic. -------------------------------------------------------------------------------- /RGC shaders/shaders_glsl/crt-1tap.glslp: -------------------------------------------------------------------------------- 1 | shaders = "1" 2 | shader0 = "shaders/crt-1tap.glsl" 3 | filter_linear0 = "true" 4 | wrap_mode0 = "clamp_to_border" 5 | mipmap_input0 = "false" 6 | alias0 = "" 7 | float_framebuffer0 = "true" 8 | srgb_framebuffer0 = "false" 9 | -------------------------------------------------------------------------------- /RGC shaders/shaders_glsl/shaders/crt-1tap.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | crt-1tap v1.0 by fishku 3 | Copyright (C) 2023 4 | Ported by dariusg to GLSL 5 | Public domain license (CC0) 6 | 7 | Extremely fast and lightweight dynamic scanline shader. 8 | Contrasty and sharp output. Easy to configure. 9 | Can be combined with other shaders. 10 | 11 | How it works: Uses a single texture "tap" per pixel, hence the name. 12 | Exploits bilinear interpolation plus local coordinate distortion to shape 13 | the scanline. A pseudo-sigmoid function with a configurable slope at the 14 | inflection point is used to control horizontal smoothness. 15 | Uses a clamped linear function to anti-alias the edge of the scanline while 16 | avoiding further branching. The final thickness is shaped with a gamma-like 17 | operation to control overall image contrast. 18 | The scanline subpixel position can be controlled to achieve the best 19 | sharpness and uniformity of the output given different input sizes, e.g., 20 | for even and odd integer scaling. 21 | 22 | Changelog: 23 | v1.2: Better scanline sharpness; Minor cleanups. 24 | v1.1: Update license; Better defaults; Don't compute alpha. 25 | v1.0: Initial release. 26 | */ 27 | 28 | // clang-format off 29 | #pragma parameter CRT1TAP_SETTINGS "=== CRT-1tap v1.2 settings ===" 0.0 0.0 1.0 1.0 30 | #pragma parameter MIN_THICK "Scanline thickness of dark pixels" 0.3 0.0 1.4 0.05 31 | #pragma parameter MAX_THICK "Scanline thickness of bright pixels" 0.9 0.0 1.4 0.05 32 | #pragma parameter V_SHARP "Vertical sharpness of the scanline" 0.5 0.0 1.0 0.05 33 | #pragma parameter H_SHARP "Horizontal sharpness of pixel transitions" 0.15 0.0 1.0 0.05 34 | #pragma parameter SUBPX_POS "Scanline subpixel position" 0.3 -0.5 0.5 0.01 35 | #pragma parameter THICK_FALLOFF "Reduction / increase of thinner scanlines" 0.65 0.2 2.0 0.05 36 | 37 | 38 | #if defined(VERTEX) 39 | 40 | #if __VERSION__ >= 130 41 | #define COMPAT_VARYING out 42 | #define COMPAT_ATTRIBUTE in 43 | #define COMPAT_TEXTURE texture 44 | #else 45 | #define COMPAT_VARYING varying 46 | #define COMPAT_ATTRIBUTE attribute 47 | #define COMPAT_TEXTURE texture2D 48 | #endif 49 | 50 | #ifdef GL_ES 51 | #define COMPAT_PRECISION mediump 52 | #else 53 | #define COMPAT_PRECISION 54 | #endif 55 | 56 | COMPAT_ATTRIBUTE vec4 VertexCoord; 57 | COMPAT_ATTRIBUTE vec4 COLOR; 58 | COMPAT_ATTRIBUTE vec4 TexCoord; 59 | COMPAT_VARYING vec4 COL0; 60 | COMPAT_VARYING vec4 TEX0; 61 | 62 | 63 | uniform mat4 MVPMatrix; 64 | uniform COMPAT_PRECISION vec2 OutputSize; 65 | uniform COMPAT_PRECISION vec2 TextureSize; 66 | uniform COMPAT_PRECISION vec2 InputSize; 67 | 68 | // vertex compatibility #defines 69 | #define vTexCoord TEX0.xy 70 | #define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize 71 | #define outsize vec4(OutputSize, 1.0 / OutputSize) 72 | 73 | uniform sampler2D Texture; 74 | 75 | void main() 76 | { 77 | gl_Position = MVPMatrix * VertexCoord; 78 | COL0 = COLOR; 79 | TEX0.xy = TexCoord.xy*1.0001; 80 | } 81 | 82 | #elif defined(FRAGMENT) 83 | 84 | #if __VERSION__ >= 130 85 | #define COMPAT_VARYING in 86 | #define COMPAT_TEXTURE texture 87 | out vec4 FragColor; 88 | #else 89 | #define COMPAT_VARYING varying 90 | #define FragColor gl_FragColor 91 | #define COMPAT_TEXTURE texture2D 92 | #endif 93 | 94 | #ifdef GL_ES 95 | #ifdef GL_FRAGMENT_PRECISION_HIGH 96 | precision highp float; 97 | #else 98 | precision mediump float; 99 | #endif 100 | #define COMPAT_PRECISION mediump 101 | #else 102 | #define COMPAT_PRECISION 103 | #endif 104 | 105 | uniform COMPAT_PRECISION int FrameDirection; 106 | uniform COMPAT_PRECISION int FrameCount; 107 | uniform COMPAT_PRECISION vec2 OutputSize; 108 | uniform COMPAT_PRECISION vec2 TextureSize; 109 | uniform COMPAT_PRECISION vec2 InputSize; 110 | uniform sampler2D Texture; 111 | COMPAT_VARYING vec4 TEX0; 112 | 113 | // compatibility #defines 114 | #define Source Texture 115 | #define vTexCoord TEX0.xy 116 | #define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize 117 | #define outsize vec4(OutputSize, 1.0 / OutputSize) 118 | 119 | 120 | #ifdef PARAMETER_UNIFORM 121 | // All parameter floats need to have COMPAT_PRECISION in front of them 122 | uniform COMPAT_PRECISION float MIN_THICK; 123 | uniform COMPAT_PRECISION float MAX_THICK; 124 | uniform COMPAT_PRECISION float V_SHARP; 125 | uniform COMPAT_PRECISION float H_SHARP; 126 | uniform COMPAT_PRECISION float SUBPX_POS; 127 | uniform COMPAT_PRECISION float THICK_FALLOFF; 128 | #else 129 | #define MIN_THICK 0.3 130 | #define MAX_THICK 0.9 131 | #define V_SHARP 0.5 132 | #define H_SHARP 0.15 133 | #define SUBPX_POS 0.3 134 | #define THICK_FALLOFF 0.65 135 | #endif 136 | 137 | 138 | void main() { 139 | 140 | vec2 cent = vTexCoord*SourceSize.xy; 141 | float src_x_fract = fract(cent.x - 0.5); 142 | float src_x_int = floor(cent.x-0.5); 143 | 144 | float src_y_fract = fract(cent.y - SUBPX_POS) -0.5; 145 | float src_y_int = floor (cent.y - SUBPX_POS); 146 | 147 | // Function similar to smoothstep and sigmoid. 148 | float s = sign(src_x_fract - 0.5); 149 | float o = (1.0 + s) * 0.5; 150 | float src_x = src_x_int + o - 0.5 * s * pow(2.0 * (o - s * src_x_fract), mix(1.0, 6.0, H_SHARP)); 151 | 152 | vec3 signal = COMPAT_TEXTURE(Source, vec2((src_x + 0.5) * SourceSize.z, (src_y_int + 0.5) * SourceSize.w)).rgb; 153 | 154 | // Vectorize operations for speed. 155 | float eff_v_sharp = 3.0 + 50.0 * V_SHARP * V_SHARP; 156 | vec3 thickmin = vec3(MIN_THICK); vec3 thickmax = vec3(MAX_THICK); vec3 thickfall = vec3(THICK_FALLOFF); 157 | vec3 radius = pow(mix(thickmin, thickmax, signal), thickfall) * 0.5; 158 | 159 | FragColor.rgb = signal * clamp(0.25 - eff_v_sharp * (src_y_fract * src_y_fract - radius * radius),0.0, 1.0); 160 | } 161 | #endif 162 | -------------------------------------------------------------------------------- /RGC shaders/shaders_glsl/shaders/sharp-shimmerless.glsl: -------------------------------------------------------------------------------- 1 | /* 2 | * sharp-shimmerless 3 | * Author: zadpos 4 | * License: Public domain 5 | * 6 | * A retro gaming shader for sharpest pixels with no aliasing/shimmering. 7 | * Instead of pixels as point samples, this shader considers pixels as 8 | * ideal rectangles forming a grid, and interpolates pixel by calculating 9 | * the surface area an input pixel would occupy on an output pixel. 10 | */ 11 | 12 | #if defined(VERTEX) 13 | 14 | #if __VERSION__ >= 130 15 | #define COMPAT_VARYING out 16 | #define COMPAT_ATTRIBUTE in 17 | #define COMPAT_TEXTURE texture 18 | #else 19 | #define COMPAT_VARYING varying 20 | #define COMPAT_ATTRIBUTE attribute 21 | #define COMPAT_TEXTURE texture2D 22 | #endif 23 | 24 | #ifdef GL_ES 25 | #define COMPAT_PRECISION mediump 26 | #else 27 | #define COMPAT_PRECISION 28 | #endif 29 | 30 | COMPAT_ATTRIBUTE vec4 VertexCoord; 31 | COMPAT_ATTRIBUTE vec4 COLOR; 32 | COMPAT_ATTRIBUTE vec4 TexCoord; 33 | COMPAT_VARYING vec4 COL0; 34 | COMPAT_VARYING vec4 TEX0; 35 | 36 | uniform mat4 MVPMatrix; 37 | uniform COMPAT_PRECISION int FrameDirection; 38 | uniform COMPAT_PRECISION int FrameCount; 39 | uniform COMPAT_PRECISION vec2 OutputSize; 40 | uniform COMPAT_PRECISION vec2 TextureSize; 41 | uniform COMPAT_PRECISION vec2 InputSize; 42 | 43 | void main() 44 | { 45 | gl_Position = MVPMatrix * VertexCoord; 46 | COL0 = COLOR; 47 | TEX0.xy = TexCoord.xy; 48 | } 49 | 50 | #elif defined(FRAGMENT) 51 | 52 | #if __VERSION__ >= 130 53 | #define COMPAT_VARYING in 54 | #define COMPAT_TEXTURE texture 55 | out vec4 FragColor; 56 | #else 57 | #define COMPAT_VARYING varying 58 | #define FragColor gl_FragColor 59 | #define COMPAT_TEXTURE texture2D 60 | #endif 61 | 62 | #ifdef GL_ES 63 | #ifdef GL_FRAGMENT_PRECISION_HIGH 64 | precision highp float; 65 | #else 66 | precision mediump float; 67 | #endif 68 | #define COMPAT_PRECISION mediump 69 | #else 70 | #define COMPAT_PRECISION 71 | #endif 72 | 73 | uniform COMPAT_PRECISION int FrameDirection; 74 | uniform COMPAT_PRECISION int FrameCount; 75 | uniform COMPAT_PRECISION vec2 OutputSize; 76 | uniform COMPAT_PRECISION vec2 TextureSize; 77 | uniform COMPAT_PRECISION vec2 InputSize; 78 | uniform sampler2D Texture; 79 | COMPAT_VARYING vec4 TEX0; 80 | 81 | void main() 82 | { 83 | vec2 pixel = TEX0.xy * OutputSize * TextureSize / InputSize; 84 | vec2 pixel_floored = floor(pixel); 85 | vec2 pixel_ceiled = ceil(pixel); 86 | vec2 scale = OutputSize / InputSize.xy; 87 | vec2 invscale = InputSize.xy / OutputSize; 88 | vec2 texel_floored = floor(invscale * pixel_floored); 89 | vec2 texel_ceiled = floor(invscale * pixel_ceiled); 90 | 91 | vec2 mod_texel; 92 | 93 | if (texel_floored.x == texel_ceiled.x) { 94 | // The square-pixel lies "completely in" a single column of square-texel 95 | mod_texel.x = texel_ceiled.x + 0.5; 96 | } else { 97 | // The square-pixel lies across two neighboring columns and must be interpolated 98 | mod_texel.x = texel_ceiled.x + 0.5 - (scale.x * texel_ceiled.x - pixel_floored.x); 99 | } 100 | 101 | if (texel_floored.y == texel_ceiled.y) { 102 | // The square-pixel lies "completely in" a single row of square-texel 103 | mod_texel.y = texel_ceiled.y + 0.5; 104 | } else { 105 | // The square-pixel lies across two neighboring rows and must be interpolated 106 | mod_texel.y = texel_ceiled.y + 0.5 - (scale.y * texel_ceiled.y - pixel_floored.y); 107 | } 108 | 109 | FragColor = vec4(COMPAT_TEXTURE(Texture, mod_texel / TextureSize).rgb, 1.0); 110 | } 111 | #endif 112 | -------------------------------------------------------------------------------- /RGC shaders/shaders_glsl/shaders/zfast_crt_geo_svideo.glsl: -------------------------------------------------------------------------------- 1 | #version 110 2 | 3 | /* 4 | zfast_crt_geo_svideo - A simple, fast CRT shader. 5 | 6 | Copyright (C) 2017 Greg Hogan (SoltanGris42) 7 | Copyright (C) 2023 Jose Linares (Dogway) 8 | 9 | This program is free software; you can redistribute it and/or modify it 10 | under the terms of the GNU General Public License as published by the Free 11 | Software Foundation; either version 2 of the License, or (at your option) 12 | any later version. 13 | 14 | 15 | Notes: This shader does scaling with a weighted linear filter 16 | based on the algorithm by Iñigo Quilez here: 17 | https://iquilezles.org/articles/texture/ 18 | but modified to be somewhat sharper. Then a scanline effect that varies 19 | based on pixel brightness is applied along with a monochrome aperture mask. 20 | This shader runs at ~60fps on the Chromecast HD (10GFlops) on a 1080p display. 21 | (https://forums.libretro.com/t/android-googletv-compatible-shaders-nitpicky) 22 | 23 | Dogway: Same as zfast_crt_geo but with extra blurring based on zfast_crt_composite and some desaturation for an S-Video effect. 24 | 25 | */ 26 | 27 | 28 | // Parameter lines go here: 29 | #pragma parameter SCANLINE_WEIGHT "Scanline Amount" 9.0 0.0 15.0 0.5 30 | #pragma parameter MASK_DARK "Mask Effect Amount" 0.4 0.0 1.0 0.05 31 | #pragma parameter blurx "Convergence X-Axis" 0.70 -2.0 2.0 0.05 32 | #pragma parameter blury "Convergence Y-Axis" -0.30 -2.0 2.0 0.05 33 | 34 | #if defined(VERTEX) 35 | 36 | #if __VERSION__ >= 130 37 | #define COMPAT_VARYING out 38 | #define COMPAT_ATTRIBUTE in 39 | #define COMPAT_TEXTURE texture 40 | #else 41 | #define COMPAT_VARYING varying 42 | #define COMPAT_ATTRIBUTE attribute 43 | #define COMPAT_TEXTURE texture2D 44 | #endif 45 | 46 | #ifdef GL_ES 47 | #define COMPAT_PRECISION mediump 48 | #else 49 | #define COMPAT_PRECISION 50 | #endif 51 | 52 | COMPAT_ATTRIBUTE vec4 VertexCoord; 53 | COMPAT_ATTRIBUTE vec4 COLOR; 54 | COMPAT_ATTRIBUTE vec4 TexCoord; 55 | COMPAT_VARYING vec4 COL0; 56 | COMPAT_VARYING vec4 TEX0; 57 | COMPAT_VARYING vec2 scale; 58 | 59 | vec4 _oPosition1; 60 | uniform mat4 MVPMatrix; 61 | uniform COMPAT_PRECISION int FrameDirection; 62 | uniform COMPAT_PRECISION int FrameCount; 63 | uniform COMPAT_PRECISION vec2 OutputSize; 64 | uniform COMPAT_PRECISION vec2 TextureSize; 65 | uniform COMPAT_PRECISION vec2 InputSize; 66 | 67 | // compatibility #defines 68 | #define vTexCoord TEX0.xy 69 | 70 | #ifdef PARAMETER_UNIFORM 71 | // All parameter floats need to have COMPAT_PRECISION in front of them 72 | uniform COMPAT_PRECISION float SCANLINE_WEIGHT; 73 | uniform COMPAT_PRECISION float MASK_DARK; 74 | uniform COMPAT_PRECISION float blurx; 75 | uniform COMPAT_PRECISION float blury; 76 | #else 77 | #define SCANLINE_WEIGHT 9.0 78 | #define MASK_DARK 0.4 79 | #define blurx 0.70 80 | #define blury -0.30 81 | #endif 82 | 83 | void main() 84 | { 85 | gl_Position = MVPMatrix * VertexCoord; 86 | TEX0.xy = TexCoord.xy*1.00001; 87 | } 88 | 89 | #elif defined(FRAGMENT) 90 | 91 | #ifdef GL_ES 92 | #ifdef GL_FRAGMENT_PRECISION_HIGH 93 | precision highp float; 94 | #else 95 | precision mediump float; 96 | #endif 97 | #define COMPAT_PRECISION mediump 98 | #else 99 | #define COMPAT_PRECISION 100 | #endif 101 | 102 | #if __VERSION__ >= 130 103 | #define COMPAT_VARYING in 104 | #define COMPAT_TEXTURE texture 105 | out COMPAT_PRECISION vec4 FragColor; 106 | #else 107 | #define COMPAT_VARYING varying 108 | #define FragColor gl_FragColor 109 | #define COMPAT_TEXTURE texture2D 110 | #endif 111 | 112 | uniform COMPAT_PRECISION int FrameDirection; 113 | uniform COMPAT_PRECISION int FrameCount; 114 | uniform COMPAT_PRECISION vec2 OutputSize; 115 | uniform COMPAT_PRECISION vec2 TextureSize; 116 | uniform COMPAT_PRECISION vec2 InputSize; 117 | uniform sampler2D Texture; 118 | COMPAT_VARYING vec4 TEX0; 119 | 120 | // compatibility #defines 121 | #define Source Texture 122 | #define vTexCoord TEX0.xy 123 | #define scale vec2(TextureSize.xy/InputSize.xy) 124 | #define blur_xy vec2(vec2(blurx,blury)/(TextureSize*2.0)) 125 | 126 | #ifdef PARAMETER_UNIFORM 127 | // All parameter floats need to have COMPAT_PRECISION in front of them 128 | uniform COMPAT_PRECISION float SCANLINE_WEIGHT; 129 | uniform COMPAT_PRECISION float MASK_DARK; 130 | uniform COMPAT_PRECISION float blurx; 131 | uniform COMPAT_PRECISION float blury; 132 | #else 133 | #define SCANLINE_WEIGHT 9.0 134 | #define MASK_DARK 0.4 135 | #define blurx 0.70 136 | #define blury -0.30 137 | #endif 138 | 139 | #define MSCL (OutputSize.y > 1499.0 ? 0.3333 : 0.5) 140 | // This compensates the scanline+mask embedded gamma from the beam dynamics 141 | #define pwr vec3(1.0/((-0.0325*SCANLINE_WEIGHT+1.0)*(-0.311*MASK_DARK+1.0))-1.2) 142 | 143 | 144 | /* 145 | // NTSC-J (D93) -> Rec709 D65 Joint Matrix (with D93 simulation) 146 | // This is compensated for a linearization hack (RGB*RGB and then sqrt()) 147 | const mat3 P22D93 = mat3( 148 | 1.00000, 0.00000, -0.06173, 149 | 0.07111, 0.96887, -0.01136, 150 | 0.00000, 0.08197, 1.07280); 151 | 152 | // SAT 0.95;0.9 153 | const mat3 SAT95 = mat3( 154 | 0.921259999275207500, 0.07151728868484497, 0.007221288979053497, 155 | 0.022333506494760513, 0.97512906789779660, 0.002537854015827179, 156 | 0.010629460215568542, 0.03575950860977173, 0.953611016273498500); 157 | */ 158 | 159 | // P22D93 * SAT95 160 | const mat3 P22D93SAT95 = mat3( 161 | 0.920603871345520000, 0.06930985301733017, -0.051645118743181230, 162 | 0.087028317153453830, 0.94945263862609860, -0.007860664278268814, 163 | 0.013233962468802929, 0.11829412728548050, 1.023241996765136700); 164 | 165 | 166 | // Returns gamma corrected output, compensated for scanline+mask embedded gamma 167 | vec3 inv_gamma(vec3 col, vec3 power) 168 | { 169 | vec3 cir = col-1.0; 170 | cir *= cir; 171 | col = mix(sqrt(col),sqrt(1.0-cir),power); 172 | return col; 173 | } 174 | 175 | vec2 Warp(vec2 pos) 176 | { 177 | pos = pos*2.0-1.0; 178 | pos *= vec2(1.0 + (pos.y*pos.y)*0.0276, 1.0 + (pos.x*pos.x)*0.0414); 179 | return pos*0.5 + 0.5; 180 | } 181 | 182 | 183 | void main() 184 | { 185 | vec2 vpos = vTexCoord*scale; 186 | vec2 xy = Warp(vpos); 187 | 188 | vec2 corn = min(xy,1.0-xy); // This is used to mask the rounded 189 | corn.x = 0.0001/corn.x; // corners later on 190 | 191 | xy /= scale; 192 | 193 | 194 | COMPAT_PRECISION vec2 sample1 = COMPAT_TEXTURE(Source,vec2(xy.x + blur_xy.x, xy.y - blur_xy.y)).rg; 195 | COMPAT_PRECISION vec3 sample2 = COMPAT_TEXTURE(Source, xy).rgb; 196 | COMPAT_PRECISION vec2 sample3 = COMPAT_TEXTURE(Source,vec2(xy.x - blur_xy.x, xy.y + blur_xy.y)).gb; 197 | 198 | vec3 colour = vec3(sample1.r*0.50, sample1.g*0.25 + sample3.r*0.25, sample3.g*0.50) + 0.5 * sample2; 199 | 200 | vpos *= (1.0 - vpos.xy); 201 | float vig = vpos.x * vpos.y * 46.0; 202 | vig = min(sqrt(vig), 1.0); 203 | 204 | 205 | // Of all the pixels that are mapped onto the texel we are 206 | // currently rendering, which pixel are we currently rendering? 207 | COMPAT_PRECISION float ratio_scale = vTexCoord.y * TextureSize.y; 208 | // Snap to the center of the underlying texel. 209 | // This is just like "Quilez Scaling" but sharper 210 | COMPAT_PRECISION float f = ratio_scale - (floor(ratio_scale) + 0.5); 211 | COMPAT_PRECISION float Y = f*f; 212 | 213 | COMPAT_PRECISION float whichmask = floor(vTexCoord.x*scale.x*OutputSize.x)*-MSCL; 214 | COMPAT_PRECISION float mask = 1.0 + float(fract(whichmask) < MSCL) *-MASK_DARK; 215 | 216 | colour = max((colour*colour) * (P22D93SAT95 * vig), 0.0); 217 | 218 | COMPAT_PRECISION float scanLineWeight = (1.5 - SCANLINE_WEIGHT*(Y - Y*Y)); 219 | 220 | if (corn.y <= corn.x || corn.x < 0.0001) 221 | colour = vec3(0.0); 222 | 223 | FragColor.rgba = vec4(inv_gamma(colour.rgb*mix(scanLineWeight*mask, 1.0, colour.r*0.26667+colour.g*0.26667+colour.b*0.26667),pwr),1.0); 224 | 225 | } 226 | #endif 227 | -------------------------------------------------------------------------------- /RGC shaders/shaders_glsl/sharp-shimmerless.glslp: -------------------------------------------------------------------------------- 1 | shaders = 1 2 | 3 | shader0 = shaders/sharp-shimmerless.glsl 4 | filter_linear0 = true -------------------------------------------------------------------------------- /RGC shaders/shaders_glsl/zfast_crt_geo_svideo.glslp: -------------------------------------------------------------------------------- 1 | shaders = "1" 2 | 3 | shader0 = "shaders/zfast_crt_geo_svideo.glsl" 4 | filter_linear0 = "true" 5 | wrap_mode0 = "clamp_to_border" 6 | mipmap_input0 = "false" 7 | alias0 = "" 8 | float_framebuffer0 = "false" 9 | srgb_framebuffer0 = "false" -------------------------------------------------------------------------------- /RGC shaders/shaders_slang/shaders/sharp-shimmerless.slang: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout(push_constant) uniform Push 4 | { 5 | vec4 OutputSize; 6 | vec4 OriginalSize; 7 | vec4 SourceSize; 8 | uint FrameCount; 9 | } params; 10 | 11 | layout(std140, set = 0, binding = 0) uniform UBO 12 | { 13 | mat4 MVP; 14 | } global; 15 | 16 | /* 17 | * sharp-shimmerless 18 | * Author: zadpos 19 | * License: Public domain 20 | * 21 | * A retro gaming shader for sharpest pixels with no aliasing/shimmering. 22 | * Instead of pixels as point samples, this shader considers pixels as 23 | * ideal rectangles forming a grid, and interpolates pixel by calculating 24 | * the surface area an input pixel would occupy on an output pixel. 25 | */ 26 | 27 | #pragma stage vertex 28 | layout(location = 0) in vec4 Position; 29 | layout(location = 1) in vec2 TexCoord; 30 | layout(location = 0) out vec2 vTexCoord; 31 | 32 | void main() 33 | { 34 | gl_Position = global.MVP * Position; 35 | vTexCoord = TexCoord; 36 | } 37 | 38 | #pragma stage fragment 39 | layout(location = 0) in vec2 vTexCoord; 40 | layout(location = 0) out vec4 FragColor; 41 | layout(set = 0, binding = 2) uniform sampler2D Source; 42 | 43 | void main() 44 | { 45 | vec2 pixel = vTexCoord * params.OutputSize.xy * params.SourceSize.xy / params.OriginalSize.xy; 46 | vec2 pixel_floored = floor(pixel); 47 | vec2 pixel_ceiled = ceil(pixel); 48 | vec2 scale = params.OutputSize.xy / params.SourceSize.xy; 49 | vec2 invscale = params.SourceSize.xy / params.OutputSize.xy; 50 | vec2 texel_floored = floor(invscale * pixel_floored); 51 | vec2 texel_ceiled = floor(invscale * pixel_ceiled); 52 | 53 | vec2 mod_texel; 54 | 55 | if (texel_floored.x == texel_ceiled.x) { 56 | // The square-pixel lies "completely in" a single column of square-texel 57 | mod_texel.x = texel_ceiled.x + 0.5; 58 | } else { 59 | // The square-pixel lies across two neighboring columns and must be interpolated 60 | mod_texel.x = texel_ceiled.x + 0.5 - (scale.x * texel_ceiled.x - pixel_floored.x); 61 | } 62 | 63 | if (texel_floored.y == texel_ceiled.y) { 64 | // The square-pixel lies "completely in" a single row of square-texel 65 | mod_texel.y = texel_ceiled.y + 0.5; 66 | } else { 67 | // The square-pixel lies across two neighboring rows and must be interpolated 68 | mod_texel.y = texel_ceiled.y + 0.5 - (scale.y * texel_ceiled.y - pixel_floored.y); 69 | } 70 | 71 | //vec2 texel = vTexCoord * params.SourceSize.xy; 72 | //mod_texel = texel; 73 | 74 | FragColor = vec4(texture(Source, mod_texel / params.SourceSize.xy).rgb, 1.0); 75 | } 76 | -------------------------------------------------------------------------------- /RGC shaders/shaders_slang/sharp-shimmerless.slangp: -------------------------------------------------------------------------------- 1 | shaders = 1 2 | 3 | shader0 = "shaders/sharp-shimmerless.slang" 4 | filter_linear0 = true 5 | --------------------------------------------------------------------------------