mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-10 14:07:25 +00:00
ed566919f4
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>
75 lines
2.2 KiB
HLSL
75 lines
2.2 KiB
HLSL
// 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;
|
|
}
|
|
}
|