If you've been reading up on the wiki pages for the other fixture modding tools, you'll quickly find out that the modding tools for creating Decal Fixtures is simply a variation on a Badge Mod.
- 1 Fast Rundown
- 2 How it Works
- 3 Creating Your Custom Badge Texture
- 4 Setting up the Mod Within Unreal Engine 4
Fast Rundown[edit | edit source]
- A Badge Mod is a regular Fixture
- All you need to make your custom badge is an image (everything else is provided in the tools)
- that image gets fed in to a provided material
- that material gets fed in to a provided mesh
- that mesh gets fed in to the Badge Fixture Blueprint
How it Works[edit | edit source]
The Assets[edit | edit source]
Essentially, a Decal Fixture is a flat texture that is overlayed on to the car. We do this by having a mesh that has an alpha-tested texture on it and enough tessellation to avoid intersecting in to the car.
Here is an example Decal Mesh:
The mesh for this decal looks like this:
And the texture used for this decal looks like this:
So we've got a mesh. That mesh is tesselated to allow it to conform to cars nicely. That mesh then has a texture applied to it that cuts it out in to the desired shape. Easy! That's just a Conforming Mesh, right? Yep! But we also do some pretty cool things to the texture to make it nice and crisp for decals without being absurdly large, so read on to learn the things.
Distance Field Alpha Testing[edit | edit source]
If you want to have a read in to the technicalities behind how this works, Valve have a .pdf paper from Siggraph available to read here.
All the decals used in vanilla Automation are some variant of 256x256 pixels, so they aren't particularly high-resolution. Yet, if you have a look at the decals in-game, you'll be hard-pressed to find any jagged edges. We achieve this by using Distance Fields instead of hard edges to define shapes. This has the advantage of scaling a lot better to different sizes, but suffers when it comes to hard corners.
Creating Your Custom Badge Texture[edit | edit source]
I'll be using Photoshop for this example, but it doesn't really matter what tool you use as there are no strange formats or scripts used for making decals.
We'll be creating two textures for this example (one for the shape of the decal, and one for the colours), however it is possible to create a decal with just one texture for the alpha cutout only and generate the colours inside the Unreal material, but this is fairly advanced and will not be covered here.
Creating the alpha cutout texture[edit | edit source]
Create a new file. For this example, I've created an image with 256x256 pixels. It doesn't need to be particularly large, as we'll be using the distance-field alpha blending technique mentioned above to improve the final image quality.
The alpha cutout texture should be a gradient from black-to-white, where white is where the decal would exist, and black is where the decal design does not exist.
Here is an example:
To turn this in to a distance-field texture to take advantage of the fancy alpha-testing, we're going to now apply a Gaussian blur to the image. If you are like me and want to be able to iterate on the design without working destructively, group your layers together in to a group and convert it to a Smart Object. You can then double-click the Smart Object to edit the design as per usual, but with the main file with the (now dynamic) Gaussian blur on it. I find that to get the full effect of this distance field approach to alpha testing can be achieved with as little of 1-2 pixels of Gaussian blur, but I have used values as high as 10 pixels and it still manages to look great. If you're going to be using a separate file for the colours, increasing the gaussian blur amount doesn't help that much, but if you are going to generate the colours from the gradient like I have done with a lot of the vanilla decals then it can be beneficial to have more Gaussian blur.
(If you're not using photoshop, I'm sure there are similar ways to achieve this in your authoring package.)
Here is that example file with the Gaussian blur applied to it:
If your decal is going to be a single solid colour, you may skip the next step and move on to Creating the Decal Mesh
Creating the Colour Texture[edit | edit source]
Because we can't take advantage of the distance field masking effect to improve the clarity of edges when creating our colour texture*, it is best to increase the resolution of the colour texture to something more like 512x512, or 1024x1024.
Other than the increased resolution, there are no special requirements for Decal fixtures.
*There are ways to create a greyscale gradient mask map for the colour texture map and then bind certain colours to certain greyscale values, but I won't be covering how to do that any time soon. If you want to have a go at using something like this, I made a forum post over on the Unreal Engine forums a long time ago that might be of use.
Creating the Normal Map[edit | edit source]
Follow the section on creating a normal map in the Badge Fixture Mods page here.
Creating the Decal Mesh[edit | edit source]
To make things easier, there are a few example meshes in the ExampleDecal mod plugin that you can copy over to your mod plugin folder. To do so, navigate to the ExampleMod plugin Content folder, and copy one of the meshes there to your mod plugin folder. If you want to use one of these default shapes, I will explain how to do that later, in the section: Setting up the Mod Within Unreal Engine 4.
Some decal designs, especially ones that are meant to be quite large, may need a tighter mesh around the decal texture. If you wish to go this route, you will want to create a custom shape. To do so, follow the section on Creating a Conforming Mesh in the Fixture Mods page, here, making sure that the Mesh has enough edge loops and that the UVs match the mesh (a default Planar map will do fine).
Here is an example decal using a default mesh:
And here is an example decal using a custom mesh:
Setting up the Mod 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.
Create a new fixture Mod.[edit | edit source]
You should see a folder that looks somewhat like the following:
Importing your custom decal files[edit | edit source]
Import the textures (and meshes, if you have made them - if you have not, we will go through copying one of the default meshes soon) in to your mod folder
Your mod folder should then look something like this:
If you have not created a custom mesh for your decal, navigate to the Example Decal Mod Content folder, and copy the most relevant mesh to your decal mod content folder, like so:
Setting up the Decal Mod files[edit | edit source]
Setting up the material[edit | edit source]
Navigate back to the ExampleDecal mod folder and create a material instance from DefaultDecalMat by right-clicking on it:
Then move that material instance to your decal mod folder via the same method as copying one of the example meshes in the previous step.
You should now see something like the following in your mod folder:
double-click the new material instance to open it, and add your decal textures to the texture material parameters, like below:
If the decal appears to be skinnier or thicker than you would like, adjust the Decal Cutoff Threshold parameter until it looks good.
Assign the material to the mesh[edit | edit source]
Double-click the mesh you created in the previous steps to open it, and add the material instance you just edited to the material slot on the mesh:
Assign the mesh to the Blueprint[edit | edit source]
Follow the Fixture Mods page on assigning the settings in the fixture blueprint here, with the mesh for your decal mod being a Conforming Mesh.
Creating the Thumbnail Files for your Decal
Follow the Fixture Mods page on creating the thumbnail files here.
And that should be all you need to create a custom decal!