Planet Render
Here's my planet render / design I've created using three.js
XII VI MMXXIV, NASA Terra "Blue-Marble"
XXIV XII MMXV, NASA New-Horizons "Sputnik Planitia"
Unknown
Click and drag to move the planet
Or scroll down for details
for (let i = 0; i < 700; i++) {
const x = THREE.MathUtils.randFloatSpread(2000);
const y = THREE.MathUtils.randFloatSpread(2000);
const z = THREE.MathUtils.randFloatSpread(2000);
starVertices.push(x, y, z);
}
const sunLight = new THREE.PointLight(0xffffff, 3.5, 1200);
sunLight.position.set(0, 7, 0);
scene.add(sunLight);
const sunTextureLoader = new THREE.TextureLoader();
const sunGeometry = new THREE.SphereGeometry(20, 32, 32);
const sunMaterial = new THREE.MeshBasicMaterial();
sunTextureLoader.load('sun.jpg', function(texture) {
sunMaterial.map = texture;
sunMaterial.needsUpdate = true;
});
const sunMesh = new THREE.Mesh(sunGeometry, sunMaterial);
sunMesh.position.copy(sunLight.position);
scene.add(sunMesh);
let time = 0;
const animate = function () {
time += 0.002;
sunLight.rotation.y += 0.001;
sunMesh.position.copy(sunLight.position);
if (isDragging){
sphere.rotation.y += 0;
time -= 0.002;
}
else{sphere.rotation.y += 0.01;
sphere.rotation.x === Math.sin(time) * 1000;
sphere.position.x = Math.sin(time) * 1000;
sphere.position.z = Math.cos(time) * 1000;}
camera.position.set(sphere.position.x, sphere.position.y, sphere.position.z + 10);
renderer.render(scene, camera);
requestAnimationFrame(animate);
};
animate();