You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Docs/Tutorials/CustomActor.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -21,9 +21,9 @@ We are often interested in spawning arbitrary "AR-like" (Augmented reality) elem
21
21
22
22
# Usage
23
23
24
-
Using these CustomActors is designed to be straightforward and cooperate with UE4/Carla's notion of [AActors](https://docs.unrealengine.com/5.0/en-US/API/Runtime/Engine/GameFramework/AActor/). You can see how we define all the core data for these actors (and what gets recorded/replayed) in [`DReyeVRData.h`](../Carla/Sensor/DReyeVRData.h)`::CustomActorData`
24
+
Using these CustomActors is designed to be straightforward and cooperate with UE4/Carla's notion of [AActors](https://docs.unrealengine.com/5.0/en-US/API/Runtime/Engine/GameFramework/AActor/). You can see how we define all the core data for these actors (and what gets recorded/replayed) in [`DReyeVRData.h`](../../Carla/Sensor/DReyeVRData.h)`::CustomActorData`
25
25
26
-
We have several basic 3D shapes ready for simple CustomActor usage. Theoretically you can use any static mesh. To access these types (or add your own) you should check out the references in [`DReyeVRCustomActor.h`](../Carla/Actor/DReyeVRCustomActor.h):
26
+
We have several basic 3D shapes ready for simple CustomActor usage. Theoretically you can use any static mesh. To access these types (or add your own) you should check out the references in [`DReyeVRCustomActor.h`](../../Carla/Actor/DReyeVRCustomActor.h):
Implementation wise, the custom actors are all managed by a "global" table (`static std::unordered_map<std::string, classADReyeVRCustomActor*>`) that indexes the actors by their `Name` therefore it is critical that they all have unique names. This is often easy to do when spawning many since UE4 `AActor`s themselves have unique names enumerated by their spawn order. To further understand how we use the global table, check out `ADReyeVRCustomActor::ActiveCustomActors` in [`DReyevRCustomActor.h`](../Carla/Actor/DReyeVRCustomActor.h)
51
+
Implementation wise, the custom actors are all managed by a "global" table (`static std::unordered_map<std::string, classADReyeVRCustomActor*>`) that indexes the actors by their `Name` therefore it is critical that they all have unique names. This is often easy to do when spawning many since UE4 `AActor`s themselves have unique names enumerated by their spawn order. To further understand how we use the global table, check out `ADReyeVRCustomActor::ActiveCustomActors` in [`DReyevRCustomActor.h`](../../Carla/Actor/DReyeVRCustomActor.h)
Note that in order to use the `Opacity` property, the material needs to have a translucent blend mode. So far we only have two material types, opaque and translucent, each with their own set of available properties as follows:
As an example of the CustomActor bounding boxes in action, checkout [`LevelScript.cpp::DrawBBoxes`](../DReyeVR/LevelScript.cpp) where some simple logic for drawing translucent bounding boxes is held (coloured based on distance to EgoVehicle). To enable this function, you'll need to manually enable it by removing the `#if 0` and corresponding `#endif` around the function body.
101
+
As an example of the CustomActor bounding boxes in action, checkout [`LevelScript.cpp::DrawBBoxes`](../../DReyeVR/LevelScript.cpp) where some simple logic for drawing translucent bounding boxes is held (coloured based on distance to EgoVehicle). To enable this function, you'll need to manually enable it by removing the `#if 0` and corresponding `#endif` around the function body.
Copy file name to clipboardExpand all lines: Docs/Tutorials/CustomEgo.md
+15-15Lines changed: 15 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ A guide from how to add your own custom EgoVehicle from an existing Carla vehicl
30
30
- Inside your `XYZ/` folder, you'll want to copy your new BP_XYZ asset (do this from the editor so that cached paths can be updated) and create any additional folders in here that you might want (ex. `Mesh`, `Mirrors`, `SteeringWheel`, `Tires`, are a few examples).
31
31
- It is best to perform these asset file modifications within the Editor. You can copy the files from within the content browser to other folders by click+dragging to get this pop-up:
32
32
33
-

33
+

34
34
35
35
**NOTE**: If you want to edit the vehicle mesh at all, this is where you'd want to do it. You will probably want to build off the existing static meshes in the `Static` directory.
36
36
@@ -40,16 +40,16 @@ A guide from how to add your own custom EgoVehicle from an existing Carla vehicl
40
40
2. Select `Class Defaults` then in the top right (`Class Options`) select the `Parent Class` and search for `EgoVehicle` to reparent (as in the figure below). This effectively reorganizes the blueprint's base class from `BaseVehiclePawn` (the Carla default) to `EgoVehicle` (the DReyeVR C++ class, which still inherits from BaseVehiclePawn).
41
41
- There will be a warning pop-up regarding data loss, you should proceed (it is purely additive).
42
42
- **NOTE** if the blueprint ever gets corrupted, you should first try reparenting back to the `BaseVehiclePawn` (the original parent) and then back to the DReyeVR `EgoVehicle`.
- Demonstrating class setting button, used to edit this BP's class instance
45
-
- 
45
+
- 
46
46
- Demonstrating the reparenting button, select the dropdown and search for a compatible class to reparent with `BaseVehiclePawn` (Carla) or `EgoVehicle` (DReyeVR).
47
47
3. Now this vehicle is technically a DReyeVR EgoVehicle!
48
48
49
49
## 3. Add the new config file and code
50
50
Now, to actually register this new blueprint with DReyeVR and have it available to spawn you'll need to add two bits to the code:
51
51
52
-
1. Add the name of your new vehicle (for example `"Ambulance"` for the `BP_Ambulance` blueprint we inherited) to the list of available EgoVehicles in [`DReyeVRFactory.h`](../DReyeVR/DReyeVRFactory.h).
52
+
1. Add the name of your new vehicle (for example `"Ambulance"` for the `BP_Ambulance` blueprint we inherited) to the list of available EgoVehicles in [`DReyeVRFactory.h`](../../DReyeVR/DReyeVRFactory.h).
53
53
```c++
54
54
// place the names of all your new custom EgoVehicle types here:
55
55
/// IMPORTANT: make sure these match the ConfigFile AND Blueprint!!
@@ -63,7 +63,7 @@ Now, to actually register this new blueprint with DReyeVR and have it available
63
63
// add more here
64
64
};
65
65
```
66
-
2. Add a new config file (to `Unreal/CarlaUE4/Config/EgoVehicles/`) that is used to parameterize this vehicle. This allows DReyeVR to know where to place things such as the camera root location (driver's seat), mirrors, steering wheel, etc. and this [`ConfigFile`](../DReyeVR/ConfigFile.h) can be extended to support many run-time combinations.
66
+
2. Add a new config file (to `Unreal/CarlaUE4/Config/EgoVehicles/`) that is used to parameterize this vehicle. This allows DReyeVR to know where to place things such as the camera root location (driver's seat), mirrors, steering wheel, etc. and this [`ConfigFile`](../../DReyeVR/ConfigFile.h) can be extended to support many run-time combinations.
67
67
- You'll need to make sure the config file has the EXACT same name as your new EgoVehicle (this is how they are read). We recommend copying an existing config file (default is `TeslaM3.ini` and renaming as follows):
68
68
```
69
69
CarlaUE4/Config/
@@ -80,16 +80,16 @@ Now, to actually register this new blueprint with DReyeVR and have it available
80
80
...
81
81
```
82
82
- Then you'll probably want to edit some of the contents of this file to match the EgoVehicle specifications which you can get from the Editor. For instance, the following figure shows that we are going to want to move the VRCameraRoot (head position) to (`108, -40, 158`).
- You'll probably also want to move the dashboard elements around to whatever fits your preference.
85
85
- **IMPORTANT** You also need to enable the `Start with Tick Enabled` for the Blueprint (`BP_Ambulance` in the Components list) because by default they are disabled for Carla vehicles:
- You should also notice that assets such as the SteeringWheel & Mirrors don't have any assigned static mesh. You can access these by clicking the component (on the left hierarchy) and assigning a new static mesh (on the right details pane). This bakes the asset directly in the blueprint file, so this only needs to be done once.
- Now, open the `Ambulance.ini` file you just created and begin updating the fields (mostly transforms) to match the parameters you care about. Importantly, for the `[Blueprint]::Path` entry, you'll get this path by right-clicking on the Blueprint in the content viewer and selecting `Copy Reference`.
92
-
- 
92
+
- 
93
93
- Note that transforms are encoded as follows
94
94
```ini
95
95
# Format: Location XYZ in CM | Rotation Roll/Pitch/Yaw in Degrees | Scale XYZ percent (1=100%)
@@ -116,14 +116,14 @@ See Carla's corresponding documentation [here](https://carla.readthedocs.io/en/l
116
116
117
117
### Steps to create a new animation blueprint for Carla/DReyeVR
118
118
1. Create a new Animation Blueprint in the Ambulance/Mesh directory (if you have one, else make a new folder `Mesh/` inside `Ambulance`).
2. Make sure the parent of the animation mesh is set to `VehicleAnimInstance` and the preview skeleton is set to the skeletal mesh of your new vehicle (ex. `SK_Ambulance_Skeleton`)
4. Open another nearby animation blueprint (ex. `Content/DReyeVR/EgoVehicle/TeslaM3/Mesh/Animation_model3`) and open its AnimationGraph to copy the first three blueprint nodes that connect to the Output Pose as follows:
125
-
-
125
+
-
126
126
5. Then, back in `Anim_Ambulance`, paste the three nodes you just copied and connect them to the Output Pose:
6. Finally, go back to the vehicle blueprint (BP_Ambulance) and in the components section select Mesh, then in the (right) details panel change the animation class to your new `Anim_Ambulance` like this:
While the default LOD settings are pretty good in Carla, this works because **Carla was not designed for VR** and expects to be run on a flat screen. However, we are using Carla in a VR setting, and it quickly becomes much more pronounced when models transform into lower/higher quality forms. This can be very distracting and immersion-breaking for the person in the headset.
@@ -29,13 +29,13 @@ In order to actually access the LOD's for every blueprint, we're actually going
29
29
30
30
For example, for the `SM_TeslaM3_v2` skeletal mesh (note there is also a `SM_Tesla` static mesh, the naming scheme is unfortunately not very consistent), head over to `Content/Carla/Static/Vehicles/4Wheeled/Tesla/` in the Content Browser to see the following folder layout:
Notice how the model underlined in **pink** is the skeletal mesh we are interested in. Double click it to open it in the Editor.
35
35
36
36
Then, in the left, in the `Asset Details` pane (highlighted below in **red**) you can see the LOD Picker settings is currently set to Auto (LOD0) this will automatically compute and assign the LOD for this mesh based on your distance. You can see the current LOD settings in action in the top left of the preview window (highlighted below in **yellow**).
From the LOD picker you could check the `"Custom"` box and edit the individual LOD settings manually, but this is a lot of tedious work that would need to be applied to **every** static mesh individually. In this guide we'll try to avoid tedious work.
41
41
@@ -48,7 +48,7 @@ If you don't have an existing LODSettings asset (we've provided one in [`Tools/L
48
48
49
49
| LODSettings pre application | LODSettings post application |
Now you should be able to open up the newly created `LODSettings` asset (`SM_Vehicle_LODSettings`) in the editor and edit all the important LOD parameters from there. Here is where the fine-tuning for screen-size takes place as you can manually tune when transitions happen.
54
54
### NOTE
@@ -66,7 +66,7 @@ Something to keep in mind is that different vehicles even have different number
66
66
67
67
This should look something like the following (with LODGroups collapsed):
Theoretically we should be able to have this class completely in C++ since it is a [`USkeletalMeshLODSettings`](https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/Engine/USkeletalMeshLODSettings/) class. But it is fairly low on the priority list.
72
72
@@ -81,7 +81,7 @@ The steps we recommend are as follows:
81
81
2. In the bottom right (View Options) uncheck the `Folders` option
82
82
3. In the top left click the `Filters` and check the `SkeletalMesh` option
83
83
- Now you should see this (notice all pink underlined):
- We are still unsure why, but these particular vehicles cause a segmentation fault (something to do with their vertex makeup) upon this application. You will need to manually set the LOD parameters for individual custom LOD's for each of them (ie. do NOT use the `SM_Vehicle_LODSettings.uasset` at all)
96
96
5. Right click any of the highlighted vehicles -> `Asset Actions` -> `Bulk Edit via Property Matrix`
6. In the `Bulk Edit` window that opens up, verify all the correct skeletal meshes on the left, then in `LODSettings` on the right, click the 3x3 grid icon (Pick asset) and choose the newly created `SM_Vehicle_LODSettings.uasset` asset.
99
99
1. To apply this to all the selected skeletal meshes, go to the top bar -> `File` -> `Save`
100
100
2. The end result should look something like this:
101
-

101
+

102
102
103
103
As mentioned in step 4, some particular vehicles cause a seg-fault after giving them this `LODSettings`. We are still investigating why exactly but for now its safer to just manually go into each vehicle and tune the individual `LOD` settings after checking `Custom` and seeing the `LOD0`, `LOD1`, `LOD2`, ... etc. options.
0 commit comments