mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-11 06:17:41 +00:00
[vulkan, android] Add feature of post-processing shaders on Android (#4348)
Very self-explanatory; implementation of the feature for post-processing shaders for Android (at least for now); will allow users to enhance the graphic quality of video games based on the use of multiple shaders adjustable, presets and more, inspired on the PPSSPP implementation, this feature adds 22 customizable shaders (1 pass) that lives on the overlay of the screen, which means that aside of the capability to chain multiple shaders on the screen, this doesn't have depths (pixel/ depth z-buffer) so it ensures the performance with it's use. Few shaders were a faithful port from PPSSPP with their respective attribution on the shader headers for their respective owners; and there are adaptations from public references/ cinematographic (Anime4K) and the rest are my own addition. _Special Credits:_ 1.- PPSSPP Team for their contribution on the public references for shaders: Henrik Rydgard, ShadX, SimoneT, KillaMaaki and guest(r). 2.- Niklas Haas. 3.- bloc97. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4348 Reviewed-by: lizzie <lizzie@eden-emu.dev> Reviewed-by: Maufeat <sahyno1996@gmail.com>
This commit is contained in:
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
name=Anime
|
||||
description=Cel shaded look: the picture is cleaned first, then the lighting is collapsed into flat bands with inked edges, finished with a small glow.
|
||||
chain=Denoise.fx|Denoise|Strength=0.18,Radius=1.2;CelShading.fx|CelShading|Bands=5,BandContrast=0.35,BandEdge=0.2,Detail=0.7,OutlineStrength=0.7,OutlineThreshold=0.2,Saturation=1.3;Bloom.fx|Bloom|Radius=1.2,Amount=0.25
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
name=Cinematic
|
||||
description=Film look: soft glow on the highlights, a filmic contrast curve, cool shadows against warm highlights, fine grain and a gentle vignette.
|
||||
chain=Bloom.fx|Bloom|Radius=1.6,Amount=0.35;FilmicCurve.fx|FilmicCurve|Toe=1.35,Shoulder=1.3,Amount=0.85;SplitToning.fx|SplitToning|ShadowHue=210,ShadowStrength=0.25,HighlightHue=38,HighlightStrength=0.3;FilmGrain.fx|FilmGrain|Intensity=0.022;Vignette.fx|Vignette|Strength=0.5
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
name=Clean
|
||||
description=Cleans up a low internal resolution: removes dithering and compression noise, smooths banded skies and brings edge detail back. The safe starting point if you are not sure what you want.
|
||||
chain=Denoise.fx|Denoise|Strength=0.14,Curve=1.2;Deband.fx|Deband|;Sharpen.fx|Sharpen|Amount=0.75
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
name=Dreamy
|
||||
description=Soft focus: the centre of the screen stays sharp while everything around it blurs, with a wide glow over the highlights. Good for slower games and cutscenes.
|
||||
chain=Blur.fx|Blur|Radius=6,Strength=0.85,FocusSize=0.28,FocusSoftness=0.5;Bloom.fx|Bloom|Radius=2.0,Amount=0.55
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
name=Retro
|
||||
description=Old television look: colour fringing at the edges of the screen, curved scanlines with a phosphor mask, and darkened corners. The scanline roll is switched off so it does not crawl.
|
||||
chain=ChromaticAberration.fx|ChromaticAberration|Strength=1.0;CRT.fx|CRT|RollSpeed=0,Bleed=1.2;Vignette.fx|Vignette|Strength=0.7
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
name=Vivid
|
||||
description=Punchier colour without stylising the image: warmer and more saturated, blacks and whites pushed to the ends of the range, and a light sharpen.
|
||||
chain=NaturalColors.fx|NaturalColors|Luma=1.15,Chroma=1.35;Levels.fx|Levels|InputBlack=0.02,InputWhite=0.98;Sharpen.fx|Sharpen|Amount=0.5
|
||||
Vendored
+70
@@ -0,0 +1,70 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2012 PPSSPP Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Ported from bloomnoblur.fsh in PPSSPP.
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Radius <
|
||||
ui_type = "slider";
|
||||
ui_label = "Radius";
|
||||
ui_tooltip = "How far the glow spreads from bright areas.";
|
||||
ui_min = 0.0; ui_max = 4.0; ui_step = 0.05;
|
||||
> = 1.0;
|
||||
|
||||
uniform float Amount <
|
||||
ui_type = "slider";
|
||||
ui_label = "Amount";
|
||||
ui_tooltip = "Strength of the glow added on top of the image.";
|
||||
ui_min = 0.0; ui_max = 2.0; ui_step = 0.05;
|
||||
> = 0.6;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float Weight(float3 color)
|
||||
{
|
||||
float gray = (color.r + color.g + color.b) / 3.0;
|
||||
float saturation = (abs(color.r - gray) + abs(color.g - gray) + abs(color.b - gray)) / 3.0;
|
||||
return gray * gray / max(saturation, 0.25);
|
||||
}
|
||||
|
||||
float4 PS_Bloom(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float3 color = tex2D(BackBuffer, uv).rgb;
|
||||
|
||||
float gray = (color.r + color.g + color.b) / 3.0;
|
||||
float saturation = (abs(color.r - gray) + abs(color.g - gray) + abs(color.b - gray)) / 3.0;
|
||||
float spread = 0.002 * gray / max(saturation, 0.25) * Radius;
|
||||
|
||||
float3 sum = float3(0.0, 0.0, 0.0);
|
||||
[unroll] for (int x = -3; x <= 3; x += 2)
|
||||
{
|
||||
[unroll] for (int y = -3; y <= 3; y += 2)
|
||||
{
|
||||
float3 tap = tex2D(BackBuffer, uv + float2(x, y) * spread).rgb;
|
||||
sum += tap * Weight(tap);
|
||||
}
|
||||
}
|
||||
sum /= 16.0;
|
||||
|
||||
return float4(saturate(color + sum * Amount), 1.0);
|
||||
}
|
||||
|
||||
technique Bloom <
|
||||
ui_label = "Bloom";
|
||||
ui_tooltip = "Bleeds light out of the brightest areas into a soft halo, the way a camera does when pointed at something too bright.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_Bloom;
|
||||
}
|
||||
}
|
||||
Vendored
+87
@@ -0,0 +1,87 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Radius <
|
||||
ui_type = "slider";
|
||||
ui_label = "Radius";
|
||||
ui_tooltip = "How far the blur reaches, in pixels.";
|
||||
ui_min = 1.0; ui_max = 12.0; ui_step = 0.5;
|
||||
> = 4.0;
|
||||
|
||||
uniform float Strength <
|
||||
ui_type = "slider";
|
||||
ui_label = "Strength";
|
||||
ui_tooltip = "Blend between the original image and the blurred one.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 1.0;
|
||||
|
||||
uniform float FocusSize <
|
||||
ui_type = "slider";
|
||||
ui_label = "Sharp Centre";
|
||||
ui_tooltip = "Size of the region left in focus at the centre of the screen. At zero the whole image is blurred evenly.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 0.0;
|
||||
|
||||
uniform float FocusSoftness <
|
||||
ui_type = "slider";
|
||||
ui_label = "Focus Falloff";
|
||||
ui_tooltip = "How gradually the sharp centre gives way to the blur.";
|
||||
ui_min = 0.05; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 0.4;
|
||||
|
||||
static const int TAPS = 17;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_Blur(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float2 texel = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
|
||||
float3 original = tex2D(BackBuffer, uv).rgb;
|
||||
|
||||
float2 centred = (uv - 0.5) * float2(BUFFER_WIDTH * BUFFER_RCP_HEIGHT, 1.0) * 2.0;
|
||||
float distance_from_centre = length(centred);
|
||||
float no_focus = 1.0 - step(0.001, FocusSize);
|
||||
float focus = max(smoothstep(FocusSize, FocusSize + FocusSoftness, distance_from_centre), no_focus);
|
||||
float amount = Strength * focus;
|
||||
|
||||
float angle = frac(sin(dot(pos.xy, float2(12.9898, 78.233))) * 43758.5453) * 6.2831853;
|
||||
float2 spoke = float2(cos(angle), sin(angle));
|
||||
|
||||
const float2 turn = float2(cos(2.39996323), sin(2.39996323));
|
||||
const float decay = exp(-2.0 / float(TAPS));
|
||||
float weight = exp(-1.0 / float(TAPS));
|
||||
|
||||
float3 sum = float3(0.0, 0.0, 0.0);
|
||||
float total = 0.0;
|
||||
[unroll] for (int i = 0; i < TAPS; ++i)
|
||||
{
|
||||
float reach = sqrt((float(i) + 0.5) / float(TAPS));
|
||||
sum += tex2D(BackBuffer, uv + spoke * reach * texel * Radius).rgb * weight;
|
||||
total += weight;
|
||||
weight *= decay;
|
||||
spoke = float2(spoke.x * turn.x - spoke.y * turn.y,
|
||||
spoke.x * turn.y + spoke.y * turn.x);
|
||||
}
|
||||
|
||||
float3 blurred = sum / total;
|
||||
return float4(lerp(original, blurred, amount), 1.0);
|
||||
}
|
||||
|
||||
technique Blur <
|
||||
ui_label = "Blur";
|
||||
ui_tooltip = "Gaussian blur with an optional sharp centre, for softening the picture or faking depth of field.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_Blur;
|
||||
}
|
||||
}
|
||||
Vendored
+74
@@ -0,0 +1,74 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2012 PPSSPP Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Ported from crt.fsh in PPSSPP, by KillaMaaki.
|
||||
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Timer < source = "timer"; > = 0.0;
|
||||
|
||||
uniform float Density <
|
||||
ui_type = "slider";
|
||||
ui_label = "Line Density";
|
||||
ui_min = 60.0; ui_max = 720.0; ui_step = 10.0;
|
||||
> = 272.0;
|
||||
|
||||
uniform float RollSpeed <
|
||||
ui_type = "slider";
|
||||
ui_label = "Roll Speed";
|
||||
ui_tooltip = "Speed of the rolling bar. Zero disables it.";
|
||||
ui_min = 0.0; ui_max = 2.0; ui_step = 0.05;
|
||||
> = 1.0;
|
||||
|
||||
uniform float Bleed <
|
||||
ui_type = "slider";
|
||||
ui_label = "Colour Bleed";
|
||||
ui_tooltip = "Horizontal separation of the red and green channels.";
|
||||
ui_min = 0.0; ui_max = 4.0; ui_step = 0.1;
|
||||
> = 1.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_CRT(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float seconds = Timer * 0.001;
|
||||
float scan = floor((uv.y + seconds * RollSpeed * 0.5) * Density);
|
||||
float line_intensity = frac(scan * 0.5) * 2.0;
|
||||
|
||||
float2 shift = float2(line_intensity * 0.0005, 0.0);
|
||||
float2 bleed = float2(BUFFER_RCP_WIDTH * Bleed, 0.0);
|
||||
|
||||
float r = tex2D(BackBuffer, uv + bleed + shift).r;
|
||||
float g = tex2D(BackBuffer, uv - bleed + shift).g;
|
||||
float b = tex2D(BackBuffer, uv).b;
|
||||
|
||||
float3 color = float3(r, g * 0.99, b) * clamp(line_intensity, 0.85, 1.0);
|
||||
|
||||
if (RollSpeed > 0.0)
|
||||
{
|
||||
float rollbar = sin((uv.y + seconds * RollSpeed) * 4.0);
|
||||
color += rollbar * 0.02;
|
||||
}
|
||||
|
||||
return float4(saturate(color), 1.0);
|
||||
}
|
||||
|
||||
technique CRT <
|
||||
ui_label = "CRT";
|
||||
ui_tooltip = "Curved scanlines and the phosphor mask of a CRT television, for games that were drawn with that kind of screen in mind.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_CRT;
|
||||
}
|
||||
}
|
||||
Vendored
+79
@@ -0,0 +1,79 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2012 PPSSPP Project
|
||||
// SPDX-FileCopyrightText: guest(r)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Ported from cartoon.fsh in PPSSPP, Advanced Cartoon shader I by guest(r).
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float EdgeStrength <
|
||||
ui_type = "slider";
|
||||
ui_label = "Edge Strength";
|
||||
ui_tooltip = "Darkness of the ink outline drawn around detected edges.";
|
||||
ui_min = 0.0; ui_max = 2.0; ui_step = 0.05;
|
||||
> = 0.5;
|
||||
|
||||
uniform float Levels <
|
||||
ui_type = "slider";
|
||||
ui_label = "Colour Levels";
|
||||
ui_tooltip = "How many bands the colours are quantised into.";
|
||||
ui_min = 2.0; ui_max = 16.0; ui_step = 1.0;
|
||||
> = 4.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_Cartoon(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float2 texel = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
|
||||
|
||||
float3 c00 = tex2D(BackBuffer, uv + texel * float2(-1.0, -1.0)).rgb;
|
||||
float3 c10 = tex2D(BackBuffer, uv + texel * float2( 0.0, -1.0)).rgb;
|
||||
float3 c20 = tex2D(BackBuffer, uv + texel * float2( 1.0, -1.0)).rgb;
|
||||
float3 c01 = tex2D(BackBuffer, uv + texel * float2(-1.0, 0.0)).rgb;
|
||||
float3 c11 = tex2D(BackBuffer, uv).rgb;
|
||||
float3 c21 = tex2D(BackBuffer, uv + texel * float2( 1.0, 0.0)).rgb;
|
||||
float3 c02 = tex2D(BackBuffer, uv + texel * float2(-1.0, 1.0)).rgb;
|
||||
float3 c12 = tex2D(BackBuffer, uv + texel * float2( 0.0, 1.0)).rgb;
|
||||
float3 c22 = tex2D(BackBuffer, uv + texel * float2( 1.0, 1.0)).rgb;
|
||||
|
||||
const float3 dt = float3(1.0, 1.0, 1.0);
|
||||
|
||||
float d1 = dot(abs(c00 - c22), dt);
|
||||
float d2 = dot(abs(c20 - c02), dt);
|
||||
float hl = dot(abs(c01 - c21), dt);
|
||||
float vl = dot(abs(c10 - c12), dt);
|
||||
float edge = EdgeStrength * (d1 + d2 + hl + vl) / (dot(c11, dt) + 0.15);
|
||||
|
||||
float lc = Levels * length(c11);
|
||||
float f = frac(lc);
|
||||
f *= f;
|
||||
lc = (floor(lc) + f * f) / Levels + 0.05;
|
||||
|
||||
float3 unit = normalize(max(c11, 0.0001));
|
||||
float3 quant = Levels * unit;
|
||||
float3 frct = frac(quant);
|
||||
frct *= frct;
|
||||
quant = floor(quant) + 0.05 * dt + frct * frct;
|
||||
|
||||
float3 color = lc * (1.1 - edge * sqrt(edge)) * quant / Levels;
|
||||
return float4(saturate(color), 1.0);
|
||||
}
|
||||
|
||||
technique Cartoon <
|
||||
ui_label = "Cartoon";
|
||||
ui_tooltip = "Ink outlines and flat colour bands. Faithful port of the PPSSPP shader; the outline gets heavy in dark scenes, so try Cartoon Soft or Cel Shading if the blacks smear.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_Cartoon;
|
||||
}
|
||||
}
|
||||
Vendored
+100
@@ -0,0 +1,100 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2012 PPSSPP Project
|
||||
// SPDX-FileCopyrightText: guest(r)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float EdgeStrength <
|
||||
ui_type = "slider";
|
||||
ui_label = "Edge Strength";
|
||||
ui_tooltip = "Darkness of the ink outline drawn around detected edges.";
|
||||
ui_min = 0.0; ui_max = 2.0; ui_step = 0.05;
|
||||
> = 0.45;
|
||||
|
||||
uniform float ShadowGuard <
|
||||
ui_type = "slider";
|
||||
ui_label = "Shadow Guard";
|
||||
ui_tooltip = "Holds the outline back in dark areas. Raise it if shadows turn into black blobs.";
|
||||
ui_min = 0.1; ui_max = 2.0; ui_step = 0.05;
|
||||
> = 0.8;
|
||||
|
||||
uniform float Levels <
|
||||
ui_type = "slider";
|
||||
ui_label = "Colour Levels";
|
||||
ui_tooltip = "How many bands the colours are quantised into.";
|
||||
ui_min = 2.0; ui_max = 16.0; ui_step = 1.0;
|
||||
> = 6.0;
|
||||
|
||||
uniform float Smoothing <
|
||||
ui_type = "slider";
|
||||
ui_label = "Banding";
|
||||
ui_tooltip = "How far the picture is pushed towards flat bands.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 0.75;
|
||||
|
||||
uniform float Saturation <
|
||||
ui_type = "slider";
|
||||
ui_label = "Saturation";
|
||||
ui_min = 0.0; ui_max = 2.0; ui_step = 0.05;
|
||||
> = 1.15;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_CartoonSoft(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float2 texel = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
|
||||
|
||||
float3 c00 = tex2D(BackBuffer, uv + texel * float2(-1.0, -1.0)).rgb;
|
||||
float3 c10 = tex2D(BackBuffer, uv + texel * float2( 0.0, -1.0)).rgb;
|
||||
float3 c20 = tex2D(BackBuffer, uv + texel * float2( 1.0, -1.0)).rgb;
|
||||
float3 c01 = tex2D(BackBuffer, uv + texel * float2(-1.0, 0.0)).rgb;
|
||||
float3 c11 = tex2D(BackBuffer, uv).rgb;
|
||||
float3 c21 = tex2D(BackBuffer, uv + texel * float2( 1.0, 0.0)).rgb;
|
||||
float3 c02 = tex2D(BackBuffer, uv + texel * float2(-1.0, 1.0)).rgb;
|
||||
float3 c12 = tex2D(BackBuffer, uv + texel * float2( 0.0, 1.0)).rgb;
|
||||
float3 c22 = tex2D(BackBuffer, uv + texel * float2( 1.0, 1.0)).rgb;
|
||||
|
||||
const float3 dt = float3(1.0, 1.0, 1.0);
|
||||
const float3 luma_weights = float3(0.299, 0.587, 0.114);
|
||||
|
||||
float d1 = dot(abs(c00 - c22), dt);
|
||||
float d2 = dot(abs(c20 - c02), dt);
|
||||
float hl = dot(abs(c01 - c21), dt);
|
||||
float vl = dot(abs(c10 - c12), dt);
|
||||
|
||||
float luma = dot(c11, luma_weights);
|
||||
float response = (d1 + d2 + hl + vl) / (luma * 2.0 + ShadowGuard);
|
||||
float ink = 1.0 - saturate(response * EdgeStrength);
|
||||
|
||||
float scaled = luma * Levels;
|
||||
float step_position = frac(scaled);
|
||||
float eased = step_position * step_position * (3.0 - 2.0 * step_position);
|
||||
float banded = (floor(scaled) + eased) / Levels;
|
||||
float target = lerp(luma, banded, Smoothing);
|
||||
|
||||
float3 tinted = c11 * (target / max(luma, 0.001));
|
||||
float3 grey = dot(tinted, luma_weights);
|
||||
float3 color = lerp(grey, tinted, Saturation) * ink;
|
||||
|
||||
return float4(saturate(color), 1.0);
|
||||
}
|
||||
|
||||
technique CartoonSoft <
|
||||
ui_label = "Cartoon Soft";
|
||||
ui_tooltip = "Ink outlines and flat colour bands, with the outline held back in the shadows so dark scenes do not turn into black blobs.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_CartoonSoft;
|
||||
}
|
||||
}
|
||||
Vendored
+120
@@ -0,0 +1,120 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Bands <
|
||||
ui_type = "slider";
|
||||
ui_label = "Shading Bands";
|
||||
ui_tooltip = "How many flat steps the lighting is collapsed into. Three or four gives the classic look.";
|
||||
ui_min = 2.0; ui_max = 8.0; ui_step = 1.0;
|
||||
> = 4.0;
|
||||
|
||||
uniform float BandContrast <
|
||||
ui_type = "slider";
|
||||
ui_label = "Band Contrast";
|
||||
ui_tooltip = "Spreads the bands towards pure black and white. Lower it if the shadows crush.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 0.5;
|
||||
|
||||
uniform float BandEdge <
|
||||
ui_type = "slider";
|
||||
ui_label = "Band Edge";
|
||||
ui_tooltip = "Width of the transition between bands. Low values give hard cel steps.";
|
||||
ui_min = 0.02; ui_max = 1.0; ui_step = 0.02;
|
||||
> = 0.15;
|
||||
|
||||
uniform float Detail <
|
||||
ui_type = "slider";
|
||||
ui_label = "Texture Detail";
|
||||
ui_tooltip = "How much surface texture survives the flattening. At zero the bands are completely flat.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 0.6;
|
||||
|
||||
uniform float OutlineStrength <
|
||||
ui_type = "slider";
|
||||
ui_label = "Outline Strength";
|
||||
ui_tooltip = "Opacity of the ink line drawn along detected edges.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 0.8;
|
||||
|
||||
uniform float OutlineThreshold <
|
||||
ui_type = "slider";
|
||||
ui_label = "Outline Threshold";
|
||||
ui_tooltip = "How strong an edge has to be before it is inked. Raise it to keep ink off textures and specular highlights.";
|
||||
ui_min = 0.01; ui_max = 0.4; ui_step = 0.01;
|
||||
> = 0.18;
|
||||
|
||||
uniform float Saturation <
|
||||
ui_type = "slider";
|
||||
ui_label = "Saturation";
|
||||
ui_tooltip = "Colour intensity of the flat regions.";
|
||||
ui_min = 0.0; ui_max = 2.0; ui_step = 0.05;
|
||||
> = 1.25;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_CelShading(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
const float3 luma_weights = float3(0.2126, 0.7152, 0.0722);
|
||||
float2 texel = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
|
||||
|
||||
float3 centre = tex2D(BackBuffer, uv).rgb;
|
||||
float luma = dot(centre, luma_weights);
|
||||
|
||||
float2 near = texel * 1.5;
|
||||
float2 far = texel * 3.5;
|
||||
|
||||
float a00 = dot(tex2D(BackBuffer, uv + near * float2(-1.0, -1.0)).rgb, luma_weights);
|
||||
float a20 = dot(tex2D(BackBuffer, uv + near * float2( 1.0, -1.0)).rgb, luma_weights);
|
||||
float a02 = dot(tex2D(BackBuffer, uv + near * float2(-1.0, 1.0)).rgb, luma_weights);
|
||||
float a22 = dot(tex2D(BackBuffer, uv + near * float2( 1.0, 1.0)).rgb, luma_weights);
|
||||
|
||||
float b00 = dot(tex2D(BackBuffer, uv + far * float2(-1.0, -1.0)).rgb, luma_weights);
|
||||
float b20 = dot(tex2D(BackBuffer, uv + far * float2( 1.0, -1.0)).rgb, luma_weights);
|
||||
float b02 = dot(tex2D(BackBuffer, uv + far * float2(-1.0, 1.0)).rgb, luma_weights);
|
||||
float b22 = dot(tex2D(BackBuffer, uv + far * float2( 1.0, 1.0)).rgb, luma_weights);
|
||||
|
||||
float gx = (a00 + a02) - (a20 + a22);
|
||||
float gy = (a00 + a20) - (a02 + a22);
|
||||
float gradient = sqrt(gx * gx + gy * gy);
|
||||
float ink = smoothstep(OutlineThreshold, OutlineThreshold + 0.04, gradient);
|
||||
|
||||
float lighting = (a00 + a20 + a02 + a22 + b00 + b20 + b02 + b22) * 0.125;
|
||||
float detail = luma - lighting;
|
||||
|
||||
float softness = max(BandEdge, 0.001);
|
||||
float coord = lighting * Bands - softness * 0.5;
|
||||
float index = floor(coord) + smoothstep(1.0 - softness, 1.0, frac(coord));
|
||||
|
||||
float centred = (index + 0.5) / Bands;
|
||||
float stretched = index / max(Bands - 1.0, 1.0);
|
||||
float banded = saturate(lerp(centred, stretched, BandContrast));
|
||||
|
||||
float target = saturate(banded + detail * Detail);
|
||||
|
||||
float gain = min(target / max(luma, 0.001), 4.0);
|
||||
float3 shaded = centre * gain;
|
||||
float3 grey = dot(shaded, luma_weights);
|
||||
float3 color = lerp(grey, shaded, Saturation);
|
||||
color *= 1.0 - ink * OutlineStrength;
|
||||
|
||||
return float4(saturate(color), 1.0);
|
||||
}
|
||||
|
||||
technique CelShading <
|
||||
ui_label = "Cel Shading";
|
||||
ui_tooltip = "Collapses the lighting into a few hard steps and inks the edges, keeping texture detail and hue intact.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_CelShading;
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Strength <
|
||||
ui_type = "slider";
|
||||
ui_label = "Strength";
|
||||
ui_tooltip = "Channel separation in pixels, measured at the edge of the screen.";
|
||||
ui_min = 0.0; ui_max = 8.0; ui_step = 0.1;
|
||||
> = 1.5;
|
||||
|
||||
uniform float Falloff <
|
||||
ui_type = "slider";
|
||||
ui_label = "Falloff";
|
||||
ui_tooltip = "How fast the separation grows away from the centre. Higher keeps the middle clean.";
|
||||
ui_min = 1.0; ui_max = 4.0; ui_step = 0.1;
|
||||
> = 2.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_ChromaticAberration(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float2 texel = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
|
||||
|
||||
float2 direction = uv - float2(0.5, 0.5);
|
||||
float radius = length(direction);
|
||||
float2 unit = direction / max(radius, 0.0001);
|
||||
float2 offset = unit * Strength * pow(radius * 2.0, Falloff) * texel;
|
||||
|
||||
float red = tex2D(BackBuffer, uv + offset).r;
|
||||
float green = tex2D(BackBuffer, uv).g;
|
||||
float blue = tex2D(BackBuffer, uv - offset).b;
|
||||
|
||||
return float4(red, green, blue, 1.0);
|
||||
}
|
||||
|
||||
technique ChromaticAberration <
|
||||
ui_label = "Chromatic Aberration";
|
||||
ui_tooltip = "Splits the colour channels apart towards the edges of the screen, the way a cheap lens fails to focus every colour on the same spot.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_ChromaticAberration;
|
||||
}
|
||||
}
|
||||
Vendored
+64
@@ -0,0 +1,64 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2012 PPSSPP Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Based on colorcorrection.fsh in PPSSPP.
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Saturation <
|
||||
ui_type = "slider";
|
||||
ui_label = "Saturation";
|
||||
ui_min = 0.0; ui_max = 2.0; ui_step = 0.01;
|
||||
> = 1.0;
|
||||
|
||||
uniform float Brightness <
|
||||
ui_type = "slider";
|
||||
ui_label = "Brightness";
|
||||
ui_min = 0.0; ui_max = 2.0; ui_step = 0.01;
|
||||
> = 1.0;
|
||||
|
||||
uniform float Contrast <
|
||||
ui_type = "slider";
|
||||
ui_label = "Contrast";
|
||||
ui_min = 0.0; ui_max = 2.0; ui_step = 0.01;
|
||||
> = 1.0;
|
||||
|
||||
uniform float Gamma <
|
||||
ui_type = "slider";
|
||||
ui_label = "Gamma";
|
||||
ui_min = 0.5; ui_max = 2.0; ui_step = 0.01;
|
||||
> = 1.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_ColorGrade(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float3 rgb = tex2D(BackBuffer, uv).rgb;
|
||||
|
||||
float luma = dot(rgb, float3(0.2126, 0.7152, 0.0722));
|
||||
rgb = lerp(float3(luma, luma, luma), rgb, Saturation);
|
||||
rgb *= Brightness;
|
||||
rgb = (rgb - 0.5) * Contrast + 0.5;
|
||||
rgb = pow(max(rgb, 0.0), 1.0 / max(Gamma, 0.0001));
|
||||
|
||||
return float4(saturate(rgb), 1.0);
|
||||
}
|
||||
|
||||
technique ColorGrade <
|
||||
ui_label = "Colour Grade";
|
||||
ui_tooltip = "The four basic colour controls in one pass: saturation, brightness, contrast and gamma. Reach for this before anything more specialised.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_ColorGrade;
|
||||
}
|
||||
}
|
||||
Vendored
+91
@@ -0,0 +1,91 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2015 Niklas Haas
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Threshold <
|
||||
ui_type = "slider";
|
||||
ui_label = "Threshold";
|
||||
ui_tooltip = "How flat a neighbourhood must be before it gets smoothed. Raise it to catch wider bands, lower it to keep more detail.";
|
||||
ui_min = 0.002; ui_max = 0.05; ui_step = 0.001;
|
||||
> = 0.012;
|
||||
|
||||
uniform float Radius <
|
||||
ui_type = "slider";
|
||||
ui_label = "Radius";
|
||||
ui_tooltip = "How far the sampling reaches, in pixels. Wider gradients need a larger radius.";
|
||||
ui_min = 1.0; ui_max = 32.0; ui_step = 1.0;
|
||||
> = 8.0;
|
||||
|
||||
uniform float Grain <
|
||||
ui_type = "slider";
|
||||
ui_label = "Dither";
|
||||
ui_tooltip = "Noise added to break up whatever banding survives the smoothing.";
|
||||
ui_min = 0.0; ui_max = 0.02; ui_step = 0.001;
|
||||
> = 0.004;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float Hash(float2 p)
|
||||
{
|
||||
float3 scattered = frac(float3(p.x, p.y, p.x) * 0.1031);
|
||||
scattered += dot(scattered, scattered.yzx + 33.33);
|
||||
return frac((scattered.x + scattered.y) * scattered.z);
|
||||
}
|
||||
|
||||
float4 PS_Deband(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float2 texel = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
|
||||
|
||||
float3 centre = tex2D(BackBuffer, uv).rgb;
|
||||
float base = Hash(pos.xy) * 6.2831853;
|
||||
|
||||
float3 total = float3(0.0, 0.0, 0.0);
|
||||
float3 deviation = float3(0.0, 0.0, 0.0);
|
||||
|
||||
[unroll] for (int ring = 1; ring <= 2; ++ring)
|
||||
{
|
||||
float angle = base + float(ring) * 2.3999632;
|
||||
float reach = Radius * float(ring) * 0.5;
|
||||
float2 along = float2(cos(angle), sin(angle)) * reach;
|
||||
float2 across = float2(-along.y, along.x);
|
||||
|
||||
float3 s0 = tex2D(BackBuffer, uv + along * texel).rgb;
|
||||
float3 s1 = tex2D(BackBuffer, uv - along * texel).rgb;
|
||||
float3 s2 = tex2D(BackBuffer, uv + across * texel).rgb;
|
||||
float3 s3 = tex2D(BackBuffer, uv - across * texel).rgb;
|
||||
|
||||
total += s0 + s1 + s2 + s3;
|
||||
deviation = max(deviation, max(max(abs(s0 - centre), abs(s1 - centre)),
|
||||
max(abs(s2 - centre), abs(s3 - centre))));
|
||||
}
|
||||
|
||||
float3 average = total * 0.125;
|
||||
float3 flatness = float3(1.0, 1.0, 1.0) -
|
||||
smoothstep(Threshold * 0.5, Threshold, deviation);
|
||||
float3 result = lerp(centre, average, flatness);
|
||||
|
||||
float dither = (Hash(pos.xy + float2(71.3, 41.7)) - 0.5) * Grain;
|
||||
|
||||
return float4(saturate(result + dither), 1.0);
|
||||
}
|
||||
|
||||
technique Deband <
|
||||
ui_label = "Deband";
|
||||
ui_tooltip = "Smooths the visible steps in gradients such as skies, then dithers whatever survives. Worth adding whenever large flat areas show rings.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_Deband;
|
||||
}
|
||||
}
|
||||
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2019-2021 bloc97
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Strength <
|
||||
ui_type = "slider";
|
||||
ui_label = "Strength";
|
||||
ui_min = 0.01; ui_max = 0.5; ui_step = 0.01;
|
||||
> = 0.1;
|
||||
|
||||
uniform float Radius <
|
||||
ui_type = "slider";
|
||||
ui_label = "Radius";
|
||||
ui_min = 0.3; ui_max = 2.0; ui_step = 0.05;
|
||||
> = 1.0;
|
||||
|
||||
uniform float Curve <
|
||||
ui_type = "slider";
|
||||
ui_label = "Shadow Bias";
|
||||
ui_min = 0.0; ui_max = 2.0; ui_step = 0.05;
|
||||
> = 1.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float3 IntensityWeight(float3 value, float3 sigma, float3 centre)
|
||||
{
|
||||
float3 scaled = (value - centre) / sigma;
|
||||
return exp(-0.5 * scaled * scaled);
|
||||
}
|
||||
|
||||
float SpatialWeight(float distance, float sigma)
|
||||
{
|
||||
float scaled = distance / sigma;
|
||||
return exp(-0.5 * scaled * scaled);
|
||||
}
|
||||
|
||||
float4 PS_Denoise(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float2 texel = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
|
||||
|
||||
float3 centre = tex2D(BackBuffer, uv).rgb;
|
||||
float3 intensity_sigma = max(pow(centre + 0.0001, Curve) * Strength, 0.0001);
|
||||
float spatial_sigma = max(Radius, 0.05);
|
||||
|
||||
float3 sum = float3(0.0, 0.0, 0.0);
|
||||
float3 total = float3(0.0, 0.0, 0.0);
|
||||
|
||||
[unroll] for (int y = -2; y <= 2; ++y)
|
||||
{
|
||||
[unroll] for (int x = -2; x <= 2; ++x)
|
||||
{
|
||||
float2 offset = float2(x, y);
|
||||
float3 tap = tex2D(BackBuffer, uv + offset * texel).rgb;
|
||||
float3 weight = IntensityWeight(tap, intensity_sigma, centre) *
|
||||
SpatialWeight(length(offset), spatial_sigma);
|
||||
sum += weight * tap;
|
||||
total += weight;
|
||||
}
|
||||
}
|
||||
|
||||
return float4(sum / total, 1.0);
|
||||
}
|
||||
|
||||
technique Denoise <
|
||||
ui_label = "Denoise";
|
||||
ui_tooltip = "Edge preserving blur that clears dithering and compression noise while leaving outlines sharp. Ported from Anime4K.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_Denoise;
|
||||
}
|
||||
}
|
||||
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Intensity <
|
||||
ui_type = "slider";
|
||||
ui_label = "Intensity";
|
||||
ui_min = 0.0; ui_max = 0.2; ui_step = 0.005;
|
||||
> = 0.03;
|
||||
|
||||
uniform float Size <
|
||||
ui_type = "slider";
|
||||
ui_label = "Size";
|
||||
ui_tooltip = "Grain cell size in pixels.";
|
||||
ui_min = 1.0; ui_max = 4.0; ui_step = 1.0;
|
||||
> = 1.0;
|
||||
|
||||
uniform float Colored <
|
||||
ui_type = "slider";
|
||||
ui_label = "Colour";
|
||||
ui_tooltip = "Zero gives monochrome grain, one gives independent noise per channel.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.01;
|
||||
> = 0.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float Hash(float2 p)
|
||||
{
|
||||
float3 scattered = frac(float3(p.x, p.y, p.x) * 0.1031);
|
||||
scattered += dot(scattered, scattered.yzx + 33.33);
|
||||
return frac((scattered.x + scattered.y) * scattered.z);
|
||||
}
|
||||
|
||||
float4 PS_FilmGrain(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float3 rgb = tex2D(BackBuffer, uv).rgb;
|
||||
|
||||
float2 cell = floor(pos.xy / max(Size, 1.0));
|
||||
float mono = Hash(cell) - 0.5;
|
||||
float3 chroma = float3(Hash(cell + 11.7), Hash(cell + 23.1), Hash(cell + 37.5)) - 0.5;
|
||||
float3 noise = lerp(float3(mono, mono, mono), chroma, Colored);
|
||||
|
||||
float luma = dot(rgb, float3(0.2126, 0.7152, 0.0722));
|
||||
float response = 1.0 - abs(luma * 2.0 - 1.0);
|
||||
|
||||
return float4(saturate(rgb + noise * Intensity * response), 1.0);
|
||||
}
|
||||
|
||||
technique FilmGrain <
|
||||
ui_label = "Film Grain";
|
||||
ui_tooltip = "Adds photographic grain, strongest in the midtones and fading out in blacks and whites.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_FilmGrain;
|
||||
}
|
||||
}
|
||||
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Exposure <
|
||||
ui_type = "slider";
|
||||
ui_label = "Exposure";
|
||||
ui_min = 0.5; ui_max = 2.0; ui_step = 0.01;
|
||||
> = 1.0;
|
||||
|
||||
uniform float Toe <
|
||||
ui_type = "slider";
|
||||
ui_label = "Toe";
|
||||
ui_tooltip = "Above 1.0 deepens the shadows, below 1.0 lifts them.";
|
||||
ui_min = 0.5; ui_max = 2.0; ui_step = 0.01;
|
||||
> = 1.2;
|
||||
|
||||
uniform float Shoulder <
|
||||
ui_type = "slider";
|
||||
ui_label = "Shoulder";
|
||||
ui_tooltip = "Above 1.0 opens up the highlights, below 1.0 compresses them.";
|
||||
ui_min = 0.5; ui_max = 2.0; ui_step = 0.01;
|
||||
> = 1.2;
|
||||
|
||||
uniform float Amount <
|
||||
ui_type = "slider";
|
||||
ui_label = "Amount";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.01;
|
||||
> = 0.7;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_FilmicCurve(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float3 rgb = tex2D(BackBuffer, uv).rgb;
|
||||
|
||||
float3 curved = saturate(rgb * Exposure);
|
||||
curved = pow(max(curved, 0.0), Toe);
|
||||
curved = 1.0 - pow(max(1.0 - curved, 0.0), Shoulder);
|
||||
|
||||
return float4(saturate(lerp(rgb, curved, Amount)), 1.0);
|
||||
}
|
||||
|
||||
technique FilmicCurve <
|
||||
ui_label = "Filmic Curve";
|
||||
ui_tooltip = "Filmic contrast curve. Deepens the shadows and opens the highlights without clipping either end.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_FilmicCurve;
|
||||
}
|
||||
}
|
||||
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Distortion <
|
||||
ui_type = "slider";
|
||||
ui_label = "Distortion";
|
||||
ui_tooltip = "Positive bulges the picture outwards, negative pinches it inwards.";
|
||||
ui_min = -0.5; ui_max = 0.5; ui_step = 0.01;
|
||||
> = 0.1;
|
||||
|
||||
uniform float Zoom <
|
||||
ui_type = "slider";
|
||||
ui_label = "Zoom";
|
||||
ui_tooltip = "Scales the picture to hide the edges the warp pulls in.";
|
||||
ui_min = 0.5; ui_max = 1.5; ui_step = 0.01;
|
||||
> = 1.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_LensDistortion(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float aspect = BUFFER_WIDTH * BUFFER_RCP_HEIGHT;
|
||||
float2 half_size = float2(aspect, 1.0);
|
||||
float2 unit = half_size / length(half_size);
|
||||
|
||||
float2 centred = (uv - 0.5) * 2.0 * unit;
|
||||
float r2 = dot(centred, centred);
|
||||
centred *= 1.0 + Distortion * r2;
|
||||
centred /= max(Zoom, 0.001);
|
||||
|
||||
float2 source = centred / (2.0 * unit) + 0.5;
|
||||
|
||||
return float4(tex2D(BackBuffer, source).rgb, 1.0);
|
||||
}
|
||||
|
||||
technique LensDistortion <
|
||||
ui_label = "Lens Distortion";
|
||||
ui_tooltip = "Barrel or pincushion warp, like looking through a wide angle lens.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_LensDistortion;
|
||||
}
|
||||
}
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float InputBlack <
|
||||
ui_type = "slider";
|
||||
ui_label = "Input Black";
|
||||
ui_tooltip = "Input level mapped to black. Raise it to deepen washed out shadows.";
|
||||
ui_min = 0.0; ui_max = 0.5; ui_step = 0.005;
|
||||
> = 0.0;
|
||||
|
||||
uniform float InputWhite <
|
||||
ui_type = "slider";
|
||||
ui_label = "Input White";
|
||||
ui_min = 0.5; ui_max = 1.0; ui_step = 0.005;
|
||||
> = 1.0;
|
||||
|
||||
uniform float Gamma <
|
||||
ui_type = "slider";
|
||||
ui_label = "Gamma";
|
||||
ui_min = 0.2; ui_max = 3.0; ui_step = 0.01;
|
||||
> = 1.0;
|
||||
|
||||
uniform float OutputBlack <
|
||||
ui_type = "slider";
|
||||
ui_label = "Output Black";
|
||||
ui_tooltip = "Lifts crushed shadows so detail stops collapsing into one flat black.";
|
||||
ui_min = 0.0; ui_max = 0.5; ui_step = 0.005;
|
||||
> = 0.0;
|
||||
|
||||
uniform float OutputWhite <
|
||||
ui_type = "slider";
|
||||
ui_label = "Output White";
|
||||
ui_min = 0.5; ui_max = 1.0; ui_step = 0.005;
|
||||
> = 1.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_Levels(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float3 rgb = tex2D(BackBuffer, uv).rgb;
|
||||
|
||||
rgb = saturate((rgb - InputBlack) / max(InputWhite - InputBlack, 0.001));
|
||||
rgb = pow(max(rgb, 0.0), 1.0 / max(Gamma, 0.001));
|
||||
rgb = lerp(OutputBlack, OutputWhite, rgb);
|
||||
|
||||
return float4(saturate(rgb), 1.0);
|
||||
}
|
||||
|
||||
technique Levels <
|
||||
ui_label = "Levels";
|
||||
ui_tooltip = "Black point, white point, gamma and output range. Use it to fix crushed or washed out shadows.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_Levels;
|
||||
}
|
||||
}
|
||||
Vendored
+88
@@ -0,0 +1,88 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Length <
|
||||
ui_type = "slider";
|
||||
ui_label = "Length";
|
||||
ui_tooltip = "How far the streaks reach, as a percentage of screen height.";
|
||||
ui_min = 0.0; ui_max = 20.0; ui_step = 0.5;
|
||||
> = 5.0;
|
||||
|
||||
uniform float Zoom <
|
||||
ui_type = "slider";
|
||||
ui_label = "Zoom";
|
||||
ui_tooltip = "Streaks running out from the centre of the screen, as if rushing forward. The centre stays sharp.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 1.0;
|
||||
|
||||
uniform float Pan <
|
||||
ui_type = "slider";
|
||||
ui_label = "Pan";
|
||||
ui_tooltip = "Streaks running in one fixed direction, as if the camera were sweeping across.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 0.0;
|
||||
|
||||
uniform float Angle <
|
||||
ui_type = "slider";
|
||||
ui_label = "Pan Angle";
|
||||
ui_tooltip = "Direction of the sweep, in degrees.";
|
||||
ui_min = 0.0; ui_max = 360.0; ui_step = 5.0;
|
||||
> = 0.0;
|
||||
|
||||
uniform float Spin <
|
||||
ui_type = "slider";
|
||||
ui_label = "Spin";
|
||||
ui_tooltip = "Streaks curling around the centre, as if the camera were rolling. Negative turns the other way.";
|
||||
ui_min = -1.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 0.0;
|
||||
|
||||
static const int TAPS = 24;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_MotionBlur(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float aspect = BUFFER_WIDTH * BUFFER_RCP_HEIGHT;
|
||||
float2 to_screen = float2(aspect, 1.0);
|
||||
|
||||
float2 centred = (uv - 0.5) * to_screen * 2.0;
|
||||
float2 outward = centred;
|
||||
float2 around = float2(-centred.y, centred.x);
|
||||
|
||||
float radians_angle = Angle * 0.01745329;
|
||||
float2 sweep = float2(cos(radians_angle), sin(radians_angle));
|
||||
|
||||
float2 velocity = sweep * Pan + outward * Zoom + around * Spin;
|
||||
velocity *= Length * 0.01;
|
||||
velocity /= to_screen;
|
||||
|
||||
float jitter = frac(sin(dot(pos.xy, float2(12.9898, 78.233))) * 43758.5453);
|
||||
|
||||
float3 sum = float3(0.0, 0.0, 0.0);
|
||||
[unroll] for (int i = 0; i < TAPS; ++i)
|
||||
{
|
||||
float t = (float(i) + jitter) / float(TAPS) - 0.5;
|
||||
sum += tex2D(BackBuffer, uv + velocity * t).rgb;
|
||||
}
|
||||
|
||||
return float4(sum / float(TAPS), 1.0);
|
||||
}
|
||||
|
||||
technique MotionBlur <
|
||||
ui_label = "Motion Blur";
|
||||
ui_tooltip = "Camera style motion blur: streaks the picture outwards, sideways or around, without touching still detail at the centre.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_MotionBlur;
|
||||
}
|
||||
}
|
||||
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2012 PPSSPP Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Ported from naturalA.fsh in PPSSPP, by ShadX, modified by SimoneT.
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Luma <
|
||||
ui_type = "slider";
|
||||
ui_label = "Luma Curve";
|
||||
ui_tooltip = "Gamma applied to the luminance channel in YIQ space.";
|
||||
ui_min = 0.5; ui_max = 2.0; ui_step = 0.01;
|
||||
> = 1.2;
|
||||
|
||||
uniform float Chroma <
|
||||
ui_type = "slider";
|
||||
ui_label = "Chroma Gain";
|
||||
ui_tooltip = "Boost applied to the two colour difference channels.";
|
||||
ui_min = 0.0; ui_max = 2.0; ui_step = 0.01;
|
||||
> = 1.2;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_Natural(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
const float3x3 RGBtoYIQ = float3x3(0.299, 0.587, 0.114,
|
||||
0.596, -0.275, -0.321,
|
||||
0.212, -0.523, 0.311);
|
||||
|
||||
const float3x3 YIQtoRGB = float3x3(1.0, 0.95568806, 0.61985809,
|
||||
1.0, -0.27158180, -0.64687382,
|
||||
1.0, -1.10817733, 1.70506456);
|
||||
|
||||
float3 rgb = tex2D(BackBuffer, uv).rgb;
|
||||
float3 yiq = mul(RGBtoYIQ, rgb);
|
||||
|
||||
yiq.x = pow(max(yiq.x, 0.0), Luma);
|
||||
yiq.yz *= Chroma;
|
||||
|
||||
return float4(saturate(mul(YIQtoRGB, yiq)), 1.0);
|
||||
}
|
||||
|
||||
technique NaturalColors <
|
||||
ui_label = "Natural Colours";
|
||||
ui_tooltip = "Warms the picture and lifts saturation for a less washed out look. Ported from the PPSSPP shader.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_Natural;
|
||||
}
|
||||
}
|
||||
Vendored
+90
@@ -0,0 +1,90 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Timer < source = "timer"; > = 0.0;
|
||||
|
||||
uniform float Horizon <
|
||||
ui_type = "slider";
|
||||
ui_label = "Reflection Line";
|
||||
ui_tooltip = "Height on screen where the reflective floor begins. Everything above it is left untouched.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.01;
|
||||
> = 0.55;
|
||||
|
||||
uniform float Amount <
|
||||
ui_type = "slider";
|
||||
ui_label = "Amount";
|
||||
ui_tooltip = "How strongly the reflection shows through the floor.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 0.35;
|
||||
|
||||
uniform float Falloff <
|
||||
ui_type = "slider";
|
||||
ui_label = "Falloff";
|
||||
ui_tooltip = "How quickly the reflection fades as the floor comes towards the viewer. At zero it stays even.";
|
||||
ui_min = 0.0; ui_max = 4.0; ui_step = 0.1;
|
||||
> = 1.2;
|
||||
|
||||
uniform float Perspective <
|
||||
ui_type = "slider";
|
||||
ui_label = "Perspective";
|
||||
ui_tooltip = "Stretches or squashes the mirrored image. One is a true mirror, higher values pull it towards the line.";
|
||||
ui_min = 0.2; ui_max = 2.0; ui_step = 0.05;
|
||||
> = 1.0;
|
||||
|
||||
uniform float Ripple <
|
||||
ui_type = "slider";
|
||||
ui_label = "Ripple";
|
||||
ui_tooltip = "Amplitude of the waves disturbing the reflection. At zero the mirror is perfectly still.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 0.0;
|
||||
|
||||
uniform float RippleSpeed <
|
||||
ui_type = "slider";
|
||||
ui_label = "Ripple Speed";
|
||||
ui_tooltip = "How fast the waves travel.";
|
||||
ui_min = 0.0; ui_max = 4.0; ui_step = 0.1;
|
||||
> = 1.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_Reflections(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float3 color = tex2D(BackBuffer, uv).rgb;
|
||||
|
||||
float depth = uv.y - Horizon;
|
||||
float on_floor = step(0.0, depth);
|
||||
float span = max(1.0 - Horizon, 0.001);
|
||||
float distance_down = saturate(depth / span);
|
||||
|
||||
float seconds = Timer * 0.001;
|
||||
float wave = sin(uv.x * 38.0 + seconds * RippleSpeed * 2.0) *
|
||||
sin(uv.y * 21.0 - seconds * RippleSpeed * 1.3);
|
||||
float2 disturbance = float2(wave * 0.004, wave * 0.002) * Ripple * distance_down;
|
||||
|
||||
float2 mirrored = float2(uv.x, Horizon - depth * Perspective) + disturbance;
|
||||
float3 reflection = tex2D(BackBuffer, saturate(mirrored)).rgb;
|
||||
|
||||
float fade = pow(max(1.0 - distance_down, 0.0001), Falloff);
|
||||
float strength = Amount * fade * on_floor;
|
||||
|
||||
return float4(lerp(color, reflection, strength), 1.0);
|
||||
}
|
||||
|
||||
technique Reflections <
|
||||
ui_label = "Reflections";
|
||||
ui_tooltip = "Mirrors the picture into a reflective floor below a line you choose, with optional water ripples.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_Reflections;
|
||||
}
|
||||
}
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2012 PPSSPP Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Ported from scanlines.fsh in PPSSPP.
|
||||
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Density <
|
||||
ui_type = "slider";
|
||||
ui_label = "Line Density";
|
||||
ui_tooltip = "Number of scanline pairs across the screen.";
|
||||
ui_min = 60.0; ui_max = 720.0; ui_step = 10.0;
|
||||
> = 340.0;
|
||||
|
||||
uniform float Intensity <
|
||||
ui_type = "slider";
|
||||
ui_label = "Intensity";
|
||||
ui_tooltip = "How dark the gaps between lines become.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 0.5;
|
||||
|
||||
uniform float Tint <
|
||||
ui_type = "slider";
|
||||
ui_label = "Phosphor Tint";
|
||||
ui_tooltip = "Strength of the green-warm phosphor cast.";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.05;
|
||||
> = 1.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_Scanlines(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float line_pos = uv.y * Density * 0.5;
|
||||
float gate = cos((frac(line_pos) - 0.5) * 3.1415926 * Intensity) * 1.5;
|
||||
|
||||
float3 rgb = tex2D(BackBuffer, uv).rgb;
|
||||
float3 color = rgb * 0.5 + 0.5 * rgb * rgb * 1.2;
|
||||
|
||||
float3 phosphor = lerp(float3(1.0, 1.0, 1.0), float3(0.9, 1.0, 0.7), Tint);
|
||||
color *= phosphor;
|
||||
|
||||
float2 diff = uv - 0.5;
|
||||
color *= 1.1 - 0.6 * (dot(diff, diff) * 2.0);
|
||||
|
||||
return float4(saturate(color * saturate(gate)), 1.0);
|
||||
}
|
||||
|
||||
technique Scanlines <
|
||||
ui_label = "Scanlines";
|
||||
ui_tooltip = "Darkens alternating rows of pixels to imitate the horizontal scanlines of a CRT. Cheaper than the full CRT effect when you only want the lines.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_Scanlines;
|
||||
}
|
||||
}
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Amount <
|
||||
ui_type = "slider";
|
||||
ui_label = "Amount";
|
||||
ui_min = 0.0; ui_max = 3.0; ui_step = 0.01;
|
||||
> = 0.6;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_Sharpen(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float2 texel = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
|
||||
|
||||
float3 centre = tex2D(BackBuffer, uv).rgb;
|
||||
float3 blur = tex2D(BackBuffer, uv + float2(-texel.x, 0.0)).rgb;
|
||||
blur += tex2D(BackBuffer, uv + float2(texel.x, 0.0)).rgb;
|
||||
blur += tex2D(BackBuffer, uv + float2(0.0, -texel.y)).rgb;
|
||||
blur += tex2D(BackBuffer, uv + float2(0.0, texel.y)).rgb;
|
||||
blur *= 0.25;
|
||||
|
||||
return float4(centre + (centre - blur) * Amount, 1.0);
|
||||
}
|
||||
|
||||
technique Sharpen <
|
||||
ui_label = "Sharpen";
|
||||
ui_tooltip = "Unsharp mask that brings back edge detail lost to scaling. Most useful after upscaling a low internal resolution.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_Sharpen;
|
||||
}
|
||||
}
|
||||
Vendored
+75
@@ -0,0 +1,75 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float ShadowHue <
|
||||
ui_type = "slider";
|
||||
ui_label = "Shadow Hue";
|
||||
ui_min = 0.0; ui_max = 360.0; ui_step = 1.0;
|
||||
> = 210.0;
|
||||
|
||||
uniform float ShadowStrength <
|
||||
ui_type = "slider";
|
||||
ui_label = "Shadow Strength";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.01;
|
||||
> = 0.0;
|
||||
|
||||
uniform float HighlightHue <
|
||||
ui_type = "slider";
|
||||
ui_label = "Highlight Hue";
|
||||
ui_min = 0.0; ui_max = 360.0; ui_step = 1.0;
|
||||
> = 45.0;
|
||||
|
||||
uniform float HighlightStrength <
|
||||
ui_type = "slider";
|
||||
ui_label = "Highlight Strength";
|
||||
ui_min = 0.0; ui_max = 1.0; ui_step = 0.01;
|
||||
> = 0.0;
|
||||
|
||||
uniform float Balance <
|
||||
ui_type = "slider";
|
||||
ui_label = "Balance";
|
||||
ui_tooltip = "Moves the split between what counts as shadow and what counts as highlight.";
|
||||
ui_min = -0.5; ui_max = 0.5; ui_step = 0.01;
|
||||
> = 0.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float3 HueToRGB(float hue)
|
||||
{
|
||||
float h = frac(hue / 360.0) * 6.0;
|
||||
return saturate(float3(abs(h - 3.0) - 1.0, 2.0 - abs(h - 2.0), 2.0 - abs(h - 4.0)));
|
||||
}
|
||||
|
||||
float4 PS_SplitToning(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float3 rgb = tex2D(BackBuffer, uv).rgb;
|
||||
|
||||
float luma = saturate(dot(rgb, float3(0.2126, 0.7152, 0.0722)) + Balance);
|
||||
|
||||
float3 shadow_tint = HueToRGB(ShadowHue) - 0.5;
|
||||
float3 highlight_tint = HueToRGB(HighlightHue) - 0.5;
|
||||
|
||||
rgb += shadow_tint * ShadowStrength * 0.25 * (1.0 - luma);
|
||||
rgb += highlight_tint * HighlightStrength * 0.25 * luma;
|
||||
|
||||
return float4(saturate(rgb), 1.0);
|
||||
}
|
||||
|
||||
technique SplitToning <
|
||||
ui_label = "Split Toning";
|
||||
ui_tooltip = "Tints the shadows and the highlights towards two different hues.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_SplitToning;
|
||||
}
|
||||
}
|
||||
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2012 PPSSPP Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Ported from vignette.fsh in PPSSPP, by Henrik Rydgard.
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Strength <
|
||||
ui_type = "slider";
|
||||
ui_label = "Strength";
|
||||
ui_tooltip = "How dark the corners become.";
|
||||
ui_min = 0.0; ui_max = 2.0; ui_step = 0.01;
|
||||
> = 0.6;
|
||||
|
||||
uniform float Aspect <
|
||||
ui_type = "slider";
|
||||
ui_label = "Aspect";
|
||||
ui_min = 0.5; ui_max = 2.0; ui_step = 0.01;
|
||||
> = 1.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 PS_Vignette(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float2 diff = uv - 0.5;
|
||||
diff.x *= Aspect;
|
||||
diff.y /= max(Aspect, 0.0001);
|
||||
|
||||
float falloff = 1.0 - min(1.0, Strength * dot(diff, diff) * 2.0);
|
||||
float3 rgb = tex2D(BackBuffer, uv).rgb;
|
||||
|
||||
return float4(rgb * falloff, 1.0);
|
||||
}
|
||||
|
||||
technique Vignette <
|
||||
ui_label = "Vignette";
|
||||
ui_tooltip = "Darkens the corners of the screen to pull the eye towards the middle, the way a camera lens falls off at its edges.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_Vignette;
|
||||
}
|
||||
}
|
||||
Vendored
+76
@@ -0,0 +1,76 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
texture BackBufferTex : COLOR;
|
||||
sampler BackBuffer { Texture = BackBufferTex; };
|
||||
|
||||
uniform float Temperature <
|
||||
ui_type = "slider";
|
||||
ui_label = "Temperature";
|
||||
ui_tooltip = "Negative cools the picture towards blue, positive warms it towards orange.";
|
||||
ui_min = -100.0; ui_max = 100.0; ui_step = 1.0;
|
||||
> = 0.0;
|
||||
|
||||
uniform float Tint <
|
||||
ui_type = "slider";
|
||||
ui_label = "Tint";
|
||||
ui_tooltip = "Negative shifts towards green, positive towards magenta.";
|
||||
ui_min = -100.0; ui_max = 100.0; ui_step = 1.0;
|
||||
> = 0.0;
|
||||
|
||||
void VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 uv : TEXCOORD)
|
||||
{
|
||||
uv = float2(float(id & 2), float((id & 1) << 1));
|
||||
pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
|
||||
float3 WhitePointLMS(float t1, float t2)
|
||||
{
|
||||
float shift = 0.05;
|
||||
if (t1 < 0.0)
|
||||
{
|
||||
shift = 0.10;
|
||||
}
|
||||
float x = 0.31271 - t1 * shift;
|
||||
float y = 2.87 * x - 3.0 * x * x - 0.27509507 + t2 * 0.05;
|
||||
|
||||
float big_y = 1.0;
|
||||
float big_x = big_y * x / y;
|
||||
float big_z = big_y * (1.0 - x - y) / y;
|
||||
|
||||
return float3( 0.7328 * big_x + 0.4296 * big_y - 0.1624 * big_z,
|
||||
-0.7036 * big_x + 1.6975 * big_y + 0.0061 * big_z,
|
||||
0.0030 * big_x + 0.0136 * big_y + 0.9834 * big_z);
|
||||
}
|
||||
|
||||
float4 PS_WhiteBalance(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target
|
||||
{
|
||||
float3 rgb = pow(max(tex2D(BackBuffer, uv).rgb, 0.0), 2.2);
|
||||
|
||||
float3 balance = float3(0.949237, 1.03542, 1.08728) /
|
||||
WhitePointLMS(Temperature / 65.0, Tint / 65.0);
|
||||
|
||||
const float3x3 rgb_to_lms = float3x3(0.390405, 0.549941, 0.008926,
|
||||
0.070841, 0.963172, 0.001358,
|
||||
0.023108, 0.128021, 0.936245);
|
||||
const float3x3 lms_to_rgb = float3x3( 2.858470, -1.628790, -0.024891,
|
||||
-0.210182, 1.158200, 0.000324,
|
||||
-0.041812, -0.118169, 1.068670);
|
||||
|
||||
float3 lms = mul(rgb_to_lms, rgb) * balance;
|
||||
rgb = mul(lms_to_rgb, lms);
|
||||
|
||||
return float4(saturate(pow(max(rgb, 0.0), 1.0 / 2.2)), 1.0);
|
||||
}
|
||||
|
||||
technique WhiteBalance <
|
||||
ui_label = "White Balance";
|
||||
ui_tooltip = "Corrects a picture that looks too cool, too warm or tinted.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = VS_PostProcess;
|
||||
PixelShader = PS_WhiteBalance;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user