Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<title>Grand Canyon 3D Map</title>    

	</head>
	<body>
    
    <h4 align="center">
      
      <i class="fas fa-mouse-pointer"></i>
      <span>Left Click: Rotate | </span>
      <span>Right Click: Pan | </span>
      <span>Scroll Wheel: Zoom</span>
      <i class="fas fa-mouse-pointer fa-flip-horizontal"></i>
      
    </h4>

		<div id="container">
      
    </div>
		
		<script>
    

		</script>
	</body>
              
            
!

CSS

              
                html, body {
				height: 100%;
			}

body {
				background-color: white;
        background-image: linear-gradient(rgba(136,199,242,1), rgba(255, 255, 255, 0));
				margin: 0;
				overflow: hidden;
        color: #4c4c4c;
        font-family: 'Roboto Condensed', sans-serif;
			}
div {
    width: 500px;
    word-wrap: break-word;
    font-size: 2vw;
}
i {
  color: #EB6A71;
  padding-right: 5px;
  padding-left: 5px;
}
              
            
!

JS

              
                
			function init() {
				var scene = new THREE.Scene();

			//LOAD CUBE MAP
				scene.background = new THREE.CubeTextureLoader()
					.load([
							"https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895610/Grand_Canton_3D_Map/assets/textures/grad_jphrov.jpg",
							"https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895610/Grand_Canton_3D_Map/assets/textures/grad_jphrov.jpg",
							"https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895611/Grand_Canton_3D_Map/assets/textures/py_s9mplr.jpg",
							"https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895610/Grand_Canton_3D_Map/assets/textures/ny_nfd7oe.jpg",
							"https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895610/Grand_Canton_3D_Map/assets/textures/grad_jphrov.jpg",
							"https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895610/Grand_Canton_3D_Map/assets/textures/grad_jphrov.jpg"
						]);

			//GET OBJECTS AND MATERIALS
				var geometry = new THREE.BoxGeometry (5, 0.25, 5, 100, 100, 100);
				var cubeMaterials = 
				[
					new THREE.MeshPhongMaterial({color: '#e8c5a7',
												side: THREE.DoubleSide,
												}), //RightSide
					new THREE.MeshPhongMaterial({color: '#e8c5a7', 
												side: THREE.DoubleSide}), //Left Side
					new THREE.MeshPhongMaterial({map: new THREE.TextureLoader().load("https://cdnb.artstation.com/p/assets/images/images/017/672/729/large/morgan-ward-terrain-color2.jpg?1556897375"), 
												side: THREE.DoubleSide,
												displacementMap: new THREE.TextureLoader().load("https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895612/Grand_Canton_3D_Map/assets/textures/Terrain_Disp_ooskfr.jpg"),
												displacementScale: 0.15,
												bumpMap: new THREE.TextureLoader().load("https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895612/Grand_Canton_3D_Map/assets/textures/Terrain_Disp_ooskfr.jpg"),
												bumpScale: .1}), //Top Side
					new THREE.MeshPhongMaterial({color: '#e8c5a7', 
												side: THREE.DoubleSide}), //Bottom Side
					new THREE.MeshPhongMaterial({color: '#e8c5a7', 
												side: THREE.DoubleSide}), //Front Side
					new THREE.MeshPhongMaterial({color: '#e8c5a7', 
												side: THREE.DoubleSide}), //Back Side
				];

				var material = new THREE.MeshFaceMaterial(cubeMaterials);
				var cube = new THREE.Mesh(geometry, material);
//Sprites
				var spriteMap = new THREE.TextureLoader().load( "https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895609/Grand_Canton_3D_Map/assets/icons/MapPin_eqbwwe.png" );
				var spriteMaterial = new THREE.SpriteMaterial( { map: spriteMap, color: 0xffffff } );
				
				var sprite01 = new THREE.Sprite( spriteMaterial );
				
				sprite01.position.set(1.725, 0.5, 0.795);
				sprite01.scale.set(0.2, 0.25);

				var sprite02 = new THREE.Sprite( spriteMaterial );
				
				sprite02.position.set(0.57, 0.5, 1.76);
				sprite02.scale.set(0.2, 0.25);

				var sprite03 = new THREE.Sprite( spriteMaterial );
				
				sprite03.position.set(1.385, 0.5, -1.18);
				sprite03.scale.set(0.2, 0.25);

				var sprite04 = new THREE.Sprite( spriteMaterial );
				
				sprite04.position.set(2.2, 0.5, 1.95);
				sprite04.scale.set(0.2, 0.25);

				var sprite05= new THREE.Sprite( spriteMaterial );
				
				sprite05.position.set(-0.98, 0.5, 1.8);
				sprite05.scale.set(0.2, 0.25);


				//LABELS

				var spriteMapKP = new THREE.TextureLoader().load( "https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895609/Grand_Canton_3D_Map/assets/icons/KalibabPlateau_w7guq5.png" );
				var spriteMaterialKP = new THREE.SpriteMaterial( { map: spriteMapKP, color: 0xffffff } );

				var spriteKP = new THREE.Sprite( spriteMaterialKP );
				
				spriteKP.position.set(1.725, 0.75, 0.795);
				spriteKP.scale.set(0.5, 0.13);

				var spriteMapCR = new THREE.TextureLoader().load( "https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895609/Grand_Canton_3D_Map/assets/icons/ColoradoRiver_kepcit.png" );
				var spriteMaterialCR = new THREE.SpriteMaterial( { map: spriteMapCR, color: 0xffffff } );

				var spriteCR = new THREE.Sprite( spriteMaterialCR );
				
				spriteCR.position.set(0.57, 0.75, 1.76);
				spriteCR.scale.set(0.5, 0.13);


				var spriteMapJL = new THREE.TextureLoader().load( "https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895609/Grand_Canton_3D_Map/assets/icons/JacobLake_krevv4.png" );
				var spriteMaterialJL = new THREE.SpriteMaterial( { map: spriteMapJL, color: 0xffffff } );

				var spriteJL = new THREE.Sprite( spriteMaterialJL );
				
				spriteJL.position.set(1.385, 0.75, -1.18);
				spriteJL.scale.set(0.5, 0.13);


				var spriteMapNR = new THREE.TextureLoader().load( "https://res.cloudinary.com/dn0c1fylq/image/upload/v1556895620/Grand_Canton_3D_Map/assets/icons/NorthRim_agnxl9.png" );
				var spriteMaterialNR = new THREE.SpriteMaterial( { map: spriteMapNR, color: 0xffffff } );

				var spriteNR = new THREE.Sprite( spriteMaterialNR );
				
				spriteNR.position.set(2.2, 0.75, 1.95);
				spriteNR.scale.set(0.5, 0.13);


				var spriteMapMF = new THREE.TextureLoader().load( "https://res.cloudinary.com/dn0c1fylq/image/upload/v1556911067/Grand_Canton_3D_Map/assets/icons/MooneyFalls_tar9db.png" );
				var spriteMaterialMF = new THREE.SpriteMaterial( { map: spriteMapMF, color: 0xffffff } );

				var spriteMF= new THREE.Sprite( spriteMaterialMF );
				
				spriteMF.position.set(-0.98, 0.75, 1.8);
				spriteMF.scale.set(0.5, 0.13);




				var pointLight = getPointLight(1);

				var pointLight01 = getPointLight(0.5);
				var pointLight02 = getPointLight(0.5);
				var pointLight03 = getPointLight(0.5);
				var pointLight04 = getPointLight(0.5);

				pointLight01.position.x = 10;
				
				pointLight02.position.z = 10;

				pointLight03.position.x = -10;
				
				pointLight04.position.z = -10;

				var amblight = new THREE.AmbientLight( 0x404040, .5 ); // soft white light


				cube.name = 'Terrain';

				pointLight.position.y = 10;



			//ADD OBJECTS TO SCENE
				scene.add(cube);
				scene.add(pointLight);

				scene.add(pointLight01);
				scene.add(pointLight02);
				scene.add(pointLight03);
				scene.add(pointLight04);

				scene.add(amblight);

				cube.add(sprite01);
				cube.add(sprite02);
				cube.add(sprite03);
				cube.add(sprite04);
				cube.add(sprite05);

				cube.add(spriteKP);
				cube.add(spriteCR);
				cube.add(spriteJL);
				cube.add(spriteNR);
				cube.add(spriteMF);

				var camera = new THREE.PerspectiveCamera(
					45,
					window.innerWidth/window.innerHeight,
					1,
					1000
				);


				
			//BASE CAMERA
				camera.position.x = 3;
				camera.position.y = 4;
				camera.position.z = 8;

				camera.lookAt(new THREE.Vector3(0,0,0));


				var renderer = new THREE.WebGLRenderer();
				renderer.shadowMap.enabled = true;
				renderer.setSize(window.innerWidth, window.innerHeight);
				renderer.setClearColor(0x000000, 0.0);
				document.getElementById('container').appendChild(renderer.domElement);

				var controls = new THREE.OrbitControls(camera, renderer.domElement);

				update(renderer, scene, camera, controls);

			}




			function getPointLight (intensity){
				var light = new THREE.PointLight(0xffffff, intensity);
				light.castShadow = true;

				return light;
			}


			function update(renderer, scene, camera, controls) {
				controls.update();
				renderer.render(scene, camera);

			//UN-COMMENT IF ROTATION IS ADDED 
				//var box = scene.getObjectByName('Terrain');
				//box.rotation.y += 0.001;
				requestAnimationFrame(function() {
					update(renderer, scene, camera, controls);
				});
			}



			var scene = init();

              
            
!
999px

Console