2019-07-10 05:46:28 +08:00
|
|
|
<h1>Creating standalone asset packages for distribution</h1>
|
2019-01-24 19:57:14 +08:00
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
*Please note that we will use the term *assets* for referring to **props** and also **maps**.*
|
2019-01-24 19:57:14 +08:00
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
The main objective for importing and exporting assets is to reduce the size of
|
|
|
|
the distribution build. This is possible since these assets will be imported as
|
|
|
|
independent packages that can be plugged in anytime inside Carla and also exported.
|
2019-01-24 19:57:14 +08:00
|
|
|
|
2019-07-26 17:25:49 +08:00
|
|
|
How to import assets inside Unreal Engine
|
|
|
|
-----------------------------------------
|
2019-01-24 19:57:14 +08:00
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
The first step is to create an empty folder inside the Carla `Import` folder and rename it with any
|
|
|
|
folder name desired. For simplifying this newly created folder structure, we recommend having
|
|
|
|
as many subfolders as maps to import and one single subfolder containing all the props to import.
|
|
|
|
Inside each subfolder, we will place all the files needed for importing.<br>
|
2019-07-05 17:57:11 +08:00
|
|
|
So basically, for a **map** subfolder, we will need to place the following files:
|
2019-07-08 23:29:45 +08:00
|
|
|
|
|
|
|
* The map itself in `.FBX` format.
|
|
|
|
* Optionally, the textures required by the map.
|
|
|
|
* Optionally, the `.xodr` OpenDrive file corresponding to that map.
|
2019-07-05 17:57:11 +08:00
|
|
|
|
|
|
|
And for the **props** folder, we will need the following files:
|
2019-07-08 23:29:45 +08:00
|
|
|
|
|
|
|
* The prop itself in `.FBX` format.
|
|
|
|
* Optionally, the textures required by the prop.
|
2019-07-05 17:57:11 +08:00
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
Additionally, we have to create a **JSON file inside the package** that will contain information
|
|
|
|
about its assets. The file extension must be `.json`. We recommend the JSON file to have the same
|
2019-11-14 01:50:21 +08:00
|
|
|
name as the package name in order to keep it organized.
|
2019-09-06 17:07:21 +08:00
|
|
|
**Please, keep in mind that the name of this file will used as the name of the distribution package**.
|
2019-01-24 19:57:14 +08:00
|
|
|
|
2019-07-05 17:57:11 +08:00
|
|
|
The content of this JSON file should be similar to the following:
|
2019-07-26 17:25:49 +08:00
|
|
|
|
2019-07-05 17:57:11 +08:00
|
|
|
```json
|
|
|
|
{
|
2019-11-14 01:50:21 +08:00
|
|
|
"maps": [
|
|
|
|
{
|
2019-07-05 17:57:11 +08:00
|
|
|
"name": "MyTown01",
|
2019-07-08 23:29:45 +08:00
|
|
|
"source": "./MapToImport01/MapToImport01.fbx",
|
2019-07-05 17:57:11 +08:00
|
|
|
"use_carla_materials": true,
|
2019-07-08 23:29:45 +08:00
|
|
|
"xodr": "./MapToImport01/MapToImport01.xodr"
|
2019-07-05 17:57:11 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "MyTown02",
|
2019-07-08 23:29:45 +08:00
|
|
|
"source": "./MapToImport02/MapToImport02.fbx",
|
|
|
|
"use_carla_materials": false,
|
|
|
|
"xodr": "./MapToImport02/MapToImport02.xodr"
|
2019-07-05 17:57:11 +08:00
|
|
|
}
|
|
|
|
],
|
2019-11-14 01:50:21 +08:00
|
|
|
"props": [
|
|
|
|
{
|
2019-07-05 17:57:11 +08:00
|
|
|
"name": "MyProp01",
|
|
|
|
"size": "medium",
|
2019-07-08 23:29:45 +08:00
|
|
|
"source": "./AssetsToImport/PropToImport01/PropToImport01.fbx",
|
|
|
|
"tag": "SemanticSegmentationTag01"
|
2019-07-05 17:57:11 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "MyProp02",
|
|
|
|
"size": "small",
|
2019-07-08 23:29:45 +08:00
|
|
|
"source": "./AssetsToImport/PropToImport02/PropToImport02.fbx",
|
|
|
|
"tag": "SemanticSegmentationTag02"
|
2019-07-05 17:57:11 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
2019-03-01 22:19:15 +08:00
|
|
|
|
2019-07-05 17:57:11 +08:00
|
|
|
As you can observe in the JSON file content, we have defined a JSON array of **maps** and **props**.
|
|
|
|
|
|
|
|
Each item inside the **maps** array has the following parameters:
|
2019-07-08 23:29:45 +08:00
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
* **name**: The name of the map. It is possible to import the same map mesh but with a different
|
|
|
|
name and, if so, it will create separate mesh files inside Unreal for each different name.
|
2019-07-08 23:29:45 +08:00
|
|
|
* **source**: Source path of the map inside the package folder.
|
|
|
|
* **use_carla_materials**: If true, we will use Carla materials, otherwise, we will use RoadRunner materials.
|
|
|
|
* **xodr**: Path to the `.xodr` Opendrive file for that map.
|
2019-07-05 17:57:11 +08:00
|
|
|
|
|
|
|
And each item inside the **props** array has the following parameters:
|
2019-07-08 23:29:45 +08:00
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
* **name**: The name of the prop. It is possible to import the same prop mesh but with different
|
|
|
|
name and, if so, it will create separate mesh files inside Unreal for each different name.
|
2019-07-08 23:29:45 +08:00
|
|
|
* **source**: Source path of the prop inside the package folder.
|
|
|
|
* **size**: Size of the prop, possible values are:
|
|
|
|
|
2019-07-05 17:57:11 +08:00
|
|
|
- `tiny`
|
|
|
|
- `small`
|
|
|
|
- `medium`
|
|
|
|
- `big`
|
|
|
|
- `huge`
|
2019-07-08 23:29:45 +08:00
|
|
|
|
|
|
|
- **tag**: Semantic segmentation tag. Possible values are:
|
|
|
|
|
2019-07-05 17:57:11 +08:00
|
|
|
- `None`
|
|
|
|
- `Buildings`
|
|
|
|
- `Fences`
|
|
|
|
- `Other`
|
|
|
|
- `Pedestrians`
|
|
|
|
- `Poles`
|
|
|
|
- `RoadLines`
|
|
|
|
- `Roads`
|
|
|
|
- `Sidewalks`
|
|
|
|
- `TrafficSigns`
|
|
|
|
- `Vegetation`
|
|
|
|
- `Vehicles`
|
|
|
|
- `Walls`
|
2019-11-14 01:50:21 +08:00
|
|
|
|
2019-07-05 17:57:11 +08:00
|
|
|
Note that if the tag is not spelled correctly, it will interpret it as `None` value by default.
|
|
|
|
|
2019-07-09 01:34:52 +08:00
|
|
|
To sum up, the `Import` folder should have this similar structure:
|
2019-09-06 17:07:21 +08:00
|
|
|
|
2019-07-09 01:34:52 +08:00
|
|
|
```
|
|
|
|
Import
|
|
|
|
|
|
|
|
|
├── Folder01
|
|
|
|
| ├── MapToImport01
|
|
|
|
│ │ ├── Asphalt1_Diff.png
|
|
|
|
│ │ ├── Asphalt1_Norm.png
|
|
|
|
│ │ ├── Asphalt1_Spec.png
|
|
|
|
│ │ ├── Grass1_Diff.png
|
|
|
|
│ │ ├── Grass1_Norm.png
|
|
|
|
│ │ ├── Grass1_Spec.png
|
|
|
|
│ │ ├── LaneMarking1_Diff.png
|
|
|
|
│ │ ├── LaneMarking1_Norm.png
|
|
|
|
│ │ ├── LaneMarking1_Spec.png
|
|
|
|
│ │ ├── MapToImport01.fbx
|
|
|
|
│ │ └── MapToImport01.xodr
|
2019-07-09 20:15:51 +08:00
|
|
|
| ├── MapToImport02
|
2019-07-09 01:34:52 +08:00
|
|
|
│ │ ├── MapToImport02.fbx
|
|
|
|
│ │ └── MapToImport02.xodr
|
|
|
|
| ├── AssetsToImport
|
|
|
|
| │ ├── PropToImport01
|
|
|
|
│ │ │ ├── PropToImport01_Diff.png
|
|
|
|
│ │ │ ├── PropToImport01_Norm.png
|
|
|
|
│ │ │ ├── PropToImport01_Spec.png
|
|
|
|
│ │ │ └── PropToImport01.fbx
|
|
|
|
│ │ ├── PropToImport02
|
|
|
|
│ │ │ └── PropToImport02.fbx
|
|
|
|
| │ └── PropToImport03
|
|
|
|
│ │ └── PropToImport03.fbx
|
|
|
|
| └── Package1.json
|
|
|
|
└── Folder02
|
|
|
|
├── AssetsToImport
|
|
|
|
| └── PropToImport04
|
|
|
|
| └── PropToImport04.fbx
|
|
|
|
└── Package2.json
|
|
|
|
```
|
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
_Maps exported from **RoadRunner** are also supported for importing them inside_
|
|
|
|
_Carla. So, basically, once created your **RoadRunner** map, you just need to export it, take the_
|
|
|
|
_required files and place them following the structure listed above._
|
|
|
|
|
|
|
|
!!! note
|
|
|
|
**RoadRunner's** imported assets will be classified for **semantic segmentation** based on
|
|
|
|
the asset's name (`RoadNode`, `Terrain`, `MarkingNode`) and moved to `Roads`, `Terrain`
|
|
|
|
and `RoadLines` respectively, under `Content/Carla/PackageName/Static`.<br>
|
|
|
|
_If the process doesn't work due to different names or other issues, you can always move the assets_
|
2019-09-11 00:22:33 +08:00
|
|
|
_manually, check this [`tutorial`][importtutorial]_ (_Section 3.2.1 - 6_).
|
2019-09-06 17:07:21 +08:00
|
|
|
|
2019-09-11 00:22:33 +08:00
|
|
|
[importtutorial]: ../how_to_make_a_new_map/#32-importing-from-the-files
|
2019-07-09 01:34:52 +08:00
|
|
|
|
|
|
|
Now we have everything ready for importing assets. To do so, you just need to run the command:
|
2019-07-26 17:25:49 +08:00
|
|
|
|
2019-07-05 17:57:11 +08:00
|
|
|
```sh
|
|
|
|
make import
|
|
|
|
```
|
2019-01-24 19:57:14 +08:00
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
This command will read the JSON file and take each asset and place it inside the Content
|
|
|
|
in Unreal Engine. Furthermore, it will create a `Package1.Package.json` file inside the package's
|
|
|
|
`Config` folder that will be used for **defining** its props in the Carla blueprint library,
|
|
|
|
**exposing** them in the `PythonAPI` and also for **exporting** those assets if needed.
|
2019-09-11 00:22:33 +08:00
|
|
|
|
|
|
|
_Packages with the same name will produce an error. Delete or rename the package before importing_
|
|
|
|
_a new one with the same name._
|
|
|
|
|
|
|
|
!!! note
|
|
|
|
The imported map won't have collisions, so they should be generated manually. This
|
|
|
|
[tutorial][collisionlink] (_Section 3.2.1 - 5_) shows how to do it.
|
|
|
|
|
|
|
|
[collisionlink]: ../how_to_make_a_new_map/#32-importing-from-the-files
|
2019-01-24 22:49:22 +08:00
|
|
|
|
2019-07-26 17:25:49 +08:00
|
|
|
How to export assets
|
|
|
|
--------------------
|
2019-01-24 19:57:14 +08:00
|
|
|
|
2019-09-11 00:22:33 +08:00
|
|
|
Once imported all the packages inside Unreal, users could also generate a **cooked package**
|
2019-09-06 17:07:21 +08:00
|
|
|
for each of them. This last step is important in order to have all packages ready to add for
|
|
|
|
distribution versions of Carla and for any supported platform. To export the packages,
|
|
|
|
simply run the command:
|
2019-01-24 19:57:14 +08:00
|
|
|
|
|
|
|
```sh
|
2019-07-05 17:57:11 +08:00
|
|
|
make package ARGS="--packages=Package1,Package2"
|
2019-01-24 19:57:14 +08:00
|
|
|
```
|
|
|
|
|
2019-09-06 17:07:21 +08:00
|
|
|
This command will create the distribution package compressed in a `.tar.gz` file for **each**
|
|
|
|
cooked package and place it in the Carla `Dist` folder. Finally, you could import these packages
|
|
|
|
in a Carla distribution by simply moving them in the Carla `Import` folder and executing
|
|
|
|
the `ImportAssets.sh` script.
|