threex.planets
threex.planets copied to clipboard
three.js extension for planets from
threex.planets.js
It is a three.js extension to display planets based on the data from
- planetpixelemporium (Sun*, Earth DEM, Uranus)
- USGS Astrogeology (Mercury DEM, Moon*, Mars, Jupiter Moons, Uranus Moons)
- NASA/JHUAPL/Carnegie Institution of Washington (Mercury Map*)
- NASA/JHUAPL/SWRI (Pluto*, Charon)
- NASA/JPL-Caltech/Space Science Institute (Saturn Rings*, Titan, Triton*)
- NASA/JPL-Caltech/Space Science Institute/LPI (Saturn Icy Moons*)
- NASA/JPL-Caltech (Uranus Rings*)
- NASA/JPL-Caltech (Stars)
- NASA Visible Earth (Earth, Earth Clouds*)
- ESO (Solar Corona*)
- Björn Jónsson (Venus*, Jupiter, Neptune)
- Solar System Scope (Saturn, Titan Clouds)
-
Philip Stooke (Deimos, Proteus)
* Hand adapted by ofrohn, also Jupiter & Neptune ring maps
Here is some demos to show off
- planetary systems and its source. Simulation of planets with their moons.
- all the planets and its source. All the implemented objects dancing in a circle.
-
earth and moon
and its
source. The Earth spinning and the Moon orbiting it.
Older examples - earth demo and check its source. It displays a nice earth with cloud and even the moon.
- select demo and check its source. Display all the planets available
-
atmospherematerial demo
and check its
source. a simple demo to show
THREEx.createAtmosphereMaterial()
- basic demo and check its source. Good for educational purpose
How To install it
You can install it manually or with
bower.
for the manual version, first include threex.planets.js
with the usual
<script src='threex.planets.js'></script>
or with bower you type the following to install the package.
bower install -s threex.planets=https://github.com/jeromeetienne/threex.planets/archive/master.zip
then you add that in your html
<script src="bower_components/threex.planets/threex.planets.js"></script>
Usage
to create uranus with its ring
var mesh = THREEx.Planets.createUranus()
scene.add(mesh)
var mesh = THREEx.Planets.createUranusRing()
scene.add(mesh)
to create the earth plus the clouds moving around
var mesh = THREEx.Planets.createEarth()
scene.add(mesh)
var mesh = THREEx.Planets.createEarthCloud()
scene.add(mesh)
updateFcts.push(function(delta, now){
mesh.rotation.y += 1/8 * delta;
})
new simpler form:
var mesh = THREEx.Planets.create("Uranus"); // ring included
scene.add(mesh);
var mesh = THREEx.Planets.create("Earth"); // clouds included
scene.add(mesh);
updateFcts.push(function(delta, now){
mesh.traverse(function(child) {
if (child.name.search("cloud") !== -1) child.rotation.y += 1/8 * delta;
});
});
var mesh = THREEx.Planets.create("Earth", true); // no clouds
API
Here is the list of all the functions.
They all return a THREE.Object3d
.
You can tune it to fit your need
-
THREEx.Planets.create(body, skipextras)
return the mesh of any supported body
body: Sun|Mercury|Venus|Earth|Moon|Mars|Vesta|Ceres|Jupiter|Saturn|Uranus|Neptune|Pluto
skipextras: No ring, cloud, corona or other extra elements -
THREEx.Planets.createRings(body)
return the ring mesh of any supported body
body: Jupiter|Saturn|Uranus|Neptune -
THREEx.Planets.createClouds(body)
return the cloud mesh of any supported body
body: Earth|Mars -
THREEx.Planets.createSun()
return the mesh of the Sun -
THREEx.Planets.createMercury()
return the mesh of Mercury -
THREEx.Planets.createVenus()
return the mesh of Venus -
THREEx.Planets.createMoon()
return the mesh of the Moon -
THREEx.Planets.createEarth()
return the mesh of the Earth -
THREEx.Planets.createEarthCloud()
return the mesh of the Earth Cloud -
THREEx.Planets.createMars()
return the mesh of Mars -
THREEx.Planets.createJupiter()
return the mesh of Jupiter -
THREEx.Planets.createSaturn()
return the mesh of Saturn -
THREEx.Planets.createSaturnRing()
return the mesh of Saturn's ring -
THREEx.Planets.createUranus()
return the mesh of Uranus -
THREEx.Planets.createUranusRing()
return the mesh of Uranus's ring -
THREEx.Planets.createNeptune()
return the mesh of Neptune -
THREEx.Planets.createPluto()
return the mesh of Pluto -
THREEx.Planets.createStarfield()
return the mesh of a starfield environmental sphere