Skip to the content

Wakusei Planets惑星

The Sun, the planets and their moons as a clean line drawing, a shaded realistic drawing or a painted surface map, with real sizes, tilt and rotation, and the moons where they are at any date and time.

Wakusei is the Japanese word 惑星 for a planet. About the name

Contents

Reference · How a body is drawn with three.js

BodyLooktype

What a body looks like in three.js: the shader code of its surface, how it glows, its atmosphere and its painted map.

Import it

import type { BodyLook } from "@johnmorrisdotca/wakusei-planets/look";

Definition

interface BodyLook {
    id: BodyId;
    surface: string;
    emissive?: boolean;
    atmosphere?: Atmosphere;
    limb?: number;
    relief?: number;
    wrap?: number;
    ambient?: number;
    painted?: PaintedMap;
    mapped?: boolean;
}

Members

NameTypeDescription
idBodyId
surfacestring

GLSL that defines vec4 surface(vec3 p): p is the unit position on the body (x toward longitude 0 on the equator, y toward 90 degrees east, z the north pole); return the colour in rgb and the height in a.

emissive (optional)boolean | undefined

A glowing body (the Sun): no shading from outside light.

atmosphere (optional)Atmosphere | undefined
limb (optional)number | undefined

How much the disc darkens toward the limb, 0 to 1. Default 0.

relief (optional)number | undefined

How strongly the height shows as relief, 0 to 2. Default 0.6.

wrap (optional)number | undefined

How far light wraps round the terminator: 0 is a hard edge (no air), 0.3 a soft one. Default 0.04, or 0.3 with an atmosphere.

ambient (optional)number | undefined

How much of the night side shows (0 to 1). Default 0.04.

painted (optional)PaintedMap | undefined
mapped (optional)boolean | undefined

Draw the painted map in the realistic look too: for a body with no honest drawing from numbers (the Earth's continents).

Examples

import { registerLook, type BodyLook } from "@johnmorrisdotca/wakusei-planets/look";

const look: BodyLook = { id: "moon", surface: "vec4 surface(vec3 p) { return vec4(vec3(0.7), 0.0); }", ambient: 0.02 };
console.log(registerLook(look).id);
moon

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/wakusei-planets 0.24.0.