data storage
This commit is contained in:
@@ -61,6 +61,20 @@ float normalizedFisheyeRadius(float theta, float halfFov)
|
||||
return theta / safeHalfFov;
|
||||
}
|
||||
|
||||
float sourceUvRectMask(float2 uv, float2 inputResolution)
|
||||
{
|
||||
float2 pixel = 1.0 / max(inputResolution, float2(1.0, 1.0));
|
||||
float cut = max(sourceEdgeCut, 0.0);
|
||||
float feather = max(sourceEdgeFeather, 0.0);
|
||||
float2 featherSize = max(float2(feather, feather), pixel * 0.5);
|
||||
|
||||
float left = smoothstep(cut, cut + featherSize.x, uv.x);
|
||||
float right = 1.0 - smoothstep(1.0 - cut - featherSize.x, 1.0 - cut, uv.x);
|
||||
float top = smoothstep(cut, cut + featherSize.y, uv.y);
|
||||
float bottom = 1.0 - smoothstep(1.0 - cut - featherSize.y, 1.0 - cut, uv.y);
|
||||
return saturate(left * right * top * bottom);
|
||||
}
|
||||
|
||||
float4 shadeVideo(ShaderContext context)
|
||||
{
|
||||
float2 screen = float2(context.uv.x * 2.0 - 1.0, 1.0 - context.uv.y * 2.0);
|
||||
@@ -99,5 +113,7 @@ float4 shadeVideo(ShaderContext context)
|
||||
if (sourceUv.x < 0.0 || sourceUv.x > 1.0 || sourceUv.y < 0.0 || sourceUv.y > 1.0)
|
||||
return outsideColor;
|
||||
|
||||
return sampleVideo(sourceUv);
|
||||
float sourceMask = sourceUvRectMask(sourceUv, context.inputResolution);
|
||||
float4 sourceColor = sampleVideo(sourceUv);
|
||||
return saturate(lerp(outsideColor, sourceColor, sourceMask));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user