Annotations
This commit is contained in:
@@ -31,6 +31,8 @@ float normalizedFisheyeRadius(float theta, float halfFov)
|
||||
{
|
||||
float safeHalfFov = max(halfFov, 0.0001);
|
||||
|
||||
// Match common fisheye projection families while keeping the selected FOV
|
||||
// normalized to the same source-image radius.
|
||||
if (fisheyeModel == 1)
|
||||
{
|
||||
return sin(theta * 0.5) / max(sin(safeHalfFov * 0.5), 0.0001);
|
||||
@@ -49,6 +51,7 @@ float normalizedFisheyeRadius(float theta, float halfFov)
|
||||
|
||||
float3 equirectangularRay(float2 uv)
|
||||
{
|
||||
// Convert equirectangular UVs into longitude/latitude on the unit sphere.
|
||||
float longitude = (uv.x - 0.5) * TWO_PI;
|
||||
float latitude = (0.5 - uv.y) * PI;
|
||||
float latitudeCos = cos(latitude);
|
||||
@@ -82,6 +85,8 @@ float4 sampleEdgeFilledVideo(float2 sourceUv, ShaderContext context)
|
||||
float inwardLength = max(length(inward), 0.000001);
|
||||
inward /= inwardLength;
|
||||
|
||||
// Outside the fisheye image, sample back inward from the nearest edge so the
|
||||
// fill looks like stretched lens content instead of a hard color plate.
|
||||
float blurDistance = max(edgeBlur, 0.0);
|
||||
float4 color = sampleVideo(clampedUv) * 0.32;
|
||||
color += sampleVideo(saturate(clampedUv + inward * blurDistance * 0.35)) * 0.26;
|
||||
@@ -114,6 +119,7 @@ float4 shadeVideo(ShaderContext context)
|
||||
float phi = atan2(ray.y, ray.x);
|
||||
float fisheyeRadius = normalizedFisheyeRadius(theta, halfFov);
|
||||
|
||||
// Project the mirrored sphere ray back into the circular fisheye source.
|
||||
float2 sourceUv = float2(
|
||||
center.x + cos(phi) * fisheyeRadius * radius.x,
|
||||
center.y - sin(phi) * fisheyeRadius * radius.y
|
||||
|
||||
Reference in New Issue
Block a user