diff --git a/Docs/export_import_dist.md b/Docs/export_import_dist.md index a0014dbc8..722456596 100644 --- a/Docs/export_import_dist.md +++ b/Docs/export_import_dist.md @@ -8,13 +8,15 @@ The main objective for importing and exporting assets is to reduce the size of t The first step is to create an empty folder inside the Carla `Import` folder and rename it with the name of the package desired. For simplifying the package folder structure,we recommend to have 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. So basically, for a **map** subfolder, we will need to place the following files: -- The map itself in `.FBX` format. -- Optionally, the textures required by the map. -- Optionally, the `.xodr` OpenDrive file corresponding to that map. + +* The map itself in `.FBX` format. +* Optionally, the textures required by the map. +* Optionally, the `.xodr` OpenDrive file corresponding to that map. And for the **props** folder, we will need the following files: -- The prop itself in `.FBX` format. -- Optionally, the textures required by the prop. + +* The prop itself in `.FBX` format. +* Optionally, the textures required by the prop. Therefore, the package folder should have this similar structure: ``` @@ -52,6 +54,8 @@ Import └── PropToImport04.fbx ``` +*Please note that the 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.* + Once set this project structure, a JSON file needs to be created for each package that will contain necessary information about the assets inside it. The format of this file must be `.json`. We recommend for the JSON file to have the same name as the package name in order to keep it organized. The content of this JSON file should be similar to the following: @@ -59,28 +63,28 @@ The content of this JSON file should be similar to the following: { "maps": [{ "name": "MyTown01", - "source": "./Town01/Town01.fbx", + "source": "./MapToImport01/MapToImport01.fbx", "use_carla_materials": true, - "xodr": "./Town01/Town01.xodr" + "xodr": "./MapToImport01/MapToImport01.xodr" }, { "name": "MyTown02", - "source": "./Town02/Town02.fbx", - "use_carla_materials": true, - "xodr": "./Town02/Town02.xodr" + "source": "./MapToImport02/MapToImport02.fbx", + "use_carla_materials": false, + "xodr": "./MapToImport02/MapToImport02.xodr" } ], "props": [{ "name": "MyProp01", "size": "medium", - "source": "./MyProp01Mesh.fbx", - "tag": "SegmentationTag01" + "source": "./AssetsToImport/PropToImport01/PropToImport01.fbx", + "tag": "SemanticSegmentationTag01" }, { "name": "MyProp02", "size": "small", - "source": "MyProp02Mesh.fbx", - "tag": "SegmentationTag02" + "source": "./AssetsToImport/PropToImport02/PropToImport02.fbx", + "tag": "SemanticSegmentationTag02" } ] } @@ -89,21 +93,26 @@ The content of this JSON file should be similar to the following: 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: -- *name*: The name of the map. It is possible to import the same map mesh but with different name and, if so, it will create separate mesh files inside Unreal for each different name. -- *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. + +* **name**: The name of the map. It is possible to import the same map mesh but with different name and, if so, it will create separate mesh files inside Unreal for each different name. +* **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. And each item inside the **props** array has the following parameters: -- *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. -- *source*: Source path of the prop inside the package folder. -- *size*: Size of the prop, possible values are: + +* **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. +* **source**: Source path of the prop inside the package folder. +* **size**: Size of the prop, possible values are: + - `tiny` - `small` - `medium` - `big` - `huge` -- *tag*: Semantic segmentation tag. Possible values are: + +- **tag**: Semantic segmentation tag. Possible values are: + - `None` - `Buildings` - `Fences` @@ -117,6 +126,7 @@ And each item inside the **props** array has the following parameters: - `Vegetation` - `Vehicles` - `Walls` + Note that if the tag is not spelled correctly, it will interpret it as `None` value by default. Now we have everything ready for importing the packages. To do so, you just need to run the command: diff --git a/Docs/generate_map_from_fbx.md b/Docs/generate_map_from_fbx.md deleted file mode 100644 index d109578f6..000000000 --- a/Docs/generate_map_from_fbx.md +++ /dev/null @@ -1,71 +0,0 @@ -

Automatically generate a map from RoadRunner

- -!!! important - The given scripts only works if the files are kept in the folders - detailed below. - -This script is aimed to reduce the time needed to setup a map inside Carla's project. -Also, in combination of the [import / export scripts](export_import_dist.md) will allow -the user to generate a simple map without opening Unreal Engine. - -!!! important - The script does heavy use of Unreal's capabilities, so it is needed to be installed - and setup, as the import fbx action is done directly over the code project, not a - distribution build. - - -

How to import a fbx

-The current script only work for files placed with the follow structure (RoadRunnerFiles is -located in the root folder): - -```sh -RoadRunnerFiles/ -├── 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 -└── MapToImport02 - ├── Asphalt1_Diff.png - ├── Asphalt1_Norm.png - ├── Asphalt1_Spec.png - ├── Concrete1_Diff.png - ├── Concrete1_Norm.png - ├── Concrete1_Spec.png - ├── Grass1_Diff.png - ├── Grass1_Norm.png - ├── Grass1_Spec.png - ├── LaneMarking1_Diff.png - ├── LaneMarking1_Norm.png - ├── LaneMarking1_Spec.png - ├── MapToImport02.fbx - └── MapToImport02.xodr -``` - -Under RoadRunnerFiles folder located at the Carla Root, place each "Export" -folder obtained from RoadRunner and rename it with the name of the map to be imported. -It have to match the .fbx -and .xodr files. - -Now, simply go into the _"Util"_ folder and run generate_map.py - -!!! important - The script, by default, checks the /Unreal/CarlaUE4/Content/Carla/ExportedMaps for matching names. - If a map with the same name as a to-be-imported map is found, it will notify the user and won't do anything. - To override this, generate_map.py can be invoked with the --force flag. - -After the script finishes, all a map with the same name of the folder and files will be located under -/Unreal/CarlaUE4/Content/Carla/Maps with all the static meshes and placed, textures, waypoints and routes -generated. - -!!! important - There is a bug in RoadRunner that generates wrong materials automatically and they get broken inside Unreal. - By adding the flag --usecarlamats the meshes will use the materials provided by Carla's project, - that will also react to the weather. diff --git a/Docs/index.md b/Docs/index.md index c82a0fcdd..36dd1f1e2 100644 --- a/Docs/index.md +++ b/Docs/index.md @@ -25,7 +25,6 @@ * [Running in a Docker](carla_docker.md) * [How to make a new map with RoadRunner](how_to_make_a_new_map.md) * [How to link Epic's Automotive Materials](epic_automotive_materials.md) - * [How to automatically generate a map from RoadRunner](generate_map_from_fbx.md) * [How to export and import maps and props for distribution builds](export_import_dist.md) * [How to add friction triggers](how_to_add_friction_triggers.md) * [How to control vehicle physics](how_to_control_vehicle_physics.md) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/CookAssetsCommandlet.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/PrepareAssetsForCookingCommandlet.cpp similarity index 92% rename from Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/CookAssetsCommandlet.cpp rename to Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/PrepareAssetsForCookingCommandlet.cpp index 132df0fc3..3b6816558 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/CookAssetsCommandlet.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/PrepareAssetsForCookingCommandlet.cpp @@ -1,6 +1,6 @@ // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. -#include "CookAssetsCommandlet.h" +#include "PrepareAssetsForCookingCommandlet.h" #include "GameFramework/WorldSettings.h" #include "HAL/PlatformFilemanager.h" #include "HAL/PlatformFile.h" @@ -9,7 +9,7 @@ // #include "CommandletPluginPrivate.h" -UCookAssetsCommandlet::UCookAssetsCommandlet() +UPrepareAssetsForCookingCommandlet::UPrepareAssetsForCookingCommandlet() { IsClient = false; IsEditor = true; @@ -33,7 +33,7 @@ UCookAssetsCommandlet::UCookAssetsCommandlet() } #if WITH_EDITORONLY_DATA -FPackageParams UCookAssetsCommandlet::ParseParams(const FString &InParams) const +FPackageParams UPrepareAssetsForCookingCommandlet::ParseParams(const FString &InParams) const { TArray Tokens; TArray Params; @@ -48,7 +48,7 @@ FPackageParams UCookAssetsCommandlet::ParseParams(const FString &InParams) const return PackageParams; } -void UCookAssetsCommandlet::LoadWorld(FAssetData &AssetData) +void UPrepareAssetsForCookingCommandlet::LoadWorld(FAssetData &AssetData) { FString BaseMap = TEXT("/Game/Carla/Maps/BaseMap"); @@ -64,7 +64,7 @@ void UCookAssetsCommandlet::LoadWorld(FAssetData &AssetData) } } -TArray UCookAssetsCommandlet::AddMeshesToWorld( +TArray UPrepareAssetsForCookingCommandlet::AddMeshesToWorld( const TArray &AssetsPaths, bool bUseCarlaMaterials, bool bIsPropsMap) @@ -136,7 +136,7 @@ TArray UCookAssetsCommandlet::AddMeshesToWorld( return SpawnedMeshes; } -void UCookAssetsCommandlet::DestroySpawnedActorsInWorld(TArray &SpawnedActors) +void UPrepareAssetsForCookingCommandlet::DestroySpawnedActorsInWorld(TArray &SpawnedActors) { for (auto Actor : SpawnedActors) { @@ -146,7 +146,7 @@ void UCookAssetsCommandlet::DestroySpawnedActorsInWorld(TArrayMarkPackageDirty(); } -bool UCookAssetsCommandlet::SaveWorld( +bool UPrepareAssetsForCookingCommandlet::SaveWorld( FAssetData &AssetData, FString &PackageName, FString &DestPath, @@ -193,7 +193,7 @@ bool UCookAssetsCommandlet::SaveWorld( return bPackageSaved; } -FAssetsPaths UCookAssetsCommandlet::GetAssetsPathFromPackage(const FString &PackageName) const +FAssetsPaths UPrepareAssetsForCookingCommandlet::GetAssetsPathFromPackage(const FString &PackageName) const { FString PackageConfigPath = FPaths::ProjectContentDir() + PackageName + TEXT("/Config/"); @@ -265,7 +265,7 @@ bool SaveStringTextToFile( return true; } -bool UCookAssetsCommandlet::SavePackage(const FString &PackagePath, UPackage *Package) const +bool UPrepareAssetsForCookingCommandlet::SavePackage(const FString &PackagePath, UPackage *Package) const { FString PackageFileName = FPackageName::LongPackageNameToFilename(PackagePath, FPackageName::GetMapPackageExtension()); @@ -274,7 +274,7 @@ bool UCookAssetsCommandlet::SavePackage(const FString &PackagePath, UPackage *Pa *PackageFileName, GError, nullptr, true, true, SAVE_NoError); } -int32 UCookAssetsCommandlet::Main(const FString &Params) +int32 UPrepareAssetsForCookingCommandlet::Main(const FString &Params) { FPackageParams PackageParams = ParseParams(Params); diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/CookAssetsCommandlet.h b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/PrepareAssetsForCookingCommandlet.h similarity index 96% rename from Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/CookAssetsCommandlet.h rename to Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/PrepareAssetsForCookingCommandlet.h index 8b7de8878..7b0042cac 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/CookAssetsCommandlet.h +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Commandlet/PrepareAssetsForCookingCommandlet.h @@ -16,7 +16,7 @@ #include #endif // WITH_EDITORONLY_DATA #include -#include "CookAssetsCommandlet.generated.h" +#include "PrepareAssetsForCookingCommandlet.generated.h" USTRUCT() struct CARLA_API FPackageParams @@ -51,7 +51,7 @@ struct CARLA_API FAssetsPaths }; UCLASS() -class UCookAssetsCommandlet +class UPrepareAssetsForCookingCommandlet : public UCommandlet { GENERATED_BODY() @@ -59,7 +59,7 @@ class UCookAssetsCommandlet public: /** Default constructor. */ - UCookAssetsCommandlet(); + UPrepareAssetsForCookingCommandlet(); #if WITH_EDITORONLY_DATA /** diff --git a/Util/BuildTools/Import.py b/Util/BuildTools/Import.py index 172110173..c2ae75b90 100755 --- a/Util/BuildTools/Import.py +++ b/Util/BuildTools/Import.py @@ -273,7 +273,7 @@ def move_uassets(package_name, maps): def prepare_cook_commandlet(package_name): - commandlet_name = "CookAssets" + commandlet_name = "PrepareAssetsForCooking" commandlet_arguments = "-PackageName=%s" % package_name invoke_commandlet(commandlet_name, commandlet_arguments) diff --git a/mkdocs.yml b/mkdocs.yml index ab560369b..168bb3429 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -21,7 +21,6 @@ nav: - 'Running in a Docker': 'carla_docker.md' - "How to make a new map with RoadRunner": 'how_to_make_a_new_map.md' - "How to link Epic's Automotive Materials": 'epic_automotive_materials.md' - - "How to automatically generate a map from RoadRunner": 'generate_map_from_fbx.md' - "How to export and import maps and props for distribution builds": 'export_import_dist.md' - "How to record and replay": 'recorder_and_playback.md' - "Recorder binary file format": 'recorder_binary_file_format.md'