Should fix quad shader. :P
This commit is contained in:
parent
dcf5667e73
commit
c560ccbabc
|
@ -51,21 +51,37 @@ float3 quad_inter(float3 x0, float3 x1, float3 x2, float x)
|
|||
output main_fragment (float2 tex : TEXCOORD0, uniform input IN, uniform sampler2D s0 : TEXUNIT0)
|
||||
{
|
||||
float2 texsize = IN.texture_size;
|
||||
float dx = float(pow(1.0 * texsize.x, -1.0));
|
||||
float dy = float(pow(1.0 * texsize.y, -1.0));
|
||||
float sharpness = 2.0;
|
||||
float dx = float(pow(sharpness * texsize.x, -1.0));
|
||||
float dy = float(pow(sharpness * texsize.y, -1.0));
|
||||
|
||||
float3 c00 = tex2D(s0, tex + float2(-dx, -dy)).xyz;
|
||||
float3 c01 = tex2D(s0, tex + float2(-dx, 0)).xyz;
|
||||
float3 c02 = tex2D(s0, tex + float2(-dx, dy)).xyz;
|
||||
float3 c10 = tex2D(s0, tex + float2(0, -dy)).xyz;
|
||||
float3 c11 = tex2D(s0, tex + float2(0, 0)).xyz;
|
||||
float3 c12 = tex2D(s0, tex + float2(0, dy)).xyz;
|
||||
float3 c20 = tex2D(s0, tex + float2(dx, -dy)).xyz;
|
||||
float3 c21 = tex2D(s0, tex + float2(dx, 0)).xyz;
|
||||
float3 c22 = tex2D(s0, tex + float2(dx, dy)).xyz;
|
||||
|
||||
float blur = 1.5;
|
||||
float3 xval0 = quad_inter(c01, c11, c21, blur*(frac(tex.x * texsize.x)) + (2.0 - blur) * 0.5);
|
||||
float3 yval0 = quad_inter(c10, c11, c12, blur*(frac(tex.y * texsize.y)) + (2.0 - blur) * 0.5);
|
||||
float frac_amt_x = frac(tex.x * texsize.x);
|
||||
float frac_amt_y = frac(tex.y * texsize.y);
|
||||
float3 loval = quad_inter(c00, c10, c20, frac_amt_x + 0.5);
|
||||
float3 midval = quad_inter(c01, c11, c21, frac_amt_x + 0.5);
|
||||
float3 hival = quad_inter(c02, c12, c22, frac_amt_x + 0.5);
|
||||
float3 res = quad_inter(loval, midval, hival, frac_amt_y + 0.5);
|
||||
|
||||
output OUT;
|
||||
OUT.color = float4(lerp(xval0, yval0, 0.5), 1.0);
|
||||
|
||||
// Bilinear!
|
||||
// float3 first = lerp(c00, c20, frac(tex.x * texsize.x + 0.5));
|
||||
// float3 second = lerp(c02, c22, frac(tex.x * texsize.x + 0.5));
|
||||
// float3 res = lerp(first, second, frac(tex.y * texsize.y + 0.5));
|
||||
// OUT.color = float4(res, 1.0);
|
||||
|
||||
|
||||
OUT.color = float4(res, 1.0);
|
||||
return OUT;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue