Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mapsphere

The Las Vegas Sphere, alive inside Apple Maps.

Custom animated geometry injected into Apple Maps' own Metal render pass — so the map's real 3D buildings occlude it natively, no compositing tricks. Inspired by Charly Delaroche's "same pass · injected geometry" demo; there is no public MapKit API for this (checked the iOS 26.5 SDK), so everything here is runtime reverse engineering.

Emoji face (blinks, looks around, tracks the camera) Trippy LED plasma Night orbit
face trippy night

How it works

  1. Get inside the map's renderer. Swizzle CAMetalLayer.nextDrawable plus the concrete MTLCommandBuffer.renderCommandEncoderWithDescriptor: / MTLRenderCommandEncoder.endEncoding classes. The map's main scene pass is the one with a depth attachment whose color target is the drawable. Just before that pass ends, encode our own draw call — same encoder, same depth buffer, so VectorKit's geometry depth-tests against ours for free.

  2. Match the camera. Rebuild the view-projection from MKMapCamera (ENU meters at the site) and calibrate the unknowns against mapView.convert(_:toPointTo:) ground samples at runtime. Apple Maps renders with a ~29.6° vertical FOV and a slight vertical principal-point offset (~3 px reprojection residual).

  3. Match the depth mapping. The map's depth buffer is memoryless, so we substitute our own depth texture into the pass descriptor before encoder creation, then read it back post-pass with a tiny compute kernel at pixels we know are flat ground. A robust Theil–Sen fit recovers VectorKit's actual mapping — it's logarithmic depth — which our vertex shader then emits directly. Result: correct occlusion against buildings at every distance.

  4. The ball. A UV sphere at the Sphere's real site (36.12124, −115.16207), real dimensions (157 m wide, truncated at plaza level), shelled just proud of Apple's own dark Sphere model. Shaders are compiled at runtime from source (no metallib step). Two modes: LED-grid plasma, and an emoji face with gaussian blinks, wandering pupils, and lazy camera tracking.

Run it

./build.sh            # swiftc → .app → boots an iPhone simulator → installs → launches

No Xcode project — plain swiftc against the iphonesimulator SDK. Tested with Xcode 26.6 / iOS 26.5 simulator.

On-screen: orbit toggles the auto-orbit, face switches shader modes, the slider tunes the depth-fit near constant.

Launch-time knobs (prefix with SIMCTL_CHILD_ via simctl launch):

var default
SHADER_MODE 0 0 plasma, 1 face
ORBIT / CAM_H / CAM_P / CAM_D 1 / 210 / 55 / 1400 orbit on, heading°, pitch°, distance m
SPHERE_R / SPHERE_ALT / CUT_Z 82.5 / 33.5 / 3 ball radius, center height, ground cut (m)
SPHERE_DE / SPHERE_DN 0 / 0 position nudge east/north (m)
DEPTH_MODE always force less / rev instead of the probe fit
PROBE_APPLY 1 0 disables the fitted depth mapping

Caveats

  • Swizzles private rendering internals of MapKit/VectorKit — a demo/research hack, not App Store material, and any iOS update may break it.
  • Only exercised on the iOS simulator; on-device Metal class names and pass structure may differ.
  • The FOV/depth constants aren't hardcoded guesses — they're re-fitted live — so it should self-adapt, but no promises.

MIT

About

The Las Vegas Sphere, alive inside Apple Maps — custom Metal geometry injected into MapKit's render pass with real building occlusion

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages