This document describes some advanced features of the CityEngine VR Experience. The basic information is available here: https://arcg.is/0u0y11. We recommend to read the basic information first before going into the details provided in this document.
Note: This document refers to CityEngine VR Experience 2020.0, CityEngine 2020.0, and Unreal Engine 4.25. The CityEngine VR Experience is available at the Unreal Marketplace, follow this link to get the template project for free.
The CityEngine VR Experience requires specially modified materials (VR Materials) for the experience to work properly. This VR materials are automatically created when the level is saved, but they can get outdated if the materials used in the scene are changed after the level was saved for the first time. The outdated VR Materials can be updated using the following two steps:
This section describes how to use Substance materials in combination with CityEngine Datasmith exports. The following steps highlight the general workflow, which can be repeatedly applied as your CityEngine scene evolves:
Starting with CityEngine 2019.0, exporting terrains is handled natively by the CityEngine Unreal exporter.
Which terrain layer are exported to Unreal can be set in the export dialog:
The scenario export python script automatically exports all visible terrains.
For each terrain layer a terrain actor is created in Unreal. If it should be possible to grab the terrain in the VR Experience with the controller, the Generate Overlap Events property of the terrain must be set to true as shown in the screenshot below:
Depending on the size of the terrain, this can sometimes lead to performance problems. To increase the performance at runtime, increase the Simple Collision Mip Level at the cost of accuracy. In that case, we recommend using values in the range between one and three.
With the experimental Multiplayer feature, multiple people can join the same VR Experience and interact with each other in a local network. First one user has to host a server and then other users can join this server.
Press "H" on the computer keyboard to host a server.
Press "J" on the computer keyboard to join an existing server in the local network.
The Replacement Tool is used to batch-replace placeholder objects exported from CityEngine with high quality assets in Unreal. The following section describes how objects need to be exported in CityEngine and how the Replacement Tool can be used in Unreal.
First a placeholder object needs to be inserted in CityEngine using the CGA insert command as follows (hint: the Scatter Operation can be used to distribute the objects):
The garden_plant.obj can be any object (even a simple cube) as it will be replaced in Unreal. Note that each object you want to replace needs a unique name as the name is used in Unreal to discern between the different Actors. In CityEngine's Unreal Export settings, Instancing needs to be set to Use Instancing so that each placeholder is imported as a separate actor in the scene, named after the asset that created them (in this case the ‘garden_plant.obj’).
Import the Datasmith file as usual. Once the import completes, the result should look something like the scene in the image below.
The Replacement Tool helps batch-replacing the white cubes. It can be found in Unreal Engine in the CityEngine Toolbox:
After selecting the menu item, a dialog with a number of options opens. The image below shows a sample dialog to replace our placeholders with the HillTree_02 model (from Epic Games' Open World Demo Collection😞
Following a description for all options of the Replacement Tool:
Note that you can undo the replacement in Unreal Engine with a simple Ctrl+Z, so that you can easily adjust your percentages and parameters until you find the right mix of actors. Here’s what our garden looks like after the execution of multiple replacements:
Note: The Replacement Tool is currently in beta and will be extended in future versions.
An experimental non-photorealistic (NPR) shader can be enabled/disabled to highlight edges as shown in the screenshot below:
The shader can be enabled/disabled from the CityEngine Toolbox:
Unreal Engine can automatically generate Level of Detail (LoD) for meshes. This section briefly describes how these LoDs can be generated and how the settings can be tweaked to get optimal results. There are two ways to create and edit your LoD settings: LoD for a single mesh and LoD for multiple meshes.
In VR the LoD Screen Size needs to be adapted as the resolution is typically higher then no VR. Adjusted Screen Size percentage settings for a VR-Project could look like this:
For details further details, please refer to Setting Up Automatic LOD Generation documentation.
With Unreal Engine 4.21 Epic Games introduced a new plugin for computing the accurate position of the sun in the sky based on your current location, date and time zone. The CityEngine VR Experience comes with improvements to the basic sun position calculator and sky sphere: Instead of exposing singular color values you can change the color and mood of the whole day. This section provides an overview on how to use and configure sun position and our extensions to day light. In addition we show how trueSKY can be enabled in your VR experience project.
If you are using the CityEngine VR template, the Unreal Engine Sun Position Calculator plugin is already enabled, and the necessary blueprint actors are already added to your scene and you can skip to the next section. If you prefer to work with a custom project / scene, you need to enable the Sun Position Calculator plugin first (Edit -> Plugins) and then add the BP_SunPosition and the BP_SkyController actors to your scene.
To configure the scene properly, you need to complete a few steps now. First, click on the BP_SunPosition actor and look at the settings available in the details panel.
Once you have set all of these settings the sun position calculator is good to go and you can move on to the sky sphere by clicking on the BP_SkyController actor. The sky controller allows you to not only setup a few basic settings that are independent of the time of day, it also allows you to define curves that control how the sky changes over time.
Unlike UE4's built-in curves, the curves that come with our sky setup allow you to select between two different modes of operation. If you choose the Height mode, the curves work exactly like they do with the blueprints that come with the Sun Position Calculator plugin. Values are sampled based on the height of the sun, where the value is 1.0 on the equator at noon and -1.0 on the equator at midnight.
If you choose the Time mode however, the curves are expected to cover a value range from 0.0 to 24.0, where these values represent the hours of the day. This allows you to configure values both based on the time as well as the sun height and mix the two approaches where reasonable.
Tweaking the color and intensity curves to best fit your scene during all times is cumbersome. To facilitate the process, we created an additional blueprint BP_SkyAnimator that allows you to animate the progression of time. It automatically sets the time of day for you, allowing you to easily see how your light intensity curves behave during the day.
To use this blueprint, drag it into the scene and hit play to see the animation run in your selected viewport or directly in VR. Since the curves are stored as separate assets, changes you make to them and save while running the scene are not lost when stopping the scene.
The blueprint allows you to let time flow between a start and an endpoint. Once the time of the endpoint has been reached, the time is reset to the start point, giving you the tools to make fine grained adjustments to your color curves for specific slices of the day.
If you use a Sky Light with SLS captures enabled, moving the time will invalidate the current capture. If you look at reflections on surfaces that are based on a cube map lookup, you will find that they are not correct anymore after the time has changed. You will see the reflections that were correct when the cube map has last been captured.
By using in the BP_SLSCapturer blueprint, the scene will automatically be recaptured when the time changes. Note that this is an expensive operation and should be coordinated with your application. If you change the time every frame, consider using different approaches like recapturing the scene once you are done changing the time.
Fog is disabled by default in the CityEngine VR Experience template scene. While it can add a lot to the atmosphere of a scene, configuring it correctly is hard and needs a lot of tweaking. Still, if you wish to use an exponential height fog actor and want to change its’ behavior according to the time of day or sun height, you can do so with our blueprints. If you have an exponential height fog actor in your scene, you can add in the fog controller (BP_FogController). The fog controller automatically updates the height fog according to an extended set of curves that provide the same operation modes as the light intensity curves of the sky controller.
Important note: due to compatibility issues, TrueSKY support is currently disabled. We consider re-enabling support as soon as a compatible TrueSKY version is released.
The CityEngine VR Experience supports replacing the builtin day light system with light provided by trueSKY. To enable trueSKY follow these steps:
The skybox (i.e. the surroundings outside the office) can be replaced with a different 360° panorama as follows:
It is possible to visualize the data imported from CityEngine in a desktop application without VR. To create a non VR level either create a new Level or use the NonVRTemplate level at Content/NonVR/Maps. To set this new level as default, go to Edit->Project Settings->Maps & Modes and set the Editor Startup Map & Game Default Map to the new level.
Starting with CityEngine 2019.0, it is possible to export metadata (for example GIS attributes) using the Unreal Engine exporter. To do so, export CityEngine models with the following export options:
If you are using the NonVRTemplate level, you can take advantage of the built-in metadata information display functionality: After starting the level with the Play button, you can look around while pressing your right mouse button and move around using the W, A, S and D keys. Left clicking will highlight the selected actor and show its metadata in a popup.
To see the Metadata in the Unreal Engine Editor first select the <ShapeName>_Root Actor (there is one Actor for each exported initial Shape from CityEngine) and then its Root Component. The metadata is visible in the Asset User Data Section in the Details Panel as seen in the screenshot below: