Skip to content

horizonator_init: optionally restrict the mesh to the azimuth wedge in use - #6

Open
thannart wants to merge 3 commits into
dkogan:masterfrom
thannart:restrict-mesh-azimuth
Open

thannart wants to merge 3 commits into
dkogan:masterfrom
thannart:restrict-mesh-azimuth

Conversation

@thannart

@thannart thannart commented Sep 4, 2026

Copy link
Copy Markdown

Only mesh the azimuth wedge actually rendered (plus a small margin), instead of the full 360-degree circle of loaded DEM data. Enabled by default in standalone (verified pixel-identical output, 36-44% faster). Interactive tool and Python bindings keep the old full-circle behavior since they allow panning after load. Builds on #4 and #5.

thannart and others added 3 commits September 3, 2026 21:48
Lets you account for the fact that the viewer isn't standing at ground
level (e.g. an apartment floor), by reusing horizonator_move() to
reposition the camera at ground_elevation + viewer_height after the
usual auto-selected ground elevation is computed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…correction

The renderer worked entirely in the tangent plane at the viewer, ignoring
Earth's curvature. This is a good approximation at short range, but at
the 100-150km distances relevant for viewing the Alps from Lyon, a
distant peak's apparent elevation angle can be off by more than a
kilometer of apparent height.

Add the standard geodetic "curvature and refraction" correction:
  drop = (1-k) * distance^2 / (2*Rearth)
subtracted from each vertex's apparent height, where k is the
atmospheric refraction coefficient (k=0.13, the Gaussian refraction
coefficient used by udeuschle.de, is the default).

New horizonator_set_curvature() API, and --curvature / --refraction-k
flags on standalone. Off by default, so existing behavior is unchanged
unless --curvature is explicitly requested; this lets the flat-plane and
curved renders be compared directly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…n use

The renderer always built a mesh covering the full 360-degree circle of
loaded DEM data, even for a render that only ever looks at a narrow
azimuth wedge (e.g. a fixed 110-degree panorama). Most of that geometry
was never visible and cost triangle-generation/vertex-shader time every
frame for nothing.

horizonator_init() takes 3 new parameters: restrict_mesh_azimuth,
mesh_az_deg0, mesh_az_deg1. When set, only cells within that azimuth
range (plus a 5-degree margin, plus a small radius always meshed near
the viewer where per-cell azimuth changes too fast to test reliably)
are triangulated; the rest of the loaded square is skipped in the index
buffer. Vertex generation, DEM sampling and the shaders are untouched.

standalone (a single fixed-wedge render per invocation) enables this by
default, since the meshed wedge always matches the rendered wedge
exactly -- verified pixel-identical output on 3 different az/height
combinations, 36-44% faster wall-clock render time. Pass
--no-restrict-mesh-azimuth to fall back to the old full-circle mesh.

The interactive horizonator tool and the Python bindings pass
restrict_mesh_azimuth=false, since they let the viewer pan around after
the data is loaded, potentially outside whatever wedge was meshed at
init time.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant