Evgenii Golubev
7 年前
当前提交
14a2be10
共有 5 个文件被更改,包括 96 次插入 和 6 次删除
-
6ScriptableRenderPipeline/Core/ShaderLibrary/Random.hlsl
-
41ScriptableRenderPipeline/Core/ShaderLibrary/VolumeRendering.hlsl
-
2ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/AtmosphericScattering.hlsl
-
44ScriptableRenderPipeline/Core/ShaderLibrary/Filtering.hlsl
-
9ScriptableRenderPipeline/Core/ShaderLibrary/Filtering.hlsl.meta
|
|||
#ifndef UNITY_FILTERING_INCLUDED |
|||
#define UNITY_FILTERING_INCLUDED |
|||
|
|||
#if !defined(SHADER_API_GLES) |
|||
|
|||
// 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) |
|||
{ |
|||
return 0.5 * x * x; |
|||
} |
|||
|
|||
float2 BSpline2IntMiddle(float2 x) |
|||
{ |
|||
return (1 - x) * x + 0.5; |
|||
} |
|||
|
|||
float2 BSpline2IntRight(float2 x) |
|||
{ |
|||
return (0.5 * x - 1) * x + 0.5; |
|||
} |
|||
|
|||
// Compute weights & offsets for 4x bilinear taps for the biquadratic B-Spline filter. |
|||
// The fractional coordinate should be in the [0, 1] range (centered on 0.5). |
|||
// Inspired by: http://vec3.ca/bicubic-filtering-in-fewer-taps/ |
|||
void BiquadraticFilter(float2 fracCoord, out float2 weights[2], out float2 offsets[2]) |
|||
{ |
|||
float2 l = BSpline2IntLeft(fracCoord); |
|||
float2 m = BSpline2IntMiddle(fracCoord); |
|||
float2 r = 1 - l - m; |
|||
|
|||
// Compute offsets for 4x bilinear taps for the quadratic B-Spline reconstruction kernel. |
|||
// 0: lerp between left and middle |
|||
// 1: lerp between middle and right |
|||
weights[0] = l + 0.5 * m; |
|||
weights[1] = r + 0.5 * m; |
|||
offsets[0] = -0.5 + 0.5 * m * rcp(weights[0]); |
|||
offsets[1] = 0.5 + r * rcp(weights[1]); |
|||
} |
|||
|
|||
#endif // SHADER_API_GLES |
|||
|
|||
#endif // UNITY_FILTERING_INCLUDED |
|
|||
fileFormatVersion: 2 |
|||
guid: 996afc944d3a3534a8b9b09d0b79843a |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue