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:
1 parent
bc4c1637ad
commit
f332e21fa7
2 files changed
+6
-10
No files matched your search
@@ -427,20 +427,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" \
|
||||
|
||||
@@ -762,7 +762,6 @@ typedef enum
|
||||
gluniform_scr_resolution,
|
||||
|
||||
// postprocess stuff
|
||||
gluniform_scr_dup,
|
||||
gluniform_scr_tex_size,
|
||||
|
||||
// vhs
|
||||
@@ -2340,8 +2339,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);
|
||||
|
||||
@@ -2481,7 +2479,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
|
||||
@@ -3944,7 +3941,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;
|
||||
|
||||
Reference in new issue
Block a user