From b18b731dcc69373efa939741a2494c539072cf12 Mon Sep 17 00:00:00 2001 From: Themaister Date: Sun, 14 Nov 2010 14:36:37 +0100 Subject: [PATCH] Updated shaders a bit --- hqflt/cg/2xSaI.cg | 4 ++-- hqflt/cg/crt.cg | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hqflt/cg/2xSaI.cg b/hqflt/cg/2xSaI.cg index 158adaa687..91e9ecd470 100644 --- a/hqflt/cg/2xSaI.cg +++ b/hqflt/cg/2xSaI.cg @@ -68,8 +68,8 @@ struct deltas output main_fragment (float2 tex : TEXCOORD0, uniform input IN, uniform sampler2D s_p : TEXUNIT0) { float2 texsize = IN.texture_size; - float dx = 1.0/texsize.x * 0.25; - float dy = 1.0/texsize.y * 0.25; + float dx = pow(texsize.x, -1.0) * 0.25; + float dy = pow(texsize.y, -1.0) * 0.25; float3 dt = float3(1.0, 1.0, 1.0); deltas VAR = { diff --git a/hqflt/cg/crt.cg b/hqflt/cg/crt.cg index bee618ad38..701a3de494 100644 --- a/hqflt/cg/crt.cg +++ b/hqflt/cg/crt.cg @@ -52,8 +52,8 @@ output main_fragment(float2 texCoord : TEXCOORD0, uniform sampler2D decal : TEXU float2 rubyTextureSize = IN.texture_size; float2 xy = barrelDistortion(texCoord.xy); - float2 one = 1.0/rubyTextureSize; - xy = xy + float2(0.0 , -0.5 * (phase + (1-phase) * rubyInputSize.y/rubyOutputSize.y) * one.y); + float2 one = pow(rubyTextureSize, -1.0); + xy = xy + float2(0.0 , -0.5 * (phase + (1-phase) * rubyInputSize.y * pow(rubyOutputSize.y, -1.0) * one.y)); float4 texels[8]; texels[0] = TEX2D(xy + float2(-one.x,0.0)); texels[1] = TEX2D(xy); @@ -70,8 +70,8 @@ output main_fragment(float2 texCoord : TEXCOORD0, uniform sampler2D decal : TEXU float4 col, col2; float4 coeffs = float4(1.0 + uv_ratio.x, uv_ratio.x, 1.0 - uv_ratio.x, 2.0 - uv_ratio.x); - coeffs = (sin(PI * coeffs) * sin(PI * coeffs / 2.0)) / (coeffs * coeffs); - coeffs = coeffs / (coeffs.x+coeffs.y+coeffs.z+coeffs.w); + coeffs = (sin(PI * coeffs) * sin(PI * coeffs * 0.5)) / (coeffs * coeffs); + coeffs = coeffs * pow(coeffs.x+coeffs.y+coeffs.z+coeffs.w, -1.0); col = clamp(coeffs.x * texels[0] + coeffs.y * texels[1] + coeffs.z * texels[2] + coeffs.w * texels[3], 0.0, 1.0); col2 = clamp(coeffs.x * texels[4] + coeffs.y * texels[5] + coeffs.z * texels[6] + coeffs.w * texels[7], 0.0, 1.0); @@ -79,11 +79,11 @@ output main_fragment(float2 texCoord : TEXCOORD0, uniform sampler2D decal : TEXU col2 = pow(col2, gamma); float4 wid = 2 + 2 * pow(col, 4.0); - float4 weights = uv_ratio.y/0.3; - weights = 0.51*exp(-pow(weights*sqrt(2/wid),wid))/0.3/(0.6+0.2*wid); - wid = 2 + 4 * pow(col2,4.0); - float4 weights2 = (1.0-uv_ratio.y)/0.3; - weights2 = 0.51*exp(-pow(weights2*sqrt(2/wid),wid))/0.3/(0.6+0.2*wid); + float4 weights = uv_ratio.y * 3.333; + weights = 0.51*exp(-pow(weights*sqrt(2 * pow(wid, -1.0)),wid)) * 3.333 * pow(0.6+0.2*wid, -1.0); + wid = 2 + 4 * pow(col2, 4.0); + float4 weights2 = (1.0-uv_ratio.y) * 3.333; + weights2 = 0.51*exp(-pow(weights2*sqrt(2 * pow(wid, -1.0)),wid)) * 3.333 * pow(0.6+0.2*wid, -1.0); float4 mcol = 1.0; if ( fmod(xy.x*rubyOutputSize.x,2.0) < 1.0)