Skip to the content

Hoshi Stars星

The stars you can see without a telescope, with names, colours and distances; the 88 constellations with their lines and boundaries; the Messier objects; and seven map projections to draw them on.

Hoshi is the Japanese word 星 for a star. About the name

Contents

Reference · The Milky Way: a brightness map and soft bands to draw

milkyWayTexturefunction

The Milky Way painted as a texture for a WebGL sky (or a canvas): a picture twice as wide as it is high covering the whole sky, coloured from the brightness grid by a ramp. It is read with detail (1 by default, see MilkyWayDetailOptions), so the dust lanes (the Great Rift, the Coalsack, the Cygnus Rift) are sharper than the plain grid gives them. Made from the package's numbers alone: no photograph is read. Pure: it returns new pixels and keeps nothing but the grid it unpacks once.

Seen from inside a sphere, the sky runs the other way round from a map: give a sphere this texture with its across direction flipped (in three.js, texture.wrapS = RepeatWrapping and texture.repeat.x = -1), or turn the sphere inside out by scaling it by -1 across.

Import it

import { milkyWayTexture } from "@johnmorrisdotca/hoshi-stars/milky-way";

Definition

function milkyWayTexture(options?: MilkyWayTextureOptions): MilkyWayTexturePixels

Parameters

NameTypeDescription
options (optional)MilkyWayTextureOptions

width (default 2048), frame (equatorial, the default, or galactic), detail (0 to 2, default 1) and ramp (default MILKY_WAY_NIGHT_RAMP).

Returns

MilkyWayTexturePixels

The pixels.

Examples

import { milkyWayTexture } from "@johnmorrisdotca/hoshi-stars/milky-way";

const { width, height, data } = milkyWayTexture({ width: 2048 });
// a canvas: context.putImageData(new ImageData(data, width, height), 0, 0)
// three.js: new DataTexture(data, width, height) with flipY true, colorSpace SRGBColorSpace and needsUpdate true
console.log(width, height); // 2048 1024
2048 1024

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hoshi-stars 0.47.0.