CanvasMap
Getting Started Tutorials 3D Reference

Introduction to 3D

Pretty much all computers, including smart phones, contain electronic hardware to display renderings of 3D scenes. This is different from "true 3d" which requires each of your eyes to see a different image for perspective such as 3D goggles or the 3D glasses with polarized lenses. The hardware that allows 3D renderings is called a Graphical Processing Unit or GPU. GPUs allows us to render 3D scenes are very high speed allowing all the games and interactive 3D applications we now enjoy.

About the same time that HTML 5 was being completed, the "Open Graphics Language" or OpenGL, was also added to all major browsers. This allows us to create 3d renderings of scenes with JavaScript. However, communicating with the GPU, even through OpenGL, is a rather daunting task. Recently, the three.js library was released and makes it relatively easy to communicate to OpenGL from JavaScript. Three.js is a general 3d library which we've integrated into CanvasMap for the specific purposes of displaying geospatial data in 3D.

CanvasMap supports 3D in a very similar way to 2D maps. The basic structure of spatial data is similar between 2D and 3D, there are layers, data sets, and scenes. However, 3D is much more complicated with the addition of lights, textures, materials, controls, and 3D geometry. During development the 3D design had an impact on the 2D design resulting in the final architecture for CanvasMap. In the end, we were able to make creating 3D maps in CanvasMap very similar to creating 2D maps and then there are a lot of additional settings and features for 3D.

Differences from 2D

3D maps are 2D maps that have additional capabilities. Also, since we are using OpenGL instead of the HTML Canvas element, some of the settings have different names and there are a lot more of them. Part of the 3D terminiology includes refering to everything in a scene as an object. This documentaiton uses 3D Object to discriminate between objects in our JavaScript code and 3D Objects in OpenGL. The additional capabilities of Canvas 3D includes:

There are also a few features that are missing in 3D such as gradient fills. In the 3D tutorials, you'll see that creating 3D maps is initially very similar to 2D maps. As you add more complexity to your maps, you'll see more differences beween 2D and 3D.

3D Architecture

Imagine you are looking at a desk with a globe and a paper map. This could be a 3D scene. In 2D we typically show each "map" in a separate window. However, in 3D we'd like to be able to have multiple maps in the same scene. In addition, 3D hardware also supports multiple lights, cameras (views), and other effects within a scene. This led to the overall design for the code in CanvasMap which includes the following hierarchy for which objects include other objects.

There is a new layer for 3D vector data (CM3LayerVector) that is a sub-class of the CMLayerDataset class you've been using in 2D and a layer class for draping terrain over a digital elevation model (CM3LayerTerrain). Other layers have been adapted so they display data in 3D when they are in a 3D view and 2D data when in a 2D view. There are also new layers that are specifically for 3D objects.

Note: the 3D features in CanvasMap are currently in alpha testing and may change in the future. Also, the THREE.js library changes periodically and these changes will require CanvasMap to be updated.