adjust shader vhs fuzzyness to match software at default res

the shader looks the same no matter the resolution, so we shouldnt scale this at all
thisll now treat rows for offsetting like its always default resolution (1280x800)
also readjusted the upwards bar since its actually the same size as the downwards bar lul
This commit is contained in:
alufolie91 committed 2026-11-15 23:55:32 +01:00
1 parent ce9245db79
commit bde1a623b4
2 files changed
+6 -10

No files matched your search

+4 -5
View File
@@ -457,20 +457,19 @@
"uniform vec2 scr_tex_size;\n" \
"uniform float vhs_time;\n" \
"uniform float vhs_rewind;\n" \
"uniform float scr_dup;\n" \
"void main(void) {\n" \
"vec2 uv = gl_TexCoord[0].st;\n" \
"vec2 maxuv = scr_resolution / scr_tex_size;\n" \
"float y = 1.0 - uv.y;\n" \
"float ystep = (2.0 / scr_resolution.y) * scr_dup / 4.0;\n" \
"float rand = fract(sin((floor(y / ystep) + vhs_time) * 12.9898 + 78.233) * 43758.5453);\n" \
"float y = (1.0 - uv.y);\n" \
"float ystep = floor(y * (800 / 2.0));\n" \
"float rand = fract(sin((ystep + vhs_time) * 12.9898 + 78.233) * 43758.5453);\n" \
"uv.x -= floor(rand * 128.0) / -22000.0;\n" \
"float updistort = (vhs_rewind > 0.5) ? 0.266667 : 0.16;\n" \
"float downdistort = updistort / 2.0;\n" \
"float downspd = (vhs_rewind > 0.5) ? 2.0 : 1.0;\n" \
"float upspd = (vhs_rewind > 0.5) ? 3.0 : 1.8;\n" \
"float downbar = max((1.0 - abs(2.0 * fract((vhs_time * downspd - y * 5.0) * 0.159155) - 1.0)) - 0.87, 0.0);\n" \
"float upbar = max((1.0 - abs(2.0 * fract(((vhs_time * -1.0) * upspd - y * 5.0) * 0.159155) - 1.0)) - 0.88, 0.0);\n" \
"float upbar = max((1.0 - abs(2.0 * fract(((vhs_time * -1.0) * upspd - y * 5.0) * 0.159155) - 1.0)) - 0.87, 0.0);\n" \
"uv.x -= downbar * downdistort;\n" \
"uv.x += upbar * updistort;\n" \
"uv.y = clamp(uv.y, 0.0, maxuv.y - 0.0001);\n" \
+2 -5
View File
@@ -774,7 +774,6 @@ typedef enum
gluniform_scr_resolution,
// postprocess stuff
gluniform_scr_dup,
gluniform_scr_tex_size,
// vhs
@@ -2352,8 +2351,7 @@ static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRG
UNIFORM_1(shader->uniforms[gluniform_leveltime], shader_leveltime, pglUniform1f);
UNIFORM_2(shader->uniforms[gluniform_scr_resolution], (GLfloat)screen_width, (GLfloat)screen_height, pglUniform2f);
// udup is before highres scale adjustments
UNIFORM_1(shader->uniforms[gluniform_scr_dup], (GLfloat)vid.udup, pglUniform1f);
// grrrrr stupid 2.0 support.. used similar to yfix, xfix
UNIFORM_2(shader->uniforms[gluniform_scr_tex_size], (GLfloat)screen_texsizew, (GLfloat)screen_texsizeh, pglUniform2f);
@@ -2493,7 +2491,6 @@ static boolean GL_Shader_CompileProgram(gl_shader_t *shader, GLint i)
shader->uniforms[gluniform_leveltime] = GETUNI("leveltime");
// postprocessor stuff (water/heat effect)
shader->uniforms[gluniform_scr_dup] = GETUNI("scr_dup");
shader->uniforms[gluniform_scr_tex_size] = GETUNI("scr_tex_size");
// vhs stuff
@@ -4063,7 +4060,7 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
const float ystep = 2.f/scrhf * (float)vid.udup/4.f;
for (i = 0; i < 1; i += ystep)
for (i = 0.0; i < 1.0; i += ystep)
{
// avoid calling rand thousands of times
r ^= r >> 13;