Toggle navigation
Sign Up
Log In
Explore
Works
Folders
Tools
Collections
Artists
Groups
Groups
Topics
Tasks
Tasks
Jobs
Teams
Jobs
Recommendation
More Effects...
JS
var renderer, camera, scene, earth, space, stars; var earthShaderParameters, spaceShaderParameters, starParameters; function initParams() { THREE.ImageUtils.crossOrigin = "anonymous"; var lightColor = new THREE.Color(0xFFAE53); var ambientColor = new THREE.Color(0x1F0F33); var starColor = 0xFFFFFF; starParameters = { color: starColor, size: 4, }; earthShaderParameters = { "time": { type: 'f', value: 0.0 }, "cloud_map": { type: 't', value: THREE.ImageUtils.loadTexture("https://dl.dropboxusercontent.com/u/8604128/earth/clouds.png") }, "specular_map": { type: 't', value: THREE.ImageUtils.loadTexture("https://dl.dropboxusercontent.com/u/8604128/earth/earth-SPEC.png") }, "day_diffuse_map": { type: 't', value: THREE.ImageUtils.loadTexture("https://dl.dropboxusercontent.com/u/8604128/earth/earth-day-DIFF.png") }, "night_diffuse_map": { type: 't', value: THREE.ImageUtils.loadTexture("https://dl.dropboxusercontent.com/u/8604128/earth/earth-night-DIFF.png") }, "glow_map": { type: 't', value: THREE.ImageUtils.loadTexture("https://dl.dropboxusercontent.com/u/8604128/earth/earth-night-GLOW.png") }, "normal_map": { type: 't', value: THREE.ImageUtils.loadTexture("https://dl.dropboxusercontent.com/u/8604128/earth/earth-NM.png") }, "light_color": { type: 'c', value: lightColor }, "ambient_color": { type: 'c', value: ambientColor } }; spaceShaderParameters = { "time": { type: 'f', value: 0.0, }, "ambient_color": { type: 'c', value: ambientColor }, "light_color": { type: 'c', value: lightColor } }; } function main() { initParams(); init(); animate(); } function init() { var width = window.innerWidth; var height = window.innerHeight; earthShaderParameters.cloud_map.value.wrapS = earthShaderParameters.cloud_map.value.wrapT = THREE.RepeatWrapping; renderer = new THREE.WebGLRenderer(); renderer.setSize( width, height ); $(".viewer").append( renderer.domElement ); camera = new THREE.PerspectiveCamera( 70, width / height, 1, 2000 ); camera.position.z = 700; scene = new THREE.Scene(); createMeshes(); window.addEventListener( 'resize', onWindowResize, false ); } function pointOnSphere(radius) { var point = new THREE.Vector3(); var u = Math.random(); var v = Math.random(); var theta = 2.0 * Math.PI * u; var phi = Math.acos(2.0 * v - 1.0); point.x = (radius * Math.sin(phi) * Math.cos(theta)); point.y = (radius * Math.sin(phi) * Math.sin(theta)); point.z = (radius * Math.cos(phi)); return point; } function createMeshes() { var sphere = new THREE.SphereGeometry( 100, 64, 64 ); sphere.computeTangents(); var earthMaterial = createMaterial(".earth-vert", ".earth-frag", earthShaderParameters); earthMaterial.transparent = true; earth = new THREE.Mesh(sphere, earthMaterial); var spaceMaterial = createMaterial(".space-vert", ".space-frag", spaceShaderParameters); spaceMaterial.side = THREE.BackSide; spaceMaterial.depthWrite = false; var NUM_STARS = 40000; var STAR_SPREAD = 1600.0; var DIST_FROM_EARTH = 700.0; var starGeo = new THREE.Geometry(); for(var i=0; i
CSS
body { background: #000000; }
HTML
Join Effecthub.com
Working with Global Gaming Artists and Developers!
Login
Sign Up
Or Login with Your Email Address:
Email
Password
Remember
Or Sign Up with Your Email Address:
Your Email
This field must contain a valid email
Set Password
Password should be at least 1 character
Stay informed via email