planet-texture-generator
v0.0.4
Published
A tool to generate planet textures using procedural generation techniques
Maintainers
Readme
Generate planet surfaces
This package provides methods to procedurally generate a gas or terrestrial planet texture using sampling Perlin noise from the surface of a sphere. The generator class can be seeded to be able to generate the same pattern multiple times.
Output is a Uint8Array that contains the RGBA data that can be used for example to map to a sphere's supface with Three.js:
textureGenerator = new TextureGenerator(...); //set initial values
let noiseBuffer = this.textureGenerator.generateGasPlanetTexture(n,m); //pass size of texture
const sphereGeometry = new THREE.SphereGeometry(2, 320, 160); //example sphere
var texture = new THREE.DataTexture(noiseBuffer, n/2+1, m+1, THREE.RGBAFormat);
texture.needsUpdate = true;
const material = new THREE.MeshPhongMaterial({
map: texture,
blending: THREE.NormalBlending,
shininess: 10
}); // example material for sphere surface
const sphere = new THREE.Mesh( sphereGeometry, material ); 