Car Body Mods: Difference between revisions

From Automation Game Wiki
No edit summary
Line 76: Line 76:
=== List of car body materials ===
=== List of car body materials ===
The following materials are used on car bodies:
The following materials are used on car bodies:
{| class="wikitable mw-collapsible"
{| class="wikitable mw-collapsible mw-collapsed"
!Material Name
!Material Name
!Area Used
!Area Used
Line 331: Line 331:
**This weighting will be a number between 0 and 1, defining how much a vertex follows the movement of a bone.
**This weighting will be a number between 0 and 1, defining how much a vertex follows the movement of a bone.
**The weighting is an 8-bit bit value, ie; all values are rounded to the nearest 1/256th
**The weighting is an 8-bit bit value, ie; all values are rounded to the nearest 1/256th
**For vertices that do not use a bone and instead are morphed with morph targets, they must still be weighted to the Root bone. all vertices must have a weight, and all weights must add up to 1.
**for vertices with weights that add up to above 1, you will get errors. do not do this. all weights must add up to 1.
**'''''All vertices must have a weight, and all weights must add up to 1.'''''
*When you morph the car in-game, your mouse movements move the bone, and the vertices follow the bone.
*When you morph the car in-game, your mouse movements move the bone, and the vertices follow the bone.
<br /><gallery mode="nolines" widths="240" heights="240">
File:Bones.jpg|A spoopy skeleton. This is how you'd expect bones to look in a character.
File:Weights.jpg|Skin weight colours. The top row of verts is skinned to a value of 1 (red), descending towards 0 (grey) as you go lower down the mesh.
File:ArmatureNaming 02.gif|Adding a dummy object.
File:DummyBones.jpg|A dummy bone setup.
</gallery>


====Setting up bones for morphs====
====Setting up bones for morphs====

Revision as of 21:25, 16 November 2021

Overview

a Car body is a collection of files, of which the Body Variant Preview File is the parent.

The Body Variant Preview File contains the settings and applicable options for the car body, as well as a reference to the car body mesh.

The car body mesh is a skeletal mesh in UE4 which is set up in a specific way. The mesh needs a set of placeholder materials assigned to it, as well as needing a certain orientation and size, and specific UV layouts, along with highly specialised modelling and rigging.

Workflow

  1. In a 3D modeling package:
    1. Create a car body mesh
    2. set up the skin / rig / morph targets
    3. create the UVs
  2. in UE4:
    1. set up a mod
    2. import the car body to the mod folder
    3. fill the car body with the placeholder materials
    4. create and fill out a body variant preview file
    5. generate the car thumbnail and preview info
    6. cooking your mod
  3. in the Workshop Publishing Tool
    1. set up a workshop item
    2. share your mod

Creating the Car Body Mesh

Overview

Prior experience with modelling (particularly with subdivision surfaces) is required to make good Automation car bodies. Should you lack said experience, the links below are some good places to start:

Automation car bodies in particular should be created as a half, and then mirrored at or near completion to ensure symmetry and minimise the amount of work required to tweak them. Which half of a body you decide to model is irrelevant.

For an overview of how a vanilla body is modelled, Hard Rooster has made a video series covering the modelling of a body from start to finish in Blender.

Notes

  • UE4's units are in centimetres
  • A finished car body mesh is made of between 7000 and 30000 triangles.
    • This varies depending on things like the curvature of the body (compare a 1980s van to a 1950s sports car, for example), morphs that may require special topology, and the size of the body (as insufficient triangle density on a larger body may result in fixture tearing).
  • Panel gaps (including door seams) are modelled into the car.
    • a transparent mesh is often added over the panel seam to make fixtures conform more smoothly.
  • The entire car should be one object/element.
  • The body must not contain integrated mirrors, grilles, lights, badges, vents, door handles, aerials, fuel caps etc. Those should be made separately as fixtures.
    • An exception may be made for sculpted vents (without the actual vent area, such as those on the LD Dodge Charger) or character lines, if they can be morphed flat and/or don't interfere with the versatility of the body.
  • Use quads as much as possible, as they shade and reflect better than tris.
  • The body must be single sided, and must not have backfaces. It is made double-sided by materials in UE4.


Coordinates

  • The front of the car body should face towards the negative Y (front to back) axis
  • the center of the body should be roughly at 0 on the Y axis, and exactly 0 on the X axis.
  • The bottom edge of the car should roughly sit at 0 on the Z axis, with the top facing towards positive Z (ie: it should not be upside-down).
    • Remember that the Y axis in 3ds Max and Blender runs forwards and backwards, whereas the Z axis runs up and down. This may not be consistent across all 3D packages.
  • All vertices at the centre of the car (where it's cut in half) should be exactly at 0 on the X (left to right) axis.

Applying Materials

Automation uses a set of placeholder materials applied to the mesh to define different paintable parts of the car.

Only one of each material is supported.

  • If you need more materials to assign, consider adjusting your mesh, because there are no more materials to assign than those listed here, and you can only have one of each. 😉
  • These will be replaced with the correct materials (if you've assigned the material slots correctly), informing the game what various areas of the car are used for, and what materials they require.
  • These materials are colour-coded to represent the different areas of the car, and are replaced with the proper in-game materials dynamically. Make sure to assign these placeholders correctly!

List of car body materials

The following materials are used on car bodies:

Material Name Area Used Category Colourable Location in UE4 Notes
Bonnet The bonnet Body Yes Content/Cars/Meshes/Bodies/Bonnet General paintable material.
BonnetCam The location of the bonnet camera N/A No Content/Cars/Meshes/Bodies/BonnetCam This material is invisible in-game and has no effect on aesthetics.

for the Exporter, the bounding box origin of the geometry which uses this material defines where the bonnet camera will be.

Bumper_Front The front bumper Body Yes Content/Cars/Meshes/Bodies/Bumper_Front At the moment, front and rear bumper colours cannot be chosen independently in-game, but having two separate materials is good practice for futureproofing.
Bumper_Rear The rear bumper Body Yes Content/Cars/Meshes/Bodies/Bumper_Rear At the moment, front and rear bumper colours cannot be chosen independently in-game, but having two separate materials is good practice for futureproofing.
CabinBounds DEPRECIATED N/A No Content/Cars/Meshes/Bodies/CabinBounds This material is no longer used for defining a bounding box for car calculations. These car calculations are instead calculated dynamically.

This material is listed for legacy purposes only.

CargoBounds DEPRECIATED N/A No Content/Cars/Meshes/Bodies/CargoBounds This material is no longer used for defining a bounding box for car calculations. These car calculations are instead calculated dynamically.

This material is listed for legacy purposes only.

Chrome Areas that must remain chrome N/A No Content/Cars/Meshes/Bodies/ChromeBUS For parts of the car that should always be chrome, use this material.

This material cannot be changed in-game.

DriverCam The location of the driver camera(s) N/A No Content/Cars/Meshes/Bodies/DriverCam This material is invisible in-game and has no effect on aesthetics.

for the Exporter, the bounding box origin of the geometry which uses this material defines where the driver camera will be.

optionally this material can split the geometry across both sides of the car, allowing for a left and right driver position.

For the BeamNG exporter, this position is then ray-cast to from a position at the front of the car, and the collision position to any vertex/face will become the driver camera position. Effectively, this means the Driver Cam position is just in front of the windshield of the position of this bounding box origin.

FrontBounds DEPRECIATED N/A No Content/Cars/Meshes/Bodies/FrontBounds This material is no longer used for defining a bounding box for car calculations. These car calculations are instead calculated dynamically.

This material is listed for legacy purposes only.

LipPlacement panel gaps, wheel wells, undertray N/A No Content/Cars/Meshes/Bodies/LipPlacement Used to cover panel gaps, wheel wells, and undertrays.

This material is invisible in-game.

LowerBounds DEPRECIATED N/A No Content/Cars/Meshes/Bodies/LowerBounds This material is no longer used for defining a bounding box for car calculations. These car calculations are instead calculated dynamically.

This material is listed for legacy purposes only.

Paint The primary paint colour Body Yes Content/Cars/Meshes/Bodies/Paint General paintable material.
Paint_Two_Tone The secondary paint colour Body Yes Content/Cars/Meshes/Bodies/Paint_Two_Tone General paintable material.
Paint Misc 1 Misc paint Body Yes Content/Cars/Meshes/Bodies/Paint_Misc_1 General paintable material.
Paint Misc 2 Misc paint Body Yes Content/Cars/Meshes/Bodies/Paint_Misc_2 General paintable material.
Paint Misc 3 Misc paint Body Yes Content/Cars/Meshes/Bodies/Paint_Misc_3 General paintable material.
Trim The general trim colour Trim Yes Content/Cars/Meshes/Bodies/Trim General paintable material.
Trim Misc 1 Misc trim Body Yes Content/Cars/Meshes/Bodies/Trim_Misc_1 General paintable material.
Trim Misc 2 Misc trim Body Yes Content/Cars/Meshes/Bodies/Trim_Misc_2 General paintable material.
Trim Misc 3 Misc trim Body Yes Content/Cars/Meshes/Bodies/Trim_Misc_3 General paintable material.
Plastic Areas that must remain plastic N/A No Content/Cars/Meshes/Bodies/Plastic Used for underbodies and wheel wells.

This material cannot be changed in-game.

Reflective_Mirror Deprecated N/A No Content/Cars/Meshes/Bodies/Reflective_Mirror Used for reflective mirror glass, back when mirrors were modelled into car bodies.
Soft_Top The cloth roof of a softtop convertible Body Yes Content/Cars/Meshes/Bodies/Soft_Top General paintable material.
Steel Areas that must remain steel N/A No Content/Cars/Meshes/Bodies/Steel For parts of the car that should always be steel, use this material.

This material cannot be changed in-game.

Tray The bed of a pickup truck or ute Body Yes Content/Cars/Meshes/Bodies/Tray Fixtures cannot be placed on this material.
Window_Pillar The pillar trim colour Window pillar Yes Content/Cars/Meshes/Bodies/Window_Pillar General paintable material.
Window_Trim The window trim colour Window Trim Yes Content/Cars/Meshes/Bodies/Window_Trim General paintable material.
Windows The car's windows N/A Yes Content/Cars/Meshes/Bodies/Windows General paintable material.

Window transparency can be adjusted in-game.

Wing_Mirror_Trim DEPRECIATED Trim Yes Content/Cars/Meshes/Bodies/Wing_Mirror_Trim


Used for mirror trim, back when mirrors were modelled into car bodies.

This material is listed for legacy purposes only.

Creating Body Morphs

Automation car bodies support both morph targets (shape keys), and skinning (rigging) for morphing parts of a car body. You can mix and match as many of each as you want, but be careful with overlapping morphs.

In-game, the morph which is selected is defined as the morph with the highest weighting of the selected face/vertex.

  • morph targets are treated as a maximum weight of 0.3 for the vertices that move the most, and multiply down to 0 for vertices that do not move at all for the morph.
    • for instance, a morph target which tilts the window pillar forward/backward would have a maximum weight of 0.3 at the top, and 0 at the bottom, with the vertex weighting blending down through the vertices like a gradient
  • skin weights should be weighted roughly similarly to morph targets, so a maximum weight on a skin should be about 0.3
    • you can go as high as 1 if you are not using morph targets also, or if your morph targets do not overlap a particular set of skin weights
    • skin weights should be defined in 8-bit intervals only. UE4's skeletal meshes only support 8-bit weights, so authoring your skin to use values as a multiple of 1/256 is important. as a rough estimate, values that are a multiple of 0.004 work fine.

Creating morphs with skinning

Skinning is the main system used to allow the player to drag around and deform a car body in Automation. It's done via weighting specific vertices to various "bones" that are a representation of what the player is dragging in-game when deforming the body.

It's also probably the single most confusing step of car creation in Automation, as it's done in a way that doesn't have a great deal in common with any other widely used game art process. It uses the same tools as skinning a character in a 3D modelling application, so referring to some character skinning tutorials may give you useful insights into the tools used, but the way Automation uses it is quite unique.

Basic skinning overview

In Automation, bones are used to define which part of the morph moves, but are non-hierarchical. The bones float in space around the car without any connection to each other, with only a Root bone as their parent.

  • Every vertex on a skinned model has a skin weight to at least one bone, and at most four bones.
    • This weighting will be a number between 0 and 1, defining how much a vertex follows the movement of a bone.
    • The weighting is an 8-bit bit value, ie; all values are rounded to the nearest 1/256th
    • For vertices that do not use a bone and instead are morphed with morph targets, they must still be weighted to the Root bone. all vertices must have a weight, and all weights must add up to 1.
    • for vertices with weights that add up to above 1, you will get errors. do not do this. all weights must add up to 1.
    • All vertices must have a weight, and all weights must add up to 1.
  • When you morph the car in-game, your mouse movements move the bone, and the vertices follow the bone.

Setting up bones for morphs

You can use basically any object you like as a bone in 3ds Max, but the preferable method is to use Dummy Objects (see above). They won't get in the way of viewing the car, show links to confirm they're correctly bound to the root bone, and can't be accidentally made visible in game.

In Blender, create an armature object and parent bones to a root bone (with offset) in Edit Mode.

Bones should float freely around the area which they will deform. All bones should be parented to another bone at the origin of the car called Bone Root. The naming and hierarchy of this bone is important. It is a requirement for the root bone to be named Bone Root; otherwise, the body will not work correctly!

The morphs you create are up to you, and vary depending on the shape of the car and which parts can be deformed attractively, but almost every car will have bones for:

  • Front and rear wheel arch flares
  • Windscreen rake angle
  • Rear window rake angle
  • Boot/rear length or angle
  • Front and rear bumper length

There is no real limit to how many bones you can have, but each vertex can only be skinned to 8 different bones, and it can be very difficult in-game to select and deform an area that's skinned to more than 2 bones. This is because in-game, when you hover over the car, the bone weighted the most to the vertex under your cursor is the bone that you will be moving.

Bones should be created floating near the part of the car they deform. Their location isn't really important to how they function ingame, but having them placed correctly makes it much easier to understand what each bone is for adjusting their limits in later stages of the modding process. Also, having bones off-screen while trying to morph an area in-game results in it not moving, so try to keep the bones relatively close to the areas they're morphing.

Note that if you are using the 3ds Max script, you do not need to create bones for anything on the opposite side of the car (e.g wheel arches on the other side), as they will automatically be mirrored when you mirror the car body. If you are not using the script, or you are using Maya or Blender, all bones that should mirror their actions on the other side of the car (such as wheel arches) should have the correct naming nomenclature so they work correctly in-game. The following suffixes work for mirrored bones in Automation:

  • <Name>_opposite
  • <Name>_R
  • <Name>_L
  • L.<Name>
  • R.<Name>

BoneLayout2.jpg

ArmatureNaming 01.gif

Adding bones in 3ds Max

Adding bones in Blender

Weighting the skin

Now comes the complex bit. Weighting skins is a difficult and creative proccess that's almost like remodeling the car into different shapes, but with only skin weights to do it with. Wheel arches are often the easiest place to start on a new model, and a good way to start is to move a bone a reasonably large distance in the direction you want it to move (say, 25 to 50 cm) and then start weighting to that bone's new position.

For 3ds Max

To move a bone, simply select the bone or dummy object and move it.

To edit weights, go back to the car mesh, press Edit Envelopes, and tick Vertices under the parameters section of the skin modifier, to get into the correct mode to edit vertex weights.

ArmatureNaming 08.gif

While you're in Edit Envelopes mode, click on the little grey stick inside the bone you wish to edit weights for. Make sure the Rigid box is unticked, and the Normalize box is ticked.

SelectBoneLink.gif

Select some vertices, and by clicking and dragging upwards on the arrows next to Abs Effect, set some weighting to the bone. As you set the weight higher, the selected vertices will move closer to the position you've moved the bone to. If you need finer adjustment of the weighting, hold Alt while you're dragging.

Remember that the higher you set the weight, the farther that area will move with mouse input, and the less weight will be available to assign to other bones. This isn't too important on wheel arches, but can be an issue on other parts of the car which may share more bones.

If your Abs Effect values are jumping to 1.0 when you modify them, enter "Edit Envelopes" mode, select the root bone, select all vertices, and then assign the Abs Effect to 1.0 to fix the issue. This happens because all weights on a vertex need to add up to 1, and if the current bone is the only bone assigned to that vertex, it can't have a weight less than 1. By adding the root bone as a second bone, you can now adjust the weight of the bone you want, and the bone root will take the remaining weight.

Weight1.gif

For Blender

To move a bone, select the armature and either press Ctrl+Tab to switch to Pose Mode, or select Pose Mode from the modes menu:

Blender PoseMode 01.gif

Bones in Blender affect vertex groups of their same name. To skin a mesh, you assign vertices of that mesh to the vertex group (of the same name as the bone you want them to be affected by), and then adjust the weight of that vertex (as a value from 0 to 1) to that vertex group. Keep in mind that Unreal Engine rounds bone weights to the nearest 1/256 (with intervals of roughly 0.004). This minimum weight interval isn't 100% reliable in some cases—instead, a minimum of 0.008, 0.012, or 0.016 may be used.

You may also use weight painting as per Hard Rooster's video tutorial series, which requires more setup but is generally faster and more convenient.

Effectively, what you're doing here is using weighting to remodel the car into the shape you want it to be at the furthest extremes of bone movement. If you can make it the correct shape with the bone moved to its maximum position and with the bone back in its normal position, everything in between should take care of itself, and any bone position in between should look good too.

MoveBone2.gif

Windscreens are also a good place to learn to skin, as you can basically move the windscreen bone forwards, and then try your best to use skin weights to make an almost vertical windscreen. If you can get that working correctly, then you should have a bone that lets you smoothly change the angle of the windscreen.

MoveWindscreenBone2.gif

Creating morphs with morph targets

For Automation, we support using morph targets and shape keys for morphing a car body. This is done by storing a default value (the base car) and a morph to morph to (the morph target/shape key), and interpolating between those two shapes for every morph. The game supports morph values between 0 and 1 only, and only in one direction. This is why skinning is better for the corners of a car body, because that allows for a full two (or even three) dimensions of movement for every morph. It is up to you to decide which method you would prefer to use. Morph targets are generally easier to set up.

In Blender

You can now edit the mesh to be in the new position you want it to be in for that morph.

Repeat for as many morphs as you would like, taking into consideration that every vertex that each morph affects will add to the total polygon count for that body. If you have too many morphs on a body with too many polygons, you will have a very laggy car body!

In 3ds Max

I do not recommend this, but you can do it if you really want to.

  1. Duplicate your mesh. Adjust your mesh, without adding or removing any polygons, to create your morph target.
  2. Create a Morpher modifier, and put it above the Edit Poly modifier, and below the Skin modifier (if you're using one).
  3. Pick the duplicate mesh as one of the morphs.
  4. Repeat for all morphs. Yes, it's that tedious. I hate 3ds Max.

Morphing tips

  • Look carefully for any strange deformations in panels when moving your bones. It's very important that panels remain as smooth as possible when deforming, as reflections will very obviously show any kinks. The above example of the windscreen is a great example of a morph that deforms the overall shape of the body too much (look at how the top of the windshield becomes a curve and then eventually a kink—this is bad). If I had the time, I'd go back and fix that one... 😉
  • Test out what happens if you move two nearby bones at the same time. Sometimes, two bones' movement combined can cause strange polygon overlaps, though this can often be avoided with careful skinning and a smooth falloff of weights between the two bones.
  • Don't try and make too many different skinned areas. 10 or 12 is a sensible maximum, and try and avoid more than one bone affecting the exact same area (some overlap is okay though), as this may make them hard to select in-game.
  • Sometimes you'll have to make changes to the mesh to make your car deform nicely in an area. Poly flow is very important for good deformation.
  • Don't forget that any weighting you give a vertex to a bone will be taken from another bone to keep a total weight of 1. This can get very confusing and cause you to chase your own tail a bit. You have been warned! This isn't so much an issue in Blender (since vertex groups can be locked), but in 3ds Max, ohhhh boy I almost tore my hair out on more than one occasion.

UV Unwrapping

If you're planning to do a pelt unwrap as described here, please swap this unwrap step with the mirroring step, and perform your mesh mirroring first. If you plan to use the 3ds Max script for unwrapping, please perform this step first and then move on to mirroring.

Unwrapping fundamentals

UV unwrapping is the process of unfolding the mesh onto a flat 2d plane that describes which part of a texture is applied to which part of a mesh. Think of it like taking a completed papercraft model of a car and unfolding it back to a flat sheet. In most games, UV mapping is important for how the actual visible textures on objects appear, but in Automation, it's mostly important for how the fixture system works. When you place certain fixtures (such as lights, a grille, or door handles) onto the car, it projects a fixture-shaped hole onto the alpha (transparency) channel of the car body.

For the holes to be projected correctly, you must unwrap the car as one complete piece, without any separate islands of polygons. Otherwise, fixtures can project across multiple parts of the car and give you holes in unwanted places. The UV unwrap must also give a fairly even amount of texture space to each area of the car, as any low-resolution areas will cause jagged holes around the outside of fixtures; this is called "tearing".

It is for all of these reasons that the unwrap of a car mod has to be what's called a "pelt" unwrap (named for its resemblance to a flat animal pelt). For Automation cars, it looks like this:

Unwrapping a car with a pelt unwrap

Make sure your car is one element

This part is important, as it defines how the pelt unwrap works, which in turn determines how the fixture system cuts holes in the car. If parts of the car are not connected in both the 3D viewport and the UV viewport, the fixture will cut out an incorrect hole.

This only applies to the car itself, not to the bounds boxes. The bounds boxes do not need to be correctly unwrapped, as they are invisible and do not contribute to the fixture stamping. Any lip placement areas, however, must still be properly unwrapped despite the material being invisible; otherwise, tearing across the body can occur.

In 3ds Max, enter the Edit Poly modifier and click Element mode. Select one face of the car, and hide unselected faces. In Blender, select one face of the car and press Ctrl+L to select linked faces, and Shift+H to hide unselected faces.

Doing the pelt unwrap

However it's done in your choice of 3D application, perform a pelt unwrap on your car. In Blender, it looks like this:

Pelt unwrap step 1.png

Next we need to orient the unwrap so that the centre of the car in the UV sits on the centre-line of the Y axis, and scale the unwrap up so that it covers as much of the UV space as possible:

It is vital that the top and bottom halves of the unwrap here are perfectly symmetrical, and that the centre line of the car is perfectly straight along the middle.

Make sure this unwrap exists on both the first and second UV channels. The first channel will be used to calculate the normals, and the second channel will be used to calculate the fixture cutouts.

Unwrapping a car with the 3ds Max unwrap script

From the Car Body Export Helper utility (located on the Utilities tab, with the hammer icon, in the top right of 3ds Max), press the "Unwrap Car Body" button. If you don't see this menu, go to utilities, then click on MAXScript, which will bring up the Car Body Export Helper option; then, click on the name.

3DS-Max-Car-Unwrap-Script 01.gif

The UV unwrap should now be complete, and with the UVTESTING map applied, the result should look something like this:

Checker.jpg

Note for finished bodies made via the 3ds Max script

If you've finished your body and have it running in game, and it looks like this whenever you add fixtures...

WeirdFixtures.png

...then the UV maps are broken. You need to follow the steps below to fix the UV maps.

Start off with your un-mirrored, but complete body.

WeirdStep1.png

Apply the UV Test material and unwrap your body (which at this point is only half) with the Car Body Export Helper Tool.

WeirdStep3.png

Add the Unwrap UVW modifier. Under the Channel panel, navigate to the Map Channel box and change the "1" to "2".

There should be a pop up. Click Move.

WeirdStep4.png

Now move your Unwrap UVW modifier so that it sits below the Skin modifier.

WeirdStep5.png

Select your car object and mirror it using the Car Body Export Helper Tool. After mirroring you will notice that your Unwrap UVW modifier has disappeared.

In conclusion: unwrap the body and apply the Unwrap UVW modifier. Change the Map Channel to "2" and then click Move, after which you will move the Unwrap UVW modifier below the Skin modifier.

You can now follow the export steps to re-export!

Mirror the Half Body

The traditional method

A mirrored mesh before mirroring the unwrap.
A mirrored mesh after mirroring the unwrap.
  1. Mirror your mesh.
  2. If you've already unwrapped your mesh without mirroring the UV maps via modifier setitngs, select the mirrored half, and flip the UV of that half along the Y axis:
  3. Duplicate the bones for the wheel flares on the opposite side, matching the distance from the centreline. Set the name of the mirrored half to the same as the un-mirrored half with "_opposite" at the end of the name of the bone. Duplicate the bone weighting from the non-mirrored half, rename it to match the mirrored bone, and clear the weighting for each on the opposing side so that the weighting for each wheel flare only includes the respective wheel:

Mirror weighting.png

Mirror weights values.png

Mirror weights 2.png

If you're using the optional 3ds Max script

Mirroring is simple; from the Car Body Export Tools utility, just press "Mirror Car Body". This will mirror the mesh, mirror the UV unwrap, and duplicate the required bones.

3DS-Max-Car-Unwrap-Script 02.gif

Fix Everything You Just Broke Mirroring the Body

If you're using the 3ds Max script

Check wheel arch bones have their opposite counterparts created

Wheel arch bones require an opposite bone. This is to allow the game to morph the wheel arch on the other side of the body to the same length, but in an opposite direction to that which you have moved. (The same applies to any other bone that moves along the X axis, e.g. a running board morph).

When the mirror script is run, it determines which bones require an opposite by checking all the vertices on the zero X axis for each bone. If none of these vertices have a weight value, the script will create an opposite bone.

If, after running the script, your double-sided body does not have the expected opposite bones, then you will need to go back to your original half body and check that none of the vertices for that bone on the zero X Axis has any weight applied to it. Remember that zero weighted bones still count as having a value, and you should use the Remove Zero Weights button to remove these.

Selecting all centre vertices.

One method to check for weights on the zero X axis is as follows:

The weight table.
  1. Ensure that all vertices of your mesh are visible.
  2. Select all the vertices along the zero X axis.
  3. Open the weight table (found in the weight properties rollout).
  4. Set the weight table view to selected vertices.
  5. Scroll down the list of weight for the bones in question. Any weighted verts should be easy to spot, as there should not be any. These can be zeroed by right clicking the weight value. (You may want to make note of any weight values for other bones (excluding the root bone) on that vertex, as these may alter as a result of the above and you will want to correct them.
  6. Once all erroneous weights have been zeroed, use the Remove Zero Weights button.

These steps should ensure your opposite bone is created when the mirror script is run again.

Ensure other bones do not have opposite bones when not required

In some cases, your body may have bones that are purposely designed to morph vertices on the outside of the body that are not intended to move along the X axis (e.g. The "Hofmeister kink" found on the 10sSedan02 series of bodies). The mirror script may create an unwanted opposite bone for these.

This can be avoided by temporarily weighting a vertex on the zero X axis to the bone in question. Ideally, pick a vertex that is weighted only to the root bone so as not disturb the weights of other bones. Once the mirror script has been run, you can remove the temporary weight applied to that vertex.

Check that both halves of the body are welded together

The mirror body script should weld both halves of your body together, but for reasons (3ds Max is spaghetti), this does not always occur. This can be seen by your body having an unexpected crease or seam down the centre.

Once you have welded the two halves together, perform a visual check to ensure that no unintentional welds have taken place. e.g. top and bottom vertices on a window frames. If this happens, undo your weld command and select the centreline vertices in smaller chunks, and avoid selecting the vertices in question at the same time.

Check skin for distortion along the centreline vertices

When two skinned vertices are welded together, either automatically via the script or manually, 3ds Max will attempt to combine the weights of both the old vertices into one. Unfortunately, it's not very good at it, and many of the welded vertices on the centreline end up with odd weights. This results in a distorted skin (see below). This isn't an issue with Blender.

Distorted Skin.png

To correct the distortion, you will need to check and correct the centreline vertices. The most methodical way is to start from one end of the body and work your way to the other end as follows:

  1. Expand the skin modifier and select Envelope.
  2. Open the weight table and set to selected vertices.
  3. Select the central 3 vertices at one end of the body and view the weight values in the table.
  4. Where the mesh is distorted, you will usually see one vertex in the weight table that's the odd one out.
  5. Amend the values of this vertex to match those on either side of it. (For vertices with more than 2 bones, you may need to untick normalize to stop Max from altering your amendments—remember to re-enable it once completed).
  6. Repeat the above steps, working along the body until you reach the other end.

Check that the same UV maps exist on the first two UV channels

In 3ds Max

To Check the maps:

  1. Under the utilities tab click on the More... button.
  2. Select "Channel Info" from the list and click OK.
  3. Click the newly available Channel Info Button and review the channel info.

Channel inf.png

The bottom 3 lines of the above screenshot represent the 3 UVW maps. In this case, the maps are identical, as they should be. If, however, there is a mismatch between the three maps (from either null data or different numbers of vertices), they will need to be be corrected. If your body does not have 3 maps, see here.

In most cases, 1:map is the correct one. One method of correcting the maps is as follows:

  1. In the Channel Info box, select the line representing the correct map.
  2. Select Copy.
  3. Select one of the incorrect lines.
  4. Select Paste.
  5. Repeat for the other map if it's also incorrect.
  6. Close the channel info box and click on the modifier stack tab.
  7. Move the UVW Mapping Paste modifier(s) to between the skin and the mesh.
  8. Collapse the modifiers into the mesh.

In Blender

Open the Object Data menu and select the UV Maps submenu. Open a UV editor and check that the UVs look correct in the first two UV channels.

Uvs still there.png

If one of these is not correct, delete it and simply duplicate the correct one.

Export Car Body to .FBX File

In 3ds Max

This step is easy!

1: Select the car body, then go to File > Export > Export Selected

2: Save the FBX file somewhere. It won't actually be distributed with the mod when complete, but name it well, and put it somewhere in a properly named folder, where it'll never need to be moved or renamed. If you move it, UE4 will get confused if you try and reimport it, which you'll need to do if everything isn't perfect, and nothing is ever perfect.

3: Make sure your export settings look like this image:

Occasionally, you may get warnings on exporting the .FBX that the matrials are not compatible with the chosen format and objects may appear grey. This warning can be ignored, as we use our own materials.

In Blender

  1. Select the armature, and then the mesh, and then go to File > Export > FBX.
  2. Save the FBX file somewhere. It won't actually be distributed with the mod when complete, but name it well, and put it somewhere in a properly named folder, where it'll never need to be moved or renamed. If you move it, UE4 will get confused if you try and reimport it, which you'll need to do if everything isn't perfect, and nothing is ever perfect. Make sure your export settings match like so:

The animation tab doesn't matter, as we don't use animations. You are now ready to import your body to Unreal Engine!

Import Car Body to Unreal Engine

Now it's time to bring all your hard work into Unreal Engine.

Follow the Modding page for installing and opening the Automation Modding SDK.

If you've never used Unreal Engine before, now is a great time to watch this introduction to UE4 playlist from Epic. It's for a fairly old version, but most of it still applies.

Creating your Car Body Mod

Press the Create Mod button in the top bar of the UE4 Editor.

UE4ModCreation 01.gif

Select the Blank Project, and fill the wizard out with all of your details, such as your name and a short description of the mod you're making. Then, click Create Mod to generate your plugin files.

UE4ModCreation 02.gif

The Content Browser window should now show your plugin content. This is where you'll put all of your mod files. Never modify any files outside of your plugin file. you can copy materials and such from the main content folder, but only if those files are copied to your mod folder. The end result of your mod should be a default content folder that is identical to the default state of the SDK, and all of your own modified files are within the one plugin folder you want to release.

UE4ModCreation 03.gif

You should now have an empty content folder:

UE4ModCreation 04.gif

Importing your car body to the mod folder

Press the Import button in the Content Browser with your mod content folder selected to import your car body FBX file.

UE4ModCreation 05.gif

In the following pop-up import options, make sure the following settings are exactly as described:

UE4ModCreation 06.gif

  1. Skeletal Mesh should be set to True
  2. Import Mesh should be set to True
  3. Skeleton should be set to None
  4. Import Meshes in Bone Hierarchy should be set to False
  5. Import Morph Targets should be set to True
  6. Normal Import Method should be set to Import Normals and Tangents
  7. Material Search Location should be set to All Assets
  8. Material Import Method should be set to Do Not Create Material

Once you have configured the import dialog correctly, press Import, or if you are importing multiple car bodies, press Import All.

You should now have a Skeletal Mesh (pink icon), a Physics Asset (yellow/brownish icon), and a Skeleton (light blue icon) in your mod content folder:

UE4ModCreation 07.gif

Check the Materials

The materials applied to the car body denote what part of the car that is. They aren't so much placeholder materials as they are identifier materials; the materials that are applied to the car determine the category of paint on that material slot in-game.

Double click on the Skeletal Mesh for your car. You should then see a screen like this:

UE4ModCreation 09.gif

If instead, when you import a car, you see something more like this, then you will have to apply your materials manually:

UE4ModCreation 08.gif

The materials to apply to the correct slots on your car body are located in Content/Cars/Meshes/Bodies.

Descriptions of the materials to apply are found in the Car Body Material Options step.

Set Car & Chassis Data

Create car body variant data

This is the file that will contain all the stats about your car; how many seats it can hold, how many doors it has, what the wheelbase is, etc..

Create a Body Variant Preview Data object in your mod folder from the Add New menu.

UE4ModCreation 11.gif

Name your Body Variant Preview Data file correctly. The name of this file will determine the name of the body in-game.

UE4ModCreation 12.gif

Open the Body Variant Preview Data file. In the top field, drag and drop, or use the arrow button, to put your skeletal mesh file into the Skeletal Mesh data field.

UE4ModCreation 19.gif

The data inside the Body Variant Preview Data file determines the stats of your car design. The data is set within the file, but updates in real-time in the body edit scene, which you should open first. Opening the body edit scene and loading your car will help you visualise what all the data in this file translates to in-game.

Loading a Car For Editing

Open the ThumbnailGeneratorLevel_Car level.

UE4ModCreation 13.gif

On the top bar, select the drop-down menu next to the Play button, and select Simulate.

UE4ModCreation 15.gif

This will start simulating the "game" (in this case, the thumbnail generator level). It is important that everything you do in this level is done while you are simulating the level.

In the World Outliner, search for the BodyEditSceneBluetility. This utility will be the interface between the level, which will have your car loaded in it, and your Car Body Variant file.

UE4ModCreation 14.gif

In the Details panel of the BodyEditSceneBluetility, you will find buttons and options for loading your car body.

UE4ModCreation 16.gif

The Load Body and Unload Body menu options will do just that—load and unload your body—but you have to specify the body you want to load first, which is done in the Variant Asset menu.

Select your Body Variant file from the content browser, and put it in the Variant Asset list by either dragging and dropping it in to the icon, or by pressing the arrow button next to the icon.

UE4ModCreation 17.gif

Press Load Body, making sure that you are Simulating.

UE4ModCreation 18.gif

You should now see your car loaded into the scene. You can begin to edit the data within the Body Variant file and see it update in real time in the scene, which is really helpful for setting chassis data.

Annotation 2020-03-16 171445.png

What all the Body Variant settings mean

Mesh

  • Skeletal Mesh is the physical mesh of your body.
  • Car Material Settings are the default materials that should be applied to your body when a player loads it in-game.
  • Mesh Data is a generated file that you dont need to worry about. We'll make one of these in the thumbnail generation stage.
  • Bone Constraints are the physical limits of where bone morphs can be affected. This is an advanced menu for if you want to enter these manually. For most poeple, we have an easy system for assigning these bone limits in the bone limit setting stage. If a bone does not have limits, the player will be able to drag the bones around in any direction they want, as far as they want, and this almost never ends well. Note that morph targets don't need to have their limits set.

UID

  • Family GUID is an unique identifier that is shared between all variants of the same body family. If you are making more than one car body in the same family, they should all share the same family GUID.
  • Variant GUID is an unique identifier that is unique for this body. Every body in Automation needs to have an unique GUID. If you, by chance, happen to generate or use the same Variant GUID as another body, when you try and select one the game may instead chose the other for you. If this happens, generate a new Variant GUID.

Preview

Settings

  • Variant Body Type determines the category of the body in-game. Different categories have different advantages and disadvantages.
  • Year is the year that this body unlocks in Campaign. Bodies that are closer to the current year (and thus more recent) score better in some categories.
  • Doors determines the number of doors on this body, which affects some demographics' statistics.
  • Maximum Seat Rows determines the maximum number of seat rows your body can have. This affects some demographics' statistics.
  • Is Release Ready is a dev feature we use to allow us to configure and adjust bodies that are not ready to be in-game. If this box is unticked, you will not be able to see it in-game.
  • Seat Options is a legacy option that is no longer used.
  • Front Suspension To Disable will disable those suspension options for this body. This is useful if your body is shaped such that certain suspension types clip through the body, and you cannot solve it elsewhere.
  • Rear Suspension To Disable will disable those suspension options for this body. This is useful if your body is shaped such that certain suspension types clip through the body, and you cannot solve it elsewhere.
  • Is Softtop Convert will set this body as a convertible with a soft top. This is for demographic calculations.
  • Is Hardtop Convert will set this body as a convertible with a hard top. This is for demographic calculations.
  • Cargo Subtracts will subtract the cargo volume from the cabin space in vehicles with a shared passenger and cargo area (wagons, MPVs, and such). This is useful for making cars where the more seat rows a body has, the less cargo space it has.

Engine

  • Engine Placement is an array containing all the available engine positions for this body.

Chassis

Footprint
  • Wheelbase is the wheelbase of the body in centimetres. Set this before setting anything else for best results.
  • Track Width is supposedly track width in centimetres, but isn't actually measured accurately. Don't try and match it to real figures; just make sure the wheels sit correctly in the mesh (with correct tyres) and that there is enough room left in the wheel arches to make the tyres as wide as makes sense for the car (which might include having to use arch flare morphs). If you need room for wider tyres, set this a little narrower.
  • Y Offset is used to shuffle the mesh back and forwards to sit correctly in the middle of the chassis. If you're putting big numbers in here (more than 15, perhaps), you probably need to recentre your mesh.
Vertical Position
  • Default Suspension Height is used to set the default position of the ride height slider. Makes sure that supercars start off set low, SUVs start high, etc.
  • Height Offset moves the car model up and down as compared to the chassis/wheels etc. This should usually be set so that with appropriate sized tyres, and Default Suspension Height set to 0, the wheels are nearly touching the top of the arches. Some cars might want to be set a bit higher (SUVs and the like), but remember that when a car is set to a ride height of 0, it has very little suspension travel, so you should be setting height offset on the basis of the lowest the car could possibly ever sit.
Front
  • Firewall Y is a 0-100 setting of how far forward the firewall is. Easiest to set in side view in Wireframe mode. Set to match your mesh's firewall. Important for engine bay size.
  • Nose Length is used to set how far forward the engine bay goes. Important for engine bay size. Make sure the chassis doesn't stick out of the car, even when you've moved morphs around on the nose.
  • Cab Over is a tick box to say whether the engine goes under the front seats of your car body. Affects some statistics. Used for vans, etc.
Rear
  • Rear Wall Y is the firewall position for rear/mid engine cars. Ignore this value for front-engine-only cars.
  • Tail Length is how far the back of the chassis goes. Important for rear engine bay size, but not very important for front-engine cars. Be careful that it doesn't stick out of the car.

Wheels

  • Max Wheel Diameter is the maximum wheel & tyre diameter in centimetres. Set this by adjusting the default tyre size to work out what the biggest practical tyre size would be, then putting that number here.
  • Min Wheel Diameter is the minimum wheel & tyre diameter in centimetres. Set this by adjusting the default tyre size to work out what the smallest practical tyre size would be, then putting that number here.
  • Default Wheel Diameter sets what tyre diameter is loaded on the car by default. Set it to something within reason for the car type.
  • Default Rim Diameter sets what rim diameter is loaded on the car by default. Set it to something within reason for the car type. Remember to set it correctly for a tyre profile that makes sense for the type and age of the car. Older cars need high-ish-profile tyres, due to in-game restrictions on using low-profile tyres in early eras.
  • Default Wheel Width sets what tyre width is loaded on the car by default. Set it to something within reason for the car type.

Aero

Path (Legacy Class)

  • This is a legacy option for older bodies. You shouldn't need to touch anything in here unless you are converting a pre-UE4.24 mod.

Body Boxes

  • This contains all the sizes and positions of the body boxes, and are generated automatically in the thumbnail generation stage.

A note on convertibles

Convertibles should have their body tag set to the type of body they are aside from being convertibles, and to set the 'soft top' or 'hard top' convertible values separately. The 'convertible' body type is no longer used.

Set Bone Limits

Once you've set all the other car body settings, you'll need to set the limits for bone movement.

While simulating in the car body scene, make sure your car is loaded and select it.

Annotation 2020-03-17 155800.png

You should now see a set of blue squares at the locations of your bones as you set them in your modelling program. Click on one of these blue squares, and start to move it along an axis to see how it affects the body. You can set the current position of the bone as the new limit of that bone by right clicking on it and selecting "Add to limits".

UE4ModCreation 20.gif

Right-click on a bone and select "Move all bones to bind pose" to move the bones back to their default location.

Note that if you accidently set a bone's limits too far, there are two ways to fix it: you can either right-click "Reset Limits" and then set the limit again, or (if you know what you're doing) type a new limit into the appropriate axis of the corresponding bone in the Bone Constraints array.

The following other options on right-clicking a bone are as follows:

  • "Move all bones to max" will move a bone as far as possible in the positive axes it can move.
  • "Move all bones to min" will move a bone as far as possible in the negative axes it can move.
  • "Reset limits" will remove all limits from a selected bone.
  • "Move all bones to bind pose" will move all bones back to their default positions.

Bones that appear red are bones that exist as part of the skeleton but aren't weighted to any vertices on the car.

Generate Thumbnails

While simulating, load your car body.

In the Body Edit Scene Bluetility, click Generate Thumbnail.

UE4ModCreation 21.gif

You should now have two more files in your mod content folder, but don't let their lack of an "unsaved" asterisk icon fool you: these files do indeed need to be saved. Right-click the files and save them manually; otherwise, they will indeed stop existing.

UE4ModCreation 23.gif

You are now done creating all the files and settings you need! You can now export your mod body.

For additional body variants

For additional variants, repeat the same process for each CPP. If you copied the CPP from one variant and edited it for a new one, this will replace the original thumbnail. To avoid this problem, clear the thumbnail (and mesh data) from "Variant Preview Texture" on each additional variant before generating their thumbnails.

Export Your Car Body

  1. In Unreal Editor, at the top toolbar, select "Share Mod" and then click on the name of your car body.
  2. Select a path where there are no spaces in the file path. As an example, C:\Users\Name\Documents\Unreal Projects\AutomationGame will not work, since the phrase Unreal Projects contains a space. C:\Users\Name\Documents\ModExport will work, because there are no spaces in the file path.
  3. Once your build is successful, you need to launch the "Automation - The Car Company Tycoon Game Workshop Tool" from your "Tools", which can be accessed by hovering over "Library" in Steam.
  4. Enjoy your new car body!

FAQ

Q: I get a Max Script error running the script to unwrap my body like so:

Maxscript Err Unwrap.png

A: Car bodies in UE use 3 UVW maps and your mesh currently has less. To ensure you have enough maps, take the following steps.

Q: I get a Max Script error running the script to mirror my body like so:

Vertex index error.png

A: Save the body file as is, close 3ds Max, and then reopen the file. This fixes most instances of this error.

Q: Unreal won't open the SDK project files.

A: Make sure you're running the correct version of Unreal Editor. It should be version 4.24.3.

Q: I got my body in the game, but it looks weird whenever I apply fixtures.

A: Refer back to the UV unwrapping section, where this problem is addressed.