Fast Rundown
- Fixtures are a Blueprint class, A_Fixture is the base class.
- Fixtures are comprised of up to 4 Sub-meshes (UV Mesh, Conforming Mesh, Skinned Mesh, and Additional Mesh).
- All or none of these are required:
- UV Mesh (the silhouette of the cut out)
- Conforming mesh (e.g. Grilles, or the front headlight glass)
- Addditional Mesh (Things like Wing Mirrors)
- Skinned Mesh (Headlight Internals)
- A Fixture Category
- Snap to Centre Strength
- Lock to Cardinal (should it always face forwards, backwards, etc. Rather than face in the direction of the car body normal.)
- Needs Material Slots setup correctly
- Needs Preview Thumbnails
The Fixture Blueprint and its Components
A Fixture is composed of a Blueprint that contains the fixture settings and sub-meshes.
Fixture Settings
Fixture settings are grouped in to two categories: Editable, and Fixture.
- Editable settings are for the properties of the fixture that gets placed to the car.
- Fixture settings are for where the fixture is located in the Automation UI.
Editable settings
- Centre Snap Distance - Defines at what distance the fixture will snap to the centre line of the car (default 10cm)
- Conforming Mesh - Defines the Static Mesh sub-mesh used by this fixture
- UVMesh - Defines the UVMesh sub-mesh used by this fixture
- Skinned Mesh - Defines the Skinned Mesh sub-mesh used by this fixture
- Additional Mesh - Defines the Additional Mesh sub-mesh used by this fixture
- Lock Normal to Cardinal' - When the fixture is set to 'Lock to Cardinal': all the vertices of the Conforming Mesh, all the bones of the Skinned Mesh , and the Additional Mesh, will conform backwards in to the car at the closest 90° angle. When the fixture is not set to 'Lock to Cardinal: all the vertices of the Conforming Mesh, all the bones of the Skinned Mesh, and the Additional Mesh, will conform inwards from the centre of the fixture.
Fixture settings
- Fixture GUID - Unique identifier for this fixture.
- Family GUID - Identifier for this fixture family. Should be unique to every other family GUID, and identical to every other variant of this fixture
- Fixture Type - What category this fixture should be in (ie: headlight, aerial, grille, etc...)
- M Ghost Material - Defines the material to use when the fixture cannot be placed where the player is attempting to place it. This setting shouldn't change from its default 'FixtureError' material
unless you really want to change it.
Fixture Sub-Meshes
UV Mesh
The UV Mesh (imported as a Static Mesh in UE4) is a flat silhouette that tells the fixture to cut a hole in to the car mesh. You will only need vertices along the outside edges of the UV Mesh. An UV Mesh is only required if your fixture intends to cut in to the car.
Conforming Mesh
The Conforming Mesh (imported as a Static Mesh in UE4) is a mesh where each vertex is deformed to match the car mesh. It is also a required mesh if the fixture has an UV Mesh, as the Conforming Mesh is used to cover over the hole created by the UV Mesh. A Conforming Mesh that could logically be placed on top of other fixtures should also have its outside edges extrude in to the car (The default distance for this extrusion is slightly farther than 10cm)
Skinned Mesh
The Skinned Mesh (imported as a Skeletal Mesh in UE4) is used when you have parts of a fixture that should conform to the rough shape of the car, but also retain the dimensions and ratios of its components. A Skinned Mesh will have a bone for each element that should remain the same shape, and should be parented to the bone root. The bone location should be on Y-0 (not inside the fixture, or floating outside the front of the fixture) to allow for the proper rotation of its weighted components. All verticies of the Skinned Mesh that are further out of the car than 0.1cm will conform to the car as if they were part of a Conforming Mesh. Because of this, there will be a small gap of at least 0.1cm between the edge of the Skinned Mesh and the car body. To cover up this gap, use a Conforming Mesh to link the edge of the Skinned Mesh and the car body.
Additional Mesh
The Additional Mesh (imported as a Static Mesh in UE4) does not deform in any way and will remain in place relative to the location of the fixture. An Additional Mesh has no skin or bones, and no part of it will deform to the shape of the car. An example of an Additional Mesh is an exhaust, or the mirror section of a wing mirror.
Creating a Fixture
Note: This how-to assumes a general understanding of 3D modelling packages, and this example will be using 3DS-Max. However, any 3D modelling package that supports UV Unwraps and Skinning will do, as no custom scrips are required to author fixture sub-meshes. 3D Modelling packages that support exporting to .FBX files is ideal, but UE4 also supports .OBJ files.
Fixture Orientation
Fixtures are oriented in the following manner in the 3D authoring package:
Fixture Y-Axis Thresholds
There are 3 important values to take in to note for Fixture Sub-Meshes.
- A Fixture's Skinned Mesh will have some of its vertices conform to the car as if it were a Conforming Mesh only if those vertices are farther out from the car than 0.1cm (that's lower than -0.1cm in the Y-axis - so a vertex with a Y-axis value of -0.15cm will conform to the car as if it were part of a Conforming Mesh, and a vertex with a Y-axis value of 0.05cm will not).
- Grilles go in to the car 4.301cm (that's a Y-axis value of 4.301cm). Any fixture (like a headlight) that could be feasably placed on top of a grille fixture should have all of its important mesh structure between this point and the front of the fixture.
- The outer edges of most Conforming Meshes (and inner edges of things with holes in them, like open grilles) go in to the car 10.114cm (that's a Y-axis value of 10.114cm). This stops fixtures from appearing to 'float' when put on top of other fixtures that cut in to cars and leave a gap, such as grilles.
Here's a visual representation of these values:
It's a bit confusing at first, but following these rules will ensure your fixture works correctly.
Deciding what Sub-Meshes you'll need
Fixtures have a fairly convoluted list of things that are or are not needed, depending on what is in the fixture.
- If you have an UV Mesh, you need to have a Conforming Mesh to cover the hole.
- If you have a Conforming Mesh, it isn't required to have anything else unless the Conforming Mesh goes in to the car body mesh, in which case you'll need an UV Mesh to cut out the hole for it.
- If you have a Skinned Mesh, you'll need a Conforming Mesh and an UV Mesh, as a skinned mesh can only be inside the car, therefore an UV Mesh is needed to cut out that hole and a Conforming Mesh is needed to cover the gaps created by that hole.
- If you have an Additional Mesh that floats above the car body, you don't need anything. If the Additional Mesh goes in to the car body mesh, you'll need an UV Mesh to cut out the hole for that (and by extension, a Conforming Mesh to cover that hole).
For this example, We'll make the components for this headlight fixture:
We'll make a Conforming Mesh, UV Mesh, and a Skinned mesh with 4 bones.
Creating the Sub-Meshes
Creating an UV Mesh
The UV Mesh defines the texels of the car body that will be cut out by the fixture. Each vertex is used as a point of reference, and lines are drawn between them along the edges of the UV Mesh to define the final cut out shape on the car body.
Note that if there are too few vertices, then the cutout shape will become distorted, as the vertices are projected on to the car texture then cut out, and the actual edges of the UV Mesh are not used, resulting in waviness in the final cutout shape.
An UV Mesh should have vertices at regular intervals around the outside to determine the cutout shape of the fixture. Note that any vertices not on the outside edge are wasted and will only make the fixture slower to render. (UV Meshes can be made in annulus shapes, like a doughnut).
The UV Mesh should be roughly half-way between the outside edge of the Skinned Mesh (which should share its edge with the inside edge of the Conforming Mesh) and the outside edge of the Conforming Mesh.
See below for an example UV Mesh, in comparison to its respective Conforming Mesh.
Note that the centre vertices need to be offset slightly from their respective axes. See Additional Notes for more information.
Creating a Conforming Mesh
A Conforming Mesh is a single basic polygonal mesh that conforms to the shape of the car body.
The Conforming Mesh should have enough polygons at regular intervals so that it doesn't become blocky or clip through the car body. The more polygons you add to the Conforming Mesh, the longer it will take to calculate its final morph position, but does not impact the general dragging around of the fixture.
For this example fixture, we'll be using the Conforming Mesh for two purposes:
- Connecting the Skinned Mesh to the car body.
- Covering the cutout hole created by the UV Mesh.
However, a Conforming Mesh can be used just on its own, such as:
- when creating trim pieces, bonnet humps, or badges.
- to create Grilles, when used with an UV Mesh to cut out the hole for the Grille.
Creating the Mesh
We'll start by using the UV Mesh as our reference point. Our Conforming Mesh needs to cover the hole created here, so we'll make a ring of faces to surround the UV Mesh with enough width to not allow any gaps in the cutout texture on the car. We'll extrude this edge out in to the -Y axis (forward out from the car body) to stop this ring of faces from z-fighting with the car body, and we'll add a ring of faces around the outside of this to connect this set of faces to the car body like so:
Because this fixture is going to have a Skinned Mesh, we'll need to take that in to consideration too. A Skinned Mesh will have its vertices that are farther than 0.1cm in the -Y axis conform to the car in the same way as a Conforming Mesh, so We'll need to match this mesh structure so the two meshes are connected seamlessly on the fixture. Here is the Conforming Mesh, with the Skinned Mesh and UV Mesh. for comparison:
This headlight fixture will also have a glass cover over it, so we'll add that in now. For this example, I've added a small step to the inside of the Conforming Mesh, to add a little bit of detail. The glass cover will then be placed over top. You'll also notice that the outside edge of this headlight has been extruded far in to the car. This is so it can be placed over top of other headlights or grilles and not appear to float.
Applying Material IDs
I've used 3 materials for this fixture (but any number of materials is supported): One for the paint (red) that will go around the outside of the headlight, one for the headlight glass (transparent orange), and one for the chrome interior of the headlight (yellow). It doesn't matter what colour or order in the material ID stack you make these, as we'll apply the correct materials in Unreal Engine 4.
In 3DS-Max, this is done by applying Material IDs to the faces of the mesh, and assigning a Multi-SubObject Material with Sub-Materials applied to it.
Unwraping the Mesh
The next step is to apply an Unwrap to the mesh. We'll be use 3DS-Max's default UVW Map modifier, set it to 'box' projection, and set the length, width, and height dimensions to 2,2,2. This is an important dimension if your fixture mod intends to use our default materials, as these materials assume the UVs of the fixture conform to this setting.
Basically what this is doing is mapping every face on the mesh so that the 0-1 areas of the UV Map are 2cm².
If your 3D modelling package does not support a box projection with scaling options, try installing a student version of 3DS-Max from Autodesk's website.
We'll go over the import process and materials set up after we've created the meshes.
Creating a Skinned Mesh
A Skinned Mesh is the most complicated mesh in the fixture. It follows the same rules as the Conforming Mesh in terms of overall mesh structure and UV Mapping, but the way in which it conforms to the car is more nuanced.
The vertices of a Skinned Mesh will conform to the car in the same manner as the Conforming Mesh only if those vertices are further out than 0.1cm in the negative-Y axis, as shown below:
The rest of the mesh will conform relative to their skinned bones and weights. For this example, I've created a Skinned Mesh with 4 bones, and weighted them like so:
The bones are free floating, and are parented only to the bone root. I usually use Dummy Actors for my bones, but you can use a box mesh or whatever works. Take note that the vertices that conform to the mesh in the same manner as the Conforming Mesh in-game, but are still weighted to their respective bones. This is because the fixture blueprint uses the distance that these vertices were morphed to determine how far back to conform each bone. If these vertices were weighted to the bone root instead, then the fixture would not know how far to morph the skinned sections of the mesh.
Ureal Engine 4 also requires a bone hierarchy, so I've made a root bone and parented all of the other bones to it. The bone root should not be weighted to any vertices. The bones of the Skinned Mesh should also lie at 0 on the Y axis, as they are rotated when the fixture is set to 'lock to cardinal', and having them offset from 0 would result in strangeness.
Take a look at the below image of the skinned mesh on the car (There's also a Conforming Mesh there around the edge, but we'll ignore that for now). The outside edge of vertices are conforming to the car as if they were part of a Conforming Mesh, and the rest of the mesh is conforming as per their bone weights:
Applying Materials
As with the Conforming Mesh, assign materials to your mesh with material IDs and a multi-sub-object material.
Apply an UVW Unwrap
Assign the same Box map with a scale of 2,2,2 as you did with the conforming mesh.
Creating an Additional Mesh
An Additional Mesh is made of a simple mesh with no skin or morphs that does not deform in any way. The Additional Mesh does rotate around the fixture position, and will maintain its relative position from its pivot point.
Take the following example. This is an exhaust fixture. Notice that the entirety of the exhaust is offset from the pivot point - this is so this exhaust can hang under the car, as the fixture itself must be placed on the car but the exhaust in this instance must be under the car:
Fixture Mod setup within Unreal Engine 4
This step assumes that the correct version of Unreal Engine is installed and configured correctly. See Modding for more information on the correct version of Unreal Engine to use and how to view mod content folders. Also see the official Unreal Engine documentation on importing .FBX files.
Creating your Fixture Mod Plugin
With the correct version of Unreal Engine opened with our modding tool project and plugins loaded, you should be able to select 'create mod' from the top menu bar (step 1). From there, select 'New Fixture' (step 2), then give your mod a name (step 3) and a description (step 4), then click 'create mod' (step 5).
You should now see a file called 'NewFixture' within a new folder:
Importing files to Unreal Engine
Mesh Importing
There are several ways to import your sub-meshes to this mod folder. The one easiest to do is as follows:
UV Meshes, Conforming Meshes, and Additional Meshes should be imported as 'Static meshes' ('Skeletal Mesh' is un-ticked in the import dialogue), while Skinned Meshes should be imported as 'Skeletal Meshes' '(Skeletal Mesh' is ticked in the import dialogue).
Note that 'Skeletal Meshes' will import with additional 'Skeleton' and 'Physics Asset' files. These are important. You don't need to do anything with them, but don't delete them.
Note that 'Import Materials' is also un-ticked, as we do not want to import any materials from our authoring software. The final set of imported files in Unreal Engine should look like this:
Once your files are imported, it's important to set CPU Access to true for all Static Meshes. You can do this by selecting every Static Mesh, right-clicking on it and selecting 'Set meshes to allow CPU access'.
Assigning Default Materials and Material Slot names
This step assumes a basic understanding of the Static Mesh editor and Skeletal Mesh editor.
Assigning Material Slot names
The new fixture material swap system in Automation relies on the name of the material slots within the mesh components to define what materials can be applied to the fixture.
Therefore, Assigning the correct materials to the meshes is only important for the initial selection and loading of that fixture. In this manner, it is possible to have custom materials applied to your fixture while still being compatible with Automation's fixture switching UI.
The fixture switching UI in Automation relies on the names of the material slots on the sub-meshes to decide what category of materials the player has to select from.
The available categories for fixture materials is:
- panel_#
- glass_#
- opaqueglass_#
- grill_#
- roundglass_#
Note that these names are case-sensitive.
If you only have a single version of a fixture material category, you still need to have a number, where '#' is replaced with a number. This number scales infinitely, meaning a fixture can have many separate panel/glass/grill slots assigned to it. A Fixture's sub-meshes cannot share the same name on its material slots. If a fixture contains meshes with duplicate slot names, they will appear incorrect in-game.
Here is a headlight Conforming Mesh, with its default materials set, and the names of its material slots set to their respective types. The workflow for the Additional Mesh should be identical:
The Skeletal mesh editor looks a little different, but the slot naming is the same:
Assigning Default Materials
While the slot names define what materials the player can choose from in-game, it doesn't define what material gets first loaded when the player places the fixture on the car.
When the fixture is first placed on the car, it loads the material that is set in that fixture's sub-mesh default materials. For the sub-mesh examples above, you can see that the slot names have been set and the material slots also have materials set in them.
Therefore, for all your fixture sub-meshes, you also need to apply their default materials.
To find where all the materials available in-game are, open up the Utils blueprint, located in: Content > Utility > Utils, and open the 'Get Materials from Slot' function. There, you can view the list of each material that gets assigned in to each slot, find them in the content folder, and assign them to your mesh as the default material.
Note though that these steps are only to find where the default materials are. We do not use the Utils blueprint itself to assign materials to fixtures.
To do this, open Utils:
Then open 'Get Fixture Materials from Slot', located in Utils > Car Painting > GetFixtureMaterialsFromSlot:
From there, select the corresponding materials array for the material type you want to apply to your sub-mesh:
And in the details panel you'll see an array of the materials used for that slot type:
By expanding that, you can see the materials, and by selecting the small magnifying glass icon, view that material in the Content Browser:
and from there apply it to your sub-mesh.
Alternatively, here is a list of all the currently-used materials, and their locations in the content browser:
- Panel:
- M_Carpaint (located in: Content > Cars > Materials > NewMaterials > CarPaint)
- M_BlackPlastic (located in: Content > Environments > BuildingInteriors > Assets > ArtTest > Materials)
- M_BlackPlastic_ShinyBlack (located in: Content > Fixtures > FixtureMats)
- MI_Metal_Chrome_01_Bright (located in: Content > Cars > Materials > NewMaterials > Metal)
- Grille:
- M_Grill (located in: Content > Fixtures > FixtureMats)
- M_Grill02 (located in: Content > Fixtures > FixtureMats)
- M_Grill03 (located in: Content > Fixtures > FixtureMats)
- M_Grill04 (located in: Content > Fixtures > FixtureMats)
- M_Grill05 (located in: Content > Fixtures > FixtureMats)
- M_Grill_Trans (located in: Content > Fixtures > FixtureMats)
- M_Grill02_Trans (located in: Content > Fixtures > FixtureMats)
- M_Grill03_Trans (located in: Content > Fixtures > FixtureMats)
- M_Grill04_Trans (located in: Content > Fixtures > FixtureMats)
- M_Grill05_Trans (located in: Content > Fixtures > FixtureMats)
- M_HeadLightGlass_Clear (located in: Content > Fixtures > FixtureMats)
- TransparentMat_Inst (located in: Content > Cars > Materials > SharedMaterials)
- Glass:
- M_Indicator_SmoothGlass (located in: Content > Fixtures > FixtureMats)
- M_Indicator_SmoothPlastic (located in: Content > Fixtures > FixtureMats)
- M_Indicator_RoughPlastic (located in: Content > Fixtures > FixtureMats)
- M_BrakeLight_SmoothGlass (located in: Content > Fixtures > FixtureMats)
- M_BrakeLight_SmoothPlastic (located in: Content > Fixtures > FixtureMats)
- M_BrakeLight_RoughPlastic (located in: Content > Fixtures > FixtureMats)
- M_ReversingLight_SmoothGlass (located in: Content > Fixtures > FixtureMats)
- M_ReversingLight_SmoothPlastic (located in: Content > Fixtures > FixtureMats)
- M_ReversingLight_RoughPlastic (located in: Content > Fixtures > FixtureMats)
- Opaque Glass:
- MI_Metal_Chrome_01_Bright (located in: Content > Cars > Materials > NewMaterials > Metal)
- MI_Metal_Chrome_02_Bright (located in: Content > Cars > Materials > NewMaterials > Metal)
- MI_Metal_Chrome_03_Dark (located in: Content > Cars > Materials > NewMaterials > Metal)
- MI_Metal_Chrome_Dirt_03_Dark (located in: Content > Cars > Materials > NewMaterials > Metal)
- MI_Reflector_Orange (located in: Content > Cars > Materials > NewMaterials > Reflector)
- MI_Reflector_Red (located in: Content > Cars > Materials > NewMaterials > Reflector)
- M_Headlight_Indicator (located in: Content > Fixtures > FixtureMats)
- M_HeadlightMat_04 (located in: Content > Fixtures > FixtureMats)
- M_BrakeLightSmoothPlasticOpaque (located in: Content > Fixtures > FixtureMats)
- M_Indicator_SmoothPlasticOpaque (located in: Content > Fixtures > FixtureMats)
- M_ReversingLightSmoothPlasticOpaque (located in: Content > Fixtures > FixtureMats)
- Round Glass:
- M_RadialTaillight (located in: Content > Fixtures > FixtureMats)
- M_RadialTaillight2 (located in: Content > Fixtures > FixtureMats)
- M_RadialTaillight3 (located in: Content > Fixtures > FixtureMats)
- M_HeadLightGlass_StraightWaves (located in: Content > Fixtures > FixtureMats)
Creating the Fixture Blueprint
If your Fixture Mod only contains one fixture with no variants, you may skip this step, as the 'Creating your Fixture Mod Plugin' step should have created a fixture blueprint in your mod folder for you (unless you did not start your mod with the mod type of 'fixture mod', then please continue).
When creating a new fixture, you will need to either duplicate a blueprint from another fixture (the first fixture blueprint created by 'Creating your Fixture Mod Plugin' will work for this), or create a child blueprint from A_Fixture (located in Content/Cars/Blueprints/Fixtures) by right-clicking on it and selecting 'Create Child Blueprint Class'. The Fixture Blueprint then needs to be moved to the fixture's sub-folder location.
Your fixture folder should now look like this:
Assigning settings within the Fixture Blueprint
Open the Fixture Blueprint. You should be confronted with the following:
Assigning Meshes within the Fixture Blueprint
Assign your meshes to their respective slots by selecting them in the Content Browser then clicking on the small arrow in the fixture blueprint next to the associated slot, or by dragging and dropping the mesh in to the slot. You can also search for the mesh and assign it within the dialogue box.
Assign the GUIDs
Generate a GUID for the fixture and the family. If this fixture is part of a family, then copy-paste the family GUID instead. The Fixture GUID should always be unique.
Adjust fixture blueprint settings
- Assign the Fixture Type
- Assign the Centre Snap Distance
- Assign the 'Lock Normal to Cardinal' setting
Consult the Fixture Mods step for further descriptions on these settings.
Compile and Save the Fixture Blueprint
Once all your sub-meshes and settings have been applied in the Fixture Blueprint, you have to compile and save that blueprint.
To Compile it, press the 'Compile' button in the Fixture Blueprint (top left of the blueprint editor window).
Then either save the blueprint in the same window, or in the Content Browser.
Creating the fixture thumbnail files
The Fixture Blueprint does not get automagically loaded in to the fixture UI. The UI loads a proxy thumbnail file instead, so we need to generate this proxy file. If the Fixture Blueprint does not have an associated thumbnail, it will not show up in-game. Luckily, we have an automated script to do this.
Open the Thumbnail Generator Level
Open the Thumbnail Generator Level from: 'Content > Developer Sandbox > ThumbnailGeneratorLevel'
Populate the Fixture Thumbnail Generator
Select the Fixture Thumbnail Generator from the World Outliner, and add your fixture blueprint to the 'Fixtures to Generate' array (by first clicking the 'plus' icon, then putting the fixtures you have created in to the list).
Repeat this process for every fixture blueprint you have created. It does not matter if these fixtures are of the same family or not.
Generate the Thumbnail and CPP file
Select 'Export Preview' to generate the Thumbnail file and FixturePreviewCPP files. These files should be created within a 'thumbnail' folder within their respective fixture sub-folders.
Your fixtures should now be ready to use!
Additional Notes
- Fixtures should not have any vertices along the centre axes to avoid any miscalculation by the fixture gizmo. If the gizmo fires a ray cast through the centre line of the car, it can miss the two halves of the car and give a false positive of the fixture being out of bounds. Offsetting your vertices slightly will avoid this misfire. The Additional Mesh is the sole exception to this rule, as none of the Additional Mesh is morphed in any way.
- Is CPU Access still turned on for all Static Meshes? If your mod causes a crash, this might be un-ticked. It does that sometimes. Re-tick it, and try again.