Skip to content

Commit 4486ac6

Browse files
committed
docs
1 parent 89df574 commit 4486ac6

File tree

4 files changed

+128
-4
lines changed

4 files changed

+128
-4
lines changed

Misc/CustomShader.slang

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// This is a minimal example of a custom shader you can import into ShaderGlass
2+
// Full specification and examples can be found at https://github.com/libretro/slang-shaders/blob/master/README.md
3+
4+
#version 450
5+
6+
//////////////////////////////////////////////////////////////////
7+
// you can define parameters of your shader in this section
8+
9+
#pragma parameter Boost "Boost" 1.0 0.0 2.0 0.1
10+
11+
layout(push_constant) uniform Push
12+
{
13+
// built-in parameters
14+
vec4 SourceSize;
15+
vec4 OriginalSize;
16+
vec4 OutputSize;
17+
uint FrameCount;
18+
19+
// your custom parameters
20+
float Boost;
21+
} params;
22+
23+
layout(std140, set = 0, binding = 0) uniform UBO
24+
{
25+
mat4 MVP;
26+
} global;
27+
28+
//////////////////////////////////////////////////////////////////
29+
// vertex shader, you usually don't need to modify it
30+
31+
#pragma stage vertex
32+
33+
layout(location = 0) in vec4 Position;
34+
layout(location = 1) in vec2 TexCoord;
35+
layout(location = 0) out vec2 vTexCoord;
36+
37+
void main()
38+
{
39+
gl_Position = global.MVP * Position;
40+
vTexCoord = TexCoord;
41+
}
42+
43+
//////////////////////////////////////////////////////////////////
44+
// fragment shader is where you define per-pixel operations
45+
46+
#pragma stage fragment
47+
48+
layout(location = 0) in vec2 vTexCoord;
49+
layout(location = 0) out vec4 FragColor;
50+
layout(set = 0, binding = 2) uniform sampler2D Source;
51+
52+
void main()
53+
{
54+
// this is the input pixel
55+
vec3 input_pixel = texture(Source, vTexCoord).rgb;
56+
57+
// as an example, we swap RGB channels of the input image (rgb -> gbr)
58+
// and multiply by our custom Boost parameter
59+
vec3 processed_pixel = input_pixel.gbr * params.Boost;
60+
61+
// set output pixel (aka fragment) color
62+
FragColor = vec4(processed_pixel, 1.0);
63+
}

Misc/MANUAL.html

+34-4
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,39 @@ <h3 id="scummvm" style="page-break-before: always;">ScummVM</h3>
194194
and/or aspect ratio correction in ShaderGlass and enjoy the game.
195195
</p>
196196
<p><br /></p>
197-
<h2 id="frequently-asked-questions">Frequently Asked Questions</h2>
197+
<h2 id="parameters">Importing Custom Shaders</h2>
198+
<p>
199+
ShaderGlass comes with a large built-in library of shaders, but you can also import custom ones
200+
written in <a href="https://github.com/libretro/slang-shaders/blob/master/README.md">RetroArch shader system</a>.
201+
It accepts both individual shaders (<i>.slang</i>) and multi-pass presets (<i>.slangp</i>).
202+
</p>
203+
<p>
204+
When working on a custom shader, you can use <i>Recent imports</i> menu to quickly reload it.
205+
</p>
206+
<h3>RetroArch shader/preset packs</h3>
207+
<p>
208+
A lot of preset packs out there rely on base RetroArch shaders so to import them into ShaderGlass
209+
install them into RetroArch first, and then Import from RetroArch's shaders directory.
210+
</p><p>
211+
Please note some shaders might require Vulkan (ShaderGlass is DirectX 11 only) or rely on RetroArch
212+
features that ShaderGlass doesn't support so might not work just as well.
213+
</p>
214+
<h3>Writing your own shaders</h3>
215+
<p>
216+
ShaderGlass lets you easily experiment with your own shaders! <i>CustomShader.slang</i> is a minimal example
217+
of a shader that swaps color channels and applies a boost, meant as an example from which you could
218+
start writing your own shaders and have them applied to your desktop. Check out
219+
<a href="https://github.com/libretro/slang-shaders">RetroArch shader repository</a> for tons of examples.
220+
</p>
221+
222+
<h3>Modifying RetroArch shaders</h3>
223+
<p>
224+
To modify shaders from RetroArch library, download their source code
225+
<a href="https://github.com/mausimus/slang-shaders/archive/refs/heads/shaderglass.zip">from here</a>,
226+
make changes and import.
227+
</p>
228+
<p><br /></p>
229+
<h2 id="frequently-asked-questions" style="page-break-before: always;">Frequently Asked Questions</h2>
198230
<h3 id="-im-seeing-black-only">&gt; I'm seeing black only</h3>
199231
<p>Make sure you're using <strong>Windows 10, version 2004</strong> (build 19041) or <strong>Windows 11</strong>.</p>
200232
<h3 id="-can-i-use-it-with-reshade">&gt; Can I use it with Reshade?</h3>
@@ -214,15 +246,13 @@ <h4 id="windows-11">Windows 11</h4>
214246
open Windows Settings app and search for "screenshot borders". Make sure all the options and ShaderGlass are allowed to
215247
remove the border.
216248
</p>
217-
<h3 id="-i-cant-capture-using-obs" style="page-break-before: always;">&gt; I can't capture using OBS</h3>
249+
<h3 id="-i-cant-capture-using-obs">&gt; I can't capture using OBS</h3>
218250
<p>
219251
OBS can capture ShaderGlass but only as a Game Capture source (not Window Capture nor Desktop Capture). Use "Capture specific window" within
220252
Game Capture to select ShaderGlass window only.
221253
</p>
222254
<h3 id="-textletters-are-all-blurry-or-pixelated">&gt; Text/letters are all blurry or pixelated</h3>
223255
<p>For maximum sharpness set Input -&gt; Pixel Size -&gt; x1 but note that a lot of shaders expect pixelated input so set this option accordingly to each scenario.</p>
224-
<h3 id="-can-i-save-a-profile">&gt; Can I save a profile?</h3>
225-
<p>Yes, you can save shader profiles as files, access from Recent Profiles menu and even load them on startup via a command line parameter.</p>
226256
<h3 id="-i-dont-see-my-favourite-retroarch-shader">&gt; I don't see my favourite RetroArch shader</h3>
227257
<p>
228258
ShaderGlass includes majority of RetroArch repository at time of release, but some shaders had to be excluded because of features SG doesn't yet support (for example HDR).<br />

Misc/MANUAL.pdf

7.57 KB
Binary file not shown.

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,37 @@ and/or aspect ratio correction in ShaderGlass and enjoy the game.
293293

294294
<br/>
295295

296+
### Importing Custom Shaders
297+
298+
ShaderGlass comes with a large built-in library of shaders, but you can also import custom ones
299+
written in [RetroArch shader system](https://github.com/libretro/slang-shaders/blob/master/README.md).
300+
It accepts both individual shaders (_.slang_) and multi-pass presets (_.slangp_).
301+
302+
When working on a custom shader, you can use _Recent imports_ menu to quickly reload it.
303+
304+
#### RetroArch shader/preset packs
305+
306+
A lot of preset packs out there rely on base RetroArch shaders so to import them into ShaderGlass
307+
install them into RetroArch first, and then Import from RetroArch's shaders directory.
308+
309+
Please note some shaders might require Vulkan (ShaderGlass is DirectX 11 only) or rely on RetroArch
310+
features that ShaderGlass doesn't support so might not work just as well.
311+
312+
#### Writing your own shaders
313+
314+
ShaderGlass lets you easily experiment with your own shaders! _CustomShader.slang_ is a minimal example
315+
of a shader that swaps color channels and applies a boost, meant as an example from which you could
316+
start writing your own shaders and have them applied to your desktop. Check out
317+
[RetroArch shader repository](https://github.com/libretro/slang-shaders) for tons of examples.
318+
319+
#### Modifying RetroArch shaders
320+
321+
To modify shaders from RetroArch library, download their source code
322+
[from here](https://github.com/mausimus/slang-shaders/archive/refs/heads/shaderglass.zip),
323+
make changes and import.
324+
325+
<br/>
326+
296327
### Frequently Asked Questions
297328

298329
See FAQ [here](FAQ.md).

0 commit comments

Comments
 (0)