Tutorial 15: Publish web scenes

Web viewer

To access the tutorials in CityEngine, click Help > Download Tutorials and Examples. After choosing a tutorial or example, the project is automatically downloaded and added to your workspace.

Export a CityEngine scene to a web scene (.3ws)

  • Open scene Esri_Campus.cej
  • Generate models

Scene layers

The following images shows layers in the scene:

Scene dialog box

The layer setup is essential for the web scene you are going to create, as the layers will be shown in the Web Viewer similar to the CityEngine scene.

  • The scene contains five layers for the Dev HQ building: Exterior Walls, No Walls, and a floor plan layer for each of the three floors. The No Walls layer is nearly empty; it will be used to enable the swipe view in the web scene later on.
  • Campus Buildings and Buildings Environment contain the surrounding buildings as shells with no interior detail.
  • Rocks, Trees, and Light Poles contain point data that load their respective 3D assets.

Other scene details

In addition to the actual 3D content, other scene details are exported to a web scene.

Bookmarks

Bookmarks are exported directly to the web scene. All bookmarks appear in the Bookmarks menu Bookmarks of the Web Viewer.

Current view

The camera view (camera position and view direction) that is current during export will be the initial view when the web scene is loaded in Web Viewer. It is recommended that you choose a good viewpoint before starting the Web Scene exporter.

The following shadow settings are exported to the web scene.

View settings

View settingsView settings exports the following:

  • Shadow on/off—Sets the initial state for direct shadows.
  • Ambient Occlusion on/off—Sets the initial state for diffuse shadows.

Scene light and panorama

The four ambient occlusion settings found in the Scene Light and PanoramaScene light and panorama settings are exported to the web scene and are used for the diffuse shadow settings.

Note:

The lights elevation and azimuth angle may be different in the web scene, as Web Viewer automatically sets the lights depending on the world position and time information set in the sunlight pane.

Export .3ws

Make sure all layers are visible, and drag to select all models in the scene.

  1. Start the exporter by clicking File > Export Models
  2. Choose CityEngine WebScene.

    CityEngine export model formats

General export options

The image below shows the basic export options:

General export options

Set the location to the models folder of the current project.

For details about the other general export options, see exporting models in the CityEngine help.

Note:

option. Enabling the Simplify Terrain Meshes option can help to reduce the size of the .3ws file. For terrains with a resolution above 512x512, the simplification process can take a while. In general, set a low terrain resolution and enable terrain simplification.

The Object Interaction, Object Metadata, and Textures settings define the default behavior for all layers.

Per layer export options

The following image shows per layer options for exporting web scenes:

CityEngine WebScene per layer export options

Layer Enabled

Check the first column to verify that all layers will be exported. If one check box is missing, no object of this layer has been selected for the export (or the layer is invisible).

Layer Name

This displays the name of the layers as they appear in the CityEngine scene.

Group Name

Set the layer group name to Dev HQ for the Exterior Walls and No Walls layers. This will enable swipe view in Web Viewer for these two layers.

State

The layer state of the Panorama and Terrain layers are automatically set to backdrop. This means they will always be visible and will not appear in the layer list. By setting No Walls to Hidden, you ensure that the initial visibility of the Dev HQ group will show the Exterior Walls layer.

Interaction

Backdrop layers cannot be selected and are automatically set to locked. All other layers will default to the scene setting (set to Pickable in the previous dialog box).

Metadata

You only want to show metadata on the Campus buildings; therefore, set None for all other layers. The scene setting was set to All in the previous dialog box.

Textures

A JPG texture has been prepared specifically for the terrain and is set as the texture on the terrain layer. You can use the Texture Quality option Original Textures for the terrain layer. Other layers use scene settings (set to Compact in the previous dialog box).

Note:

Only use original texture quality on layers with specifically prepared textures. WebGL only supports PNG and JPG textures; other image formats such as TIFF will appear black. When using non-prepared textures, set the texture quality option to High, Medium, Low, Half-sized, or Compact (recommended).

Click Finish to start the export process. The exporter will create a web scene file (.3ws) in the chosen output directory.

Preview a web scene locally

Before publishing the web scene, it is recommended that you preview it locally. This way you can ensure correct export and layer settings, and verify the web scene displays as expected.

  • Locate the exported web scene (the .3ws file) in the Navigator window.
  • Right-click and select Open.

This opens your web browser and loads the CityEngine Web Viewer with the new web scene. The preview will load in your default browser. If you want to preview in a different browser (in case your default browser does not support WebGL), you can change your default browser, or copy and paste the URL of the desired browser.

By default, the web scene preview will load Web Viewer locally, but it accesses the Web Viewer application remotely from ArcGIS Online Alternatively, you can start the web scene preview in offline mode as follows:

  • In the Navigator window, right-click the web scene (the .3ws file).
  • In the context menu, choose Open With 3D Web Scene Viewer (offline).
Note:

Web scenes can only be previewed within CityEngine web scenes from the Navigator. Double-clicking a .3ws file in the system's file browser (for example, File Explorer) will not start the Web Viewer preview.

CityEngine Web Viewer

The web scene as it shows in the preview Web Viewer:

Web scene as it shows in the preview Web Viewer

Check that the layers appear as desired. Note how the layer group Dev HQ is displayed as a group.

  • Hover over the Dev HQ group and start the swipe view by clicking the swipe button.

Esri Campus in the preview Web Viewer

Swipe view shows the exterior walls on the left, and no walls on the right.

Ensure that bookmarks are displayed as expected in Web Viewer. Hovering over the 3D viewport shows the bookmarks bar. Use the play button to play a tour through the bookmark views.

3D viewport shows the bookmarks bar play button

Other actions you can do include the following:

  • Select one of the campus buildings, and find additional metadata in the information pane.
  • Turn direct and diffuse shadows on and off in the settings pane.
  • In the layer pane, hide floors 1 and 3 to see details of floor 2.
  • In the search pane, search for restroom.

More details on Web Viewer can be found in the ArcGIS Online help.

Publish to ArcGIS Online

CityEngine web scenes can be uploaded to ArcGIS Online, where you can share them with selected people or the public.

Note:

This feature requires an ArcGIS Online account. Create one at arcgis.com.

Upload the web scene

  1. Locate the .3ws file in the Navigator.
  2. Right-click the file and select Share as.
    The CityEngine Web Scene Package wizard appears.
    CityEngine Web Scene Package wizard
  3. Check Upload package to my ArcGIS Online account.
  4. Name the web scene, or use the suggested name.
  5. Click the Item Description tab.
    Web Scene Package wizard Item Description tab
  6. Type a summary for the web scene item.
  7. Choose or type tags for the web scene item.
  8. Click Share.
    If you are not signed in yet, the ArcGIS Online sign-in dialog box for appears.
    ArcGIS Online sign in
  9. Type your credentials and sign in.
  10. CityEngine uploads the web scene to your ArcGIS Online account.

Web scenes on ArcGIS Online

Once the upload is finished, the web scene appears as an item in your portal in Navigator.

Webscene shared to ArcGIS Online

  1. Right-click the item, and choose Open in browser.
    ArcGIS Online Item Description page
  2. Click Edit Thumbnail, and set a thumbnail image (for example, from the projects images folder).
  3. Click Share to set access rights for selected groups or the public.
  4. Click View application to start Web Viewer with the Esri Campus web scene on ArcGIS Online.

If your item is public, you can use the share button in the header of CityEngine Web Viewer to share this web scene on Facebook, post on Twitter, send as an email, share the link itself, or embed it in a web page.

Share pane in CityEngine Web Viewer