Skip to content

mccrea-dev/planet-plopper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Procedural Planet Generator

A browser-based 3D procedural planet generator built with Three.js. Planets are generated using fractal simplex noise with seeded randomization, giving you reproducible results from any seed value.

Features

  • Procedurally generated terrain using seeded fractal simplex noise (two layers: base + fine detail)
  • Height-based color mapping across three elevation zones (ocean → land → mountain)
  • Fully adjustable terrain parameters: planet radius, noise scale, and mountain height
  • Custom color controls for each terrain zone with preset and hex input options
  • Manual seed input — type any seed and hit Apply to get that exact planet back
  • Randomize button for quick exploration, with deterministic results per seed
  • Animated star field with three depth layers and twinkling point lights
  • Wireframe toggle
  • Collapsible UI panel

Project Structure

├── main.js       # Scene setup, camera, lighting, UI event handling
├── planet.js     # Planet class — terrain generation, color mapping, randomization
├── stars.js      # Stars class — instanced mesh star field with animated lights
├── lcg.js        # LCG random number generator for seeded/reproducible noise

Getting Started

Prerequisites

Installation

npm install

Running

npm run dev

Then open your browser to the local address shown in the terminal (typically http://localhost:5173 if using Vite).

Dependencies

Controls

Drag to spin the planet, change planet parameters by using sliders.

Camera

Input Action
Left click + drag Rotate
Scroll Zoom

UI Panel

Control Description
Planet Size Adjust the radius of the planet
Noise Scale Controls the frequency of terrain features
Mountain Height Controls the amplitude of terrain displacement
High / Mid / Low Color Set colors for each elevation zone (preset picker or hex input)
Seed Type any integer to get a specific planet, manual seed takes priority over auto-computed seed on Apply
Apply Changes Regenerate the planet with current settings
Randomize Generate a random planet deterministically from the current seed
Wireframe Toggle wireframe view
Hide Collapse/expand the UI panel

Seed Behavior

The seed controls terrain generation. There are two ways it gets set:

  • Manual — type a seed in the seed field and press Apply. That seed is used as-is and the planet will always be reproducible from it.
  • Auto-computed — if the seed field is empty, a seed is derived from the current parameter values (radius, noise, mountain height, colors) so similar settings produce related seeds.

The Randomize button always derives a new deterministic seed from the current one, so randomization chains are also reproducible.

About

Seeded procedural generation of terrain on an icosahedral planet model, featuring user-adjustable parameters and gradient-based coloration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors