Realistic buildings with SceneLayer

This sample shows how to add a SceneLayer with realistic textures to a map in a SceneView. The SceneLayer is given an offset of 6 meters, to better align with the terrain.

Use dark colors for code blocksCopy
1 2 3 4 5 6 7 8 9 const sceneLayer = new SceneLayer({  portalItem: {  id: "2342ab7928834076a1240fb93c60e978",  },  elevationInfo: {  mode: "absolute-height",  offset: 6,  }, });

The scene is made more realistic by enabling shadows and setting the lighting based on a specific time of day using the environment property of the SceneView.

Use dark colors for code blocksCopy
1 2 3 4 5 6 view.environment = {  lighting: {  date: new Date("July 15, 2015 8:00:00 PDT"),  directShadowsEnabled: true,  }, };

Other helpful resources

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.