Petros Bantolas

Building a Cross-Platform Planetarium Renderer with C++ and bgfx

Custom iOS/Android graphics engine delivering <5ms load times, 60-120 FPS, and full source ownership in 10 weeks

Thumbnail for Building a Cross-Platform Planetarium Renderer with C++ and bgfx
C++ BGFX Rendering Engine Mobile Graphics Cross-Platform

Overview

A scientific hardware startup needed a high-performance planetarium visualization system for their telescope/binocular companion app. After an earlier OpenGL prototype raised concerns about iOS deprecation, they needed a modern, cross-platform rendering solution that could integrate into their native app with minimal overhead. I conducted a feasibility study and built a custom C++ rendering engine using bgfx over a 10-week engagement.

The Challenge

The client’s hardware products (smart binoculars and telescopes) connect to a mobile app that directs the device to celestial objects. Their existing sky navigation interface wasn’t intuitive enough for quick target selection. Planetarium-style visualization would provide more intuitive target selection, but presented technical constraints:

  • Platform requirements: Native iOS/Android integration with Metal/OpenGL ES/Vulkan support
  • Performance: Sub-5-second load times and responsive interaction on mid-range devices
  • Ownership: Small product team needed a custom solution they coul maintain and extend
  • Timeline: 10-week window to validate feasibility and deliver working prototype

Approach

I conducted a feasibility study evaluating rendering solutions against their platform requirements and team capacity. Given the small team size and cross-platform needs, I recommended bgfx, a rendering library supporting their target graphics APIs without the overhead of full game engines.

The engagement was structured as:

  1. Technical feasibility study (bgfx evaluation, high level rendering architecture, time estimates)
  2. 10-week prototype sprint
  3. Engine ownership model with documentation for in-house integration

Technical Implementation

Built a custom data-driven rendering engine in modern C++, optimized for celestial visualization. Used CMake for the build system and a C API for Swift/Kotlin interoperability.

Rendering Pipeline:

  • 1000+ celestial objects (stars, deep-sky objects, planets)
  • Multiple rendering techniques: texture sprites, ellipsoid primitives, MSDF text rendering, variable-width anti-aliased lines
  • Sprite batching for efficient multi-instance rendering

Terrain Visualisation:

  • Line simplification to compress terrain silhouettes without visible quality loss
  • Zoom-based POI filtering

Architecture:

  • Minimal C API for cross-platform integration
  • FlatBuffers-based data ingestion for celestial and terrain data
  • Reactive state updates: Data sent only on camera/zoom changes rather than per-frame
  • Callback system for bidirectional engine-app communication

Results

  • <5ms load time from data receipt to first frame
  • 60-120 FPS on iOS test devices
  • Working prototype delivered within 10-week timeline
  • Follow-on engagement planned for feature expansion

Deliverables

  • Custom C++ rendering engine with full source ownership
  • Technical documentation and integration guide
  • Build tooling and scripts