diff --git a/tooling/planet-gen/planet_renderer.py b/tooling/planet-gen/planet_renderer.py index 6a20c8504..95f46548b 100644 --- a/tooling/planet-gen/planet_renderer.py +++ b/tooling/planet-gen/planet_renderer.py @@ -189,7 +189,10 @@ def _raytrace(size: int, r: float = 1.0, oblateness: float = 0.0): nx /= nm; ny /= nm; nz /= nm # UV from undistorted hit point - u = (np.arctan2(hz, hx) / (2.0 * math.pi)) % 1.0 + # arctan2(hx, hz) so longitude increases eastward (right on screen). + # +0.5 offset centers the view on 0° longitude (Greenwich) instead of + # 180° (dateline), keeping the seam on the back of the sphere. + u = (np.arctan2(hx, hz) / (2.0 * math.pi) + 0.5) % 1.0 v = np.arcsin(np.clip(hy / np.where(hit, np.sqrt(hx**2 + hy**2 + hz**2), 1.0), -1.0, 1.0)) / math.pi + 0.5 return hit, nx.astype(np.float32), ny.astype(np.float32), nz.astype(np.float32), u.astype(np.float32), v.astype(np.float32)