summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/render')
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_post.sc28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_post.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_post.sc
index 68fe25a32cc..6434c3dae2f 100644
--- a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_post.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_post.sc
@@ -3,7 +3,7 @@ $input v_color0, v_texcoord0
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz,ImJezze
//-----------------------------------------------------------------------------
-// Defocus Effect
+// Scanline & Shadowmask Effect
//-----------------------------------------------------------------------------
#include "common.sh"
@@ -33,7 +33,7 @@ uniform vec4 u_power;
uniform vec4 u_floor;
// Parametric
-uniform vec4 u_time;
+uniform vec4 u_time; // milliseconds
uniform vec4 u_jitter_amount;
// Samplers
@@ -44,19 +44,19 @@ SAMPLER2D(s_shadow, 1);
// Scanline & Shadowmask Pixel Shader
//-----------------------------------------------------------------------------
-vec2 GetAdjustedCoords(vec2 coord, vec2 center_offset)
+vec2 GetAdjustedCoords(vec2 coord)
{
// center coordinates
- coord -= center_offset;
+ coord -= 0.5;
// apply screen scale
coord *= u_screen_scale.xy;
// un-center coordinates
- coord += center_offset;
+ coord += 0.5;
// apply screen offset
- coord += (center_offset * 2.0) * u_screen_offset.xy;
+ coord += u_screen_offset.xy;
return coord;
}
@@ -64,19 +64,19 @@ vec2 GetAdjustedCoords(vec2 coord, vec2 center_offset)
// vector screen has the same quad texture coordinates for every screen orientation, raster screen differs
vec2 GetShadowCoord(vec2 QuadCoord, vec2 SourceCoord)
{
- vec2 QuadTexel = vec2(1.0, 1.0) / u_quad_dims.xy;
+ vec2 QuadTexel = vec2(1.0, 1.0) / (u_quad_dims.xy - 0.5f);
vec2 canvasCoord = QuadCoord + u_shadow_uv_offset.xy / u_quad_dims.xy;
vec2 shadowUV = u_shadow_uv.xy;
vec2 shadowCount = u_shadow_count.xy;
- // swap x/y vector and raster in screen mode (not source mode)
+ // swap x/y in screen mode (not source mode)
canvasCoord = u_swap_xy.x > 0.0
? canvasCoord.yx
: canvasCoord.xy;
- // swap x/y vector and raster in screen mode (not source mode)
+ // swap x/y in screen mode (not source mode)
shadowCount = u_swap_xy.x > 0.0
? shadowCount.yx
: shadowCount.xy;
@@ -85,7 +85,7 @@ vec2 GetShadowCoord(vec2 QuadCoord, vec2 SourceCoord)
vec2 shadowFrac = fract(canvasCoord / shadowTile);
- // swap x/y raster in screen mode (not vector and not source mode)
+ // swap x/y in screen mode (not source mode)
shadowFrac = u_swap_xy.x > 0.0
? shadowFrac.yx
: shadowFrac.xy;
@@ -97,7 +97,7 @@ vec2 GetShadowCoord(vec2 QuadCoord, vec2 SourceCoord)
void main()
{
- vec2 BaseCoord = GetAdjustedCoords(v_texcoord0, vec2(0.5, 0.5));
+ vec2 BaseCoord = GetAdjustedCoords(v_texcoord0);
// Color
vec4 BaseColor = texture2D(s_tex, BaseCoord);
@@ -136,8 +136,8 @@ void main()
float ColorBrightness = 0.299 * BaseColor.r + 0.587 * BaseColor.g + 0.114 * BaseColor.b;
- float ScanCoord = BaseCoord.y * u_source_dims.y * u_scanline_scale.x * 3.1415927;
- float ScanCoordJitter = u_scanline_jitter.x * u_jitter_amount.x * 1.618034;
+ float ScanCoord = BaseCoord.y * u_source_dims.y * u_scanline_scale.x * 3.1415927; // PI
+ float ScanCoordJitter = u_scanline_jitter.x * u_jitter_amount.x * 1.618034; // PHI
float ScanSine = sin(ScanCoord + ScanCoordJitter);
float ScanlineWide = u_scanline_height.x + u_scanline_variation.x * max(1.0, u_scanline_height.x) * (1.0 - ColorBrightness);
float ScanSineScaled = pow(ScanSine * ScanSine, ScanlineWide);
@@ -149,7 +149,7 @@ void main()
// Hum Bar Simulation
if (u_humbar_alpha.x > 0.0f)
{
- float HumTimeStep = fract(u_time.x * 0.001);
+ float HumTimeStep = fract(u_time.x * u_humbar_hertz_rate.x);
float HumBrightness = 1.0 - fract(BaseCoord.y + HumTimeStep) * u_humbar_alpha.x;
BaseColor.rgb *= HumBrightness;
}