- 1 Fast Rundown
- 2 Optimisation and performance considerations for Fixtures
- 3 The Fixture Blueprint and its Components
- 4 Creating a Fixture
- 4.1 Fixture Orientation
- 4.2 Fixture Y-Axis Thresholds
- 4.3 Deciding what Sub-Meshes you'll need
- 4.4 Creating the Sub-Meshes
- 4.5 Additional Considerations
- 4.6 Fixture Mod setup within Unreal Engine 4
- 4.6.1 Creating your Fixture Mod Plugin
- 4.6.2 Importing files to Unreal Engine
- 4.6.3 Creating the Fixture .CPP File
- 4.6.4 Creating the fixture thumbnail files
- 5 Cooking and Sharing your mod
- 6 Additional Notes
- 7 See Also
Fast Rundown[edit | edit source]
- Fixtures are a collection of files, for which a
cppfile serves as the parent file. All the settings for a fixture are inside this
- Fixtures are comprised of up to 4 optional Sub-meshes (UV Mesh, Conforming Mesh, Skinned Mesh, and Additional Mesh) depending on what type of fixture you want to make.
- This is what those sub-meshes do:
- UV Mesh is the silhouette of the cut out hole that a fixture makes in the car body.
- Conforming mesh (e.g. Grilles, or the front headlight glass) will stick to the body and deform to the shape of the body.
- Addditional Mesh (Things like Wing Mirrors) will retain their shape and form completely.
- Skinned Mesh (Headlight Internals) will maintain their relative internal shapes, but will conform roughly to the shape of the body.
- Needs Material Slots set up correctly
- Needs Preview Thumbnails for the fixture to appear in-game
Optimisation and performance considerations for Fixtures[edit | edit source]
Performance of fixtures and bodies in UE4 is a constant discussion of balance.
there is a performance impact to polycount with fixtures in that we have to cast a ray to the body for every vertex. so the more vertices there are on a mesh, the longer it'll take to conform to the body. this is why you'll see some detailed fixtures sit there for a few seconds before snapping to the car. this is doubly so for fixtures that cut in to the car - a UV Mesh's vertices are raycast to the car on every frame while you're dragging the fixture around. UV meshes impact performance greatly with a higher poly count. i try to keep UV meshes as low as possible.
For optimal performance:[edit | edit source]
- keep UV Meshes lower than 100 triangles. higher than this and they start to feel 'laggy' when dragging the fixture around. higher than 150 tris and it will feel too laggy to use properly
- try to keep conforming meshes lower than 5k triangles. more than this and they take longer than usual to conform to the car once they are placed.
The Fixture Blueprint and its Components[edit | edit source]
A Fixture is composed of a Blueprint that contains the fixture settings and sub-meshes.
Fixture Settings[edit | edit source]
Meshes (more on these later)
- 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
- Text Data - This is currently not used
- 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...)
- Centre Snap Distance - Defines at what distance the fixture will snap to the centre line of the car (default 10cm)
- 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.
- Export Breakability Override - Certain categories of fixture can break off when damaged in BeamNG.drive. This setting lets you force a fixture to be breakable or unbreakable.
- Fixture Shape - used for filtering fixtures when searching for them. mostly used for headlights etc.
- Year - used for filtering fixtures when searching for them.
- Use This Fixture as Family Preview - if you have many variants of a fixture, enabling this setting will make this variant the one that shows up in the main fixtures tab.
Fixture Sub-Meshes[edit | edit source]
UV Mesh[edit | edit source]
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. (As a performance consideration, it's best to keep your tri count below 100. The more dense the UV Mesh, the more performance is impacted. A hard upper limit of no more than 150 should be observed.)
Conforming Mesh[edit | edit source]
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[edit | edit source]
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 1.5mm 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[edit | edit source]
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[edit | edit source]
Note: This how-to assumes a general understanding of 3D modelling packages. Any 3D modelling package will do, as no custom scrips are required to author fixture meshes.
HardRooster has created a full video series for Fixture modding in blender:
the full series can be found here: https://www.youtube.com/playlist?list=PLb7obMX2SCf0V3dlxfOHnB9eKtP3c_KEZ
Fixture Orientation[edit | edit source]
Fixtures are oriented in the following manner in the 3D authoring package:
Fixture Y-Axis Thresholds[edit | edit source]
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[edit | edit source]
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[edit | edit source]
Creating an UV Mesh[edit | edit source]
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.
If you're having trouble with wavy cutouts on cars, try to make your UV Mesh in to quads, instead of the starburst pattern as shown here.
Creating a Conforming Mesh[edit | edit source]
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[edit | edit source]
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.
Unwraping the Mesh[edit | edit source]
The next step is to apply an Unwrap to the mesh. We'll be using 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².
We'll go over the import process and materials set up after we've created the meshes.
Creating a Skinned Mesh[edit | edit source]
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 if those vertices are closer than 1.5mm to the Y axis. This is very useful for having these parts of the mesh connect to the Conforming Mesh, as they will act the same.
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:
Apply an UVW Unwrap[edit | edit source]
Assign the same Box map with a scale of 2,2,2 as you did with the conforming mesh.
Creating an Additional Mesh[edit | edit source]
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:
Additional Considerations[edit | edit source]
Unwrapping a light component[edit | edit source]
If your fixture is a headlight/indicator/etc, and contains a reflector component to it like an incandescent bulb or something, there are some special considerations.
Lets take a look at this fixture as an example:
several things are of note with regards to light components:
- bulbs should be unwrapped as a single point with zero scale exactly at UV coordinate
0.5,0.5(the UVs are scaled to a single point in the very center)
- the main reflector part should be unwrapped such that each face fills the entirety of the
0-1UV coordinate space (
reset UV projectionin Blender).
- the side walls of the reflector (and any other part of the reflector that you want to have vertical or horizontal lines on) should be unwrapped as a single point with zero scale exactly at UV coordinate
0,1(the UVs are scaled to a single point in the bottom left corner)
- parts of the reflector that should appear flat should be unwrapped as a single point with zero scale exactly at UV coordinate
0,0(the UVs are scaled to a single point in the top left corner)
Applying materials to a light component[edit | edit source]
The bulb and reflector for each light component should be the same material, to save on draw calls. each separate light component should be a different material so the player can chose whether to have three red lights, a red a yellow and a white, or two reds and a white, etc etc.
Unwrapping a radial glass[edit | edit source]
if you are making a fixture light which has a radial pattern, unwrap it as if the radial pattern fills the whole UV space as a single texture.
Fixture Mod setup within Unreal Engine 4[edit | edit source]
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 for more information.
Creating your Fixture Mod Plugin[edit | edit source]
With the correct version of Unreal Engine, opened with our modding tool project, and plugins loaded, you should be able to 'create mod' from the top menu bar.
Importing files to Unreal Engine[edit | edit source]
Mesh Importing[edit | edit source]
There are several ways to import your sub-meshes to this mod folder. The easiest is to simply navigate to the folder you want to import your files in the Content Browser, then click the 'import' button to import files to that folder:
select the meshes you want to import, and click 'open'.
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[edit | edit source]
Assigning Material Slot names[edit | edit source]
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:
License Plate textures:
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 as a single material slot in-game. If you are making a headlight or other such fixture with a light component, the names of the slots for the corresponding pair of glass and reflector material slot names should share the same number. so a fixture with two lights would have glass_01 and bulb_01, and glass_02 and bulb_02.
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[edit | edit source]
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 CarMaterialUtils blueprint, located in: Content > Utility, 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 CarMaterialUtils:
Then open 'Get Fixture Materials from Slot', located in CarMaterialUtils > Car Painting > GetFixtureMaterialsFromSlot:
From there, select the corresponding materials array for the material type you want to apply to your sub-mesh from the Local Variables tab, 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.
Creating the Fixture .CPP File[edit | edit source]
right-click in the content browser, and from the 'camso' sub-menu, select the 'Fixture Preview Data' file. You should now have a fixture.cpp file in your content browser.
Assigning settings within the Fixture .CPP File[edit | edit source]
Open the Fixture Blueprint. You should be confronted with the following:
Fill out the 'Meshes' section with the meshes you've made, leave the 'Text' data empty, generate a GUID and Family GUID (or copy the family GUID if you're making a variant), and set the 'Fixture' settings to the relevant info as laid out at the start of this page.
Finally, in the 'Path' section, make sure there is one item in the array, and fill it with 'A_Fixture'. This is important. Your fixture will not work if this is not filled correctly.
When you're done, you should have something that looks like this:
Save your files.
Creating the fixture thumbnail files[edit | edit source]
Open the Thumbnail Generator Level[edit | edit source]
You should already be here. Check the top tab in Unreal, and make sure it says "ThumbnailGeneratorLevel_Fixture"
If you are not in the thumbnail generator level, open it from
Begin simulating the level[edit | edit source]
from the top menu, drop down next to the 'play' button and select 'simulate'. you should now be simulating.
Generate Fixture Thumbnails[edit | edit source]
Select the Fixture Thumbnail Generator from the World Outliner, and add your fixture blueprint to the 'Fixture previews 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 you have created. It does not matter if these fixtures are of the same family or not. Then, elect 'Export Preview' to generate the Thumbnail file.
Because these files are created by the modding tools, they need to be manually saved.
Your fixture mod is now ready to be shared!
Cooking and Sharing your mod[edit | edit source]
To use the mod you have just created, you need to 'share' it. See the main Modding page on how to share your mod: Modding
Additional Notes[edit | edit source]
- 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.