From 9f91fa8f4377a55b5837584f64f2f9820992851b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 4 May 2016 13:47:40 +0200 Subject: [PATCH] - make the warp2 shader's formula match the software renderer's. This fixes some jerkiness with vertical scrollers due to a bad sine period and makes the overall appearance of the effect what it was originally supposed to be. The old warp2 shader was not created by replicating the formula but by trial and error until it looked close enough. A version of the old warp2 shader with a fixed sine period is still available as a custom hardware shader. --- wadsrc/static/shaders/glsl/func_warp2.fp | 7 +++---- wadsrc/static/shaders/glsl/func_warp3.fp | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 wadsrc/static/shaders/glsl/func_warp3.fp diff --git a/wadsrc/static/shaders/glsl/func_warp2.fp b/wadsrc/static/shaders/glsl/func_warp2.fp index 7cc5e7ebb..ee712593d 100644 --- a/wadsrc/static/shaders/glsl/func_warp2.fp +++ b/wadsrc/static/shaders/glsl/func_warp2.fp @@ -7,11 +7,10 @@ vec4 ProcessTexel() const float pi = 3.14159265358979323846; vec2 offset = vec2(0.0,0.0); - float siny = sin(pi * 2.0 * (texCoord.y * 2.2 + timer * 0.75)) * 0.03; - offset.y = siny + sin(pi * 2.0 * (texCoord.x * 0.75 + timer * 0.75)) * 0.03; - offset.x = siny + sin(pi * 2.0 * (texCoord.x * 1.1 + timer * 0.45)) * 0.02; + offset.y = 0.5 + sin(pi * 2.0 * (texCoord.y + timer * 0.61 + 900.0/8192.0)) + sin(pi * 2.0 * (texCoord.x * 2.0 + timer * 0.36 + 300.0/8192.0)); + offset.x = 0.5 + sin(pi * 2.0 * (texCoord.y + timer * 0.49 + 700.0/8192.0)) + sin(pi * 2.0 * (texCoord.x * 2.0 + timer * 0.49 + 1200.0/8192.0)); - texCoord += offset; + texCoord += offset * 0.025; return getTexel(texCoord); } diff --git a/wadsrc/static/shaders/glsl/func_warp3.fp b/wadsrc/static/shaders/glsl/func_warp3.fp new file mode 100644 index 000000000..a81969ca6 --- /dev/null +++ b/wadsrc/static/shaders/glsl/func_warp3.fp @@ -0,0 +1,18 @@ +uniform float timer; + +vec4 ProcessTexel() +{ + vec2 texCoord = vTexCoord.st; + + const float pi = 3.14159265358979323846; + vec2 offset = vec2(0.0,0.0); + + float siny = sin(pi * 2.0 * (texCoord.y * 2.0 + timer * 0.75)) * 0.03; + offset.y = siny + sin(pi * 2.0 * (texCoord.x + timer * 0.75)) * 0.03; + offset.x = siny + sin(pi * 2.0 * (texCoord.x + timer * 0.45)) * 0.02; + + texCoord += offset; + + return getTexel(texCoord); +} +