Annotations
This commit is contained in:
@@ -43,6 +43,8 @@ float normalizedFisheyeRadius(float theta, float halfFov)
|
||||
{
|
||||
float safeHalfFov = max(halfFov, 0.0001);
|
||||
|
||||
// Different fisheye lenses map angle to image radius differently. Normalize
|
||||
// each model by the selected half-FOV so the outer lens edge stays at 1.0.
|
||||
if (fisheyeModel == 1)
|
||||
{
|
||||
return sin(theta * 0.5) / max(sin(safeHalfFov * 0.5), 0.0001);
|
||||
@@ -67,6 +69,8 @@ float4 shadeVideo(ShaderContext context)
|
||||
float virtualFov = radiansFromDegrees(clamp(virtualFovDegrees, 1.0, 175.0));
|
||||
float tanHalfFov = tan(virtualFov * 0.5);
|
||||
|
||||
// Build a virtual output-camera ray, then rotate it into the fisheye lens
|
||||
// coordinate system before asking where that ray lands on the source image.
|
||||
float3 ray = outputProjection == 1
|
||||
? buildCylindricalRay(screen, outputAspect, tanHalfFov)
|
||||
: buildRectilinearRay(screen, outputAspect, tanHalfFov);
|
||||
@@ -86,6 +90,7 @@ float4 shadeVideo(ShaderContext context)
|
||||
float phi = atan2(ray.y, ray.x);
|
||||
float fisheyeRadius = normalizedFisheyeRadius(theta, halfFov);
|
||||
|
||||
// Polar lens coordinates become UVs inside the circular fisheye image.
|
||||
float2 sourceUv = float2(
|
||||
center.x + cos(phi) * fisheyeRadius * radius.x,
|
||||
center.y - sin(phi) * fisheyeRadius * radius.y
|
||||
|
||||
Reference in New Issue
Block a user