Skip to content

Translate the Yale Bright Star Catalog to a glTF 3D model

License

Notifications You must be signed in to change notification settings

michaelfranzl/gltf-starfield

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glTF Starfield

"My god, it's full of stars ..."

A Deno program to translate the Yale Bright Star Catalog to glTF.

Example rendering

This 3D model of the starfield visible from Earth typically would be used to render a background layer over which other layers can be composited. All stars are on the surface of the unit sphere and face its center. To give the illusion of the stars being infinitely far away, their rendering camera should naturally be always located at the center of the unit sphere (never translate the camera, only rotate it).

Usage

deno run --allow-net --allow-read --allow-write --allow-run main.ts # produces starfield.glb (~ 2MB)

Dependencies

Details

  • The database http://tdc-www.harvard.edu/catalogs/bsc5.dat.gz is downloaded, decompressed, and its ~9k entries are parsed.
  • 10 Materials are created from the spectral classification of stars (OWBAFGKMCS). The colors of the materials were taken from the HTML code of https://en.wikipedia.org/wiki/Stellar_classification#Harvard_spectral_classification and are set as base factors as well as emissive factors.
    • The extras field contains:
      • cls: Spectral class (a letter from the set OWBAFGKMCS)
  • Each star in the catalog becomes one node.
    • A single octagon (in triangle strip mode) is referenced by all mesh primitives.
    • The scale is calculated from the star's apparent magnitude.
    • The translation puts it on the surface of the unit sphere according to the star's right ascension and declination.
    • The rotation makes it face the unit sphere center.
    • The material is selected according to the star's spectral classification.
    • The extras field contains:
      • mag: Apparent magnitude
      • bsn: The numeric BSN ID
      • name: A name concatenated from the two name fields in the DB

About

Translate the Yale Bright Star Catalog to a glTF 3D model

Topics

Resources

License

Stars

Watchers

Forks