How to Add a New Map#

This document will describe how to create a new map in the SVL Simulator.

Video top#

(Link) Adding a new map in SVL Simulator.

Getting Started top#

The following text is a list of the steps described in the above video.

  1. Launch SVL Simulator from the Unity Editor (as described here).
  2. In the top menu, select File -> New Scene or Ctrl+N
  3. Create your new map folders in Assets/External/Environments/NewMap with /Models/Materials and /Prefabs in this root folder
  4. It is helpful to clone the CubeTown repository as an example scene to see how all Simulator features are setup and assets organized.

Import Assets top#

  1. Import assets you created or obtained into the Unity Editor.
  2. Move models, textures, materials and any other assets you need into the /NewMap folders. The new map should have no asset dependencies from folders outside of /NewMap.
  3. Do not include script files or non-HDRP shaders. If you need scripts in your scene, you will need to place in the source files of the SVL Simulator and build your own binaries.
  4. If your assets have non-standard shaders you will need to change them to the Unity Standard shader before converting to HDRP.
  5. Once all non Standard shaders are changed, you can convert the materials to HDRP materials.
  6. Select all materials.
  7. Select Edit -> Render Pipeline -> Upgrade Selected Materials to High Definition Materials. If the materials are all using Standard shaders, all shader settings will be converted with little need for adjustment.
  8. Be sure all materials have GPU instancing checked.
  9. Now we can start building the new map.

Creating the scene top#

  1. Delete the MapHolder object in the Hierarchy Panel. This will be added back with the annotation tool later.
  2. Create an Object to hold the mesh data for your map. Name it the same as your folder, e.g. NewMap. Zero out the transform position/rotation: 0,0,0 and scale: 1,1,1.
  3. Save the scene in the root of the /NewMap, naming exactly the same, NewMap.scene. Delete or move any other scene files out of this root folder.
  4. Open the Annotation Tool, select Simulator -> Annotation Tool, and click Create Map Holder. This will add the correct holder for annotation named already the same as your map scene name.
  5. Save the scene again. Do this often. You should always be hitting Ctrl+S during development.
  6. Create the scene by adding meshes and colliders to the NewMap mesh holder object as children. You can further organize by making secondary holder objects, e.g., Roads, Buildings, Props. Just be sure to zero transforms for holder objects.
  7. Once organized and positioned, select the root holder object and check static in the top right of the Inspector Panel. Then, open the static menu and uncheck Off Mesh Link Generation and Batching Static. HDRP supports GPU instancing materials OR Batching, not both. GPU instancing is more performant.
  8. Then select all mesh holder root objects that you do not want pedestrians to walk on, e.g., Props, Buildings, Signs, and uncheck Navigation Static. This will make Nav Meshes ignore these mesh types.
  9. Add the TimeOfDayLight.cs component to all meshes that will emit light, not building windows. Then add a light component object as a child of this light.
  10. Add TimeOfDayBuilding.cs to the building holder.
  11. Be sure you apply black textures to the emission component of the meshes you don't want to emit and create an emission map for the ones you do want to light during the night.
  12. Set semantic tags for the holder objects OR the objects themselves, not both. Code will search and apply tags to materials from parent, down to all child objects.
  13. Set physics layers for all meshes to default. Be sure to do this from the root object so all child objects get set. Purchased assets may have very odd tags and physics layers that you will need to fix.
  14. Change all road material shaders to ShaderGraphs -> EnvironmentSimulation for environmental effects to work on road surfaces.
  15. Add mesh colliders to all meshes that need physics collisions, especially roads.

Extra Steps not in video top#

  1. Select Window -> AI -> Navigation.
  2. Select Object tab in this panel.
  3. Select groups of meshes, not their holders, e.g., road, sidewalk, grass, curb meshes.
  4. In the Object tab in Navigation, set the meshes to the types.
  5. Select the Bake tab.
  6. Click the Bake button. This creates a Nav mesh that gets saved in the /NewMap folder.
  7. Select Window -> Rendering -> Occlusion Culling.
  8. Select Bake tab.
  9. Click the Bake button. This creates an occlusion object that helps with frame rate.

Finalize other map features top#

  1. Select MapOrigin object in the Hierarchy Panel.
  2. Set Northing, Easting, UTM and TimeZone.
  3. Set NPC settings for the map.
  4. Edit SpawnInfo position and rotation. This object(s) will determine where the EGO vehicle(s) will spawn. If you want multiple spawn points, duplicate this object and move to another position on the map.
  5. If importing or creating HDMap annotations, rotate all map objects so map North faces in the -X coordinate in Unity Scene View (see here). Use the simulator tool to rotate the scene to the correct position at Simulator -> Editor Tools -> Scene Type -> RotateSceneView and then the Run button.
  6. Make all scene objects a child of a empty game object at origin, rotate and then remove parent.
  7. Save the scene.
  8. Select Simulator -> Build...
  9. Select NewMap and click the Build button.