Decal Mods

From Automation Game Wiki
Revision as of 18:35, 2 December 2020 by imported>Construc Camshaft (→‎Assign the mesh to the Blueprint)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

Fast Rundown

  • 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

The Assets

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:

Example Decal.jpg

The mesh for this decal looks like this:

Example Decal mesh.jpg

And the texture used for this decal looks like this:

Decal Custom Automation 0000.png

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

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.

Left: source image with anti-aliasing and compression. Center: that same texture alpha-tested in-game. Right: the distance-field alpha testing technique we'll be using here. img src from the linked Valve Siggraph paper by Chris Green

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

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

Create a new file. For this example, I've created an image with 256x256 pixels. Yours can be larger or smaller, it doesn't much matter. All that matters is the image is a power of two (64x64, 512x512, 2048x2048, etc...) 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 size of your decal should be a power of two, and not too high-resolution. We also only need this texture to be greyscale, so set the colour mode to 'greyscale' as well

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:

Decal Custom Automation 0000 01.png

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.

example layers .PSD
Double-Clicking on the Smart Object will open up a temporary .PSB file containing the same files that existed before they were converted to a Smart Object

(If you're not using photoshop, I'm sure there are similar ways to achieve this in your authoring package.)


You can use GIMP too

Here is that example file with the Gaussian blur applied to it:

Decal Custom Automation 0000.png

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

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.

For illustrative purposes only

Creating the Normal Map

Follow the section on creating a normal map in the Badge Fixture Mods page here.

Creating the Decal Mesh

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:

Above: default mesh found in the ExampleMod plugin folder. Below: custom decal texture

And here is an example decal using a custom mesh:

File:Example decal mesh.jpg
Above: Custom Decal Mesh. Below: Custom Decal Texture.

Setting up the Mod 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.

Create a new fixture Mod.

old image is old, but it serves its purpose

You should see a folder that looks somewhat like the following:

Example decal mod folder.jpg

Importing your custom decal files

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

Importing to decal mod.gif

Your mod folder should then look something like this:

For this example decal, I have created a circular custom mesh.

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:

Copying example mesh for decal mod.gif

Setting up the Decal Mod files

Setting up the material

Navigate back to the ExampleDecal mod folder and create a material instance from DefaultDecalMat by right-clicking on it:

Create material instance for decals.jpg

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:

Current decal custom folder 001.jpg

double-click the new material instance to open it, and add your decal textures to the texture material parameters, like below:

Example material parameters texture setup.jpg

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

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 material to mesh decal.gif
Assign the mesh to the Blueprint

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!