Ring Worlds
Generate a world wrapped along a cylinder. Useful for creating sci-fi megastructures like O'Niell cylinders (opens in a new tab) or Ring Worlds (opens in a new tab)
They can be long with a small diameter, or vast and narrow.
O'Niell Cylinder
An enormous cylinder providing a habitable surface in a counterrotating arrangement.
Niven Ring
A long thin megastructure,such as described in the Ringworld series by Larry Niven, or the Halo series. (You may have to rotate the camera around to see)
Usage
import { RingWorld } from "@hello-worlds/planet"
import worker from "./RingWorld.worker"
// ...some threejs scene above
const myWorld = new RingWorld({
radius: 5_000,
length: 20_000
minCellSize: 32,
minCellResolution: 48,
workerProps: {
numWorkers: 8,
worker,
},
data: {
seed: "My Cool Seed!",
},
})
scene.add(myWorld)
Props
Prop | Type | Default (if optional) | Description |
---|---|---|---|
inverted | boolean | false | If true, flips the terrain upside down |
radius | number | required | The radius of the ring world |
length | number | required | The width of the "rim" of the ring world |
minCellSize | number | required | The smallest size that a terrain chunk will be |
minCellResolution | number | required | The amount of subdivisions in a terrain chunk |
material | Material (opens in a new tab) | undefined | The material to use |
position | Vector3 (opens in a new tab) | required | The position to place the world |
lodOrigin | Vector3 (opens in a new tab) | required | the position where to compare the lod algorithm against, typically your camera position. If the lodOrigin is close to a terrain chunk, it may decided to collapse into a higher level of detail. |
workerProps | WorkerProps | required | Config for the worker |
data | Record<string, any> | required | User datta that will be consumed by the worker threads' generator functions |
lodDistanceComparisonValue | number | 1.25 | The quadtree will resolve to a higher level of detail if the lodOrigin position is closer than distance * lodDistanceComparisonValue, for thhis reason it must be greater than 0 |
WorkerProps
export interface workerProps: {
worker: new () => Worker
numWorkers: number
}