浏览代码

Use real in Filtering.hlsl

/Yibing-Project-2
Evgenii Golubev 7 年前
当前提交
b61606f0
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 14
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Filtering.hlsl

14
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Filtering.hlsl


// Cardinal (interpolating) B-Spline of the 2nd degree (3rd order). Support = 3x3.
// The fractional coordinate of each part is assumed to be in the [0, 1] range (centered on 0.5).
// https://www.desmos.com/calculator/47j9r9lolm
float2 BSpline2IntLeft(float2 x)
real2 BSpline2IntLeft(real2 x)
float2 BSpline2IntMiddle(float2 x)
real2 BSpline2IntMiddle(real2 x)
float2 BSpline2IntRight(float2 x)
real2 BSpline2IntRight(real2 x)
{
return (0.5 * x - 1) * x + 0.5;
}

// Inspired by: http://vec3.ca/bicubic-filtering-in-fewer-taps/
void BiquadraticFilter(float2 fracCoord, out float2 weights[2], out float2 offsets[2])
void BiquadraticFilter(real2 fracCoord, out real2 weights[2], out real2 offsets[2])
float2 l = BSpline2IntLeft(fracCoord);
float2 m = BSpline2IntMiddle(fracCoord);
float2 r = 1 - l - m;
real2 l = BSpline2IntLeft(fracCoord);
real2 m = BSpline2IntMiddle(fracCoord);
real2 r = 1 - l - m;
// Compute offsets for 4x bilinear taps for the quadratic B-Spline reconstruction kernel.
// 0: lerp between left and middle

正在加载...
取消
保存