Export Material User Data

From Automation Game Wiki

The Export Material User Data is a translation layer for the Exporter. The exporter doesn't have access to the raw HLSL of the material in UE4, nor do most games or applications have a shader path that allows use of custom shaders. BeamNG.Drive, for example, has a static shader path, and as such, it is a constant struggle to get Automation's paints and materials to export nicely.

The Export Material User Data (or EMUD) contains the logic that the exporter can use for adjusting textures and the UVs of the exported meshes, in order to get a close approximation of Automation's materials, for use in other rendering engines.

The layout and structure of the EMUD must be kept in mind at all times during the creation of a Custom Paint or fixture material, as there are certain limitations that cannot be overcome.

The EMUD can create new static (non-moving) UVs in one of two flavours; it can scale the existing UVs, or it can create a new box-unwrapped UV set. The EMUD can also create and edit static textures for the following material channels: Diffuse, Roughness, Metallic, Specular, Normal, and Opacity.

Because the workflows for the different textures are similar but entirely separate, The documentation for each texture is thusly separated.

Add an Export Material User Data parameter to Your Material

From the Details panel of the material, under the Material category, expand the parameters, and add, from the Asset User Data array, an Export Material User Data:

ExportParameters AddExportUserData.jpg

Diffuse Parameter Info

The Diffuse EMUD is the only mandatory export parameter. All other parameters have defaults, but a material without a diffuse parameter set in the EMUD will not export correctly or at all.

The diffuse parameters inside the EMUD are capable of a number of dynamic options. You can set it up to use a texture as diffuse, or a texture as a mask between two colours, or a diffuse texture with a single colour overlaid via a mask, or a series of colours blended together via a slider or texture.

The diffuse parameters are split up into several sections that can be used or ignored as required. They are as such:

ExportParameters DiffuseParameters.jpg

The Colour Secondary Param is only necessary if you are doing a two-tone colour gradient using a texture as the alpha. That will be explained later.

At least one parameter within either the Colour Parameters, or the Diffuse Texture Param, is necessary. All else is optional, or adds on top of these parameters.

The categories within the Diffuse parameter info act as a lerp. The Colour Param and Diffuse Texture Param categories, along with the Diffuse Texture to Colour Lerp all combined are the A input for the lerp. The Colour Secondary Param is the B input, and the Colour Secondary Mask Param is the Alpha input of the lerp.

Within the A input of the lerp, there exists a second lerp. The Diffuse Texture To Colour Lerp is the alpha input, and it must be a scalar. The colour Param is the A input, and the Diffuse Texture Param is the B input. The Diffuse Texture Param uses a Texture Parameter Data.

If the Diffuse Texture To Colour Lerp is left as none, the lerp is disabled and the system tries to use the diffuse Texture Param. If this is also left as none, then the system will use the Colour Param sub-category. The colour Param sub-category uses a Combined Parameter Data input.

Within the B input of the lerp, there exists only the Colour Secondary Param sub-category. It uses a Combined Parameter Data input. If the Colour Secondary Param sub-category is left as none, the lerp is disabled and the Colour Secondary Param and Colour Secondary Mask Param categories are not used.

Within the Alpha input of the lerp, there exists the Colour Secondary Mask Param. It uses a Texture Parameter Data. If it is left as none, the lerp is disabled and the Colour Secondary Param and Colour Secondary Mask Param categories are not used.

Roughness Param

This group of parameters controls the roughness of the material. It has two categories, the Combined Parameter Data, and the Texture Parameter Data. If the Texture Parameter Data is left as default, it will use the Combined Parameter Data. If both categories are left as default, it will use the default roughness value of 0.5.

Metallic Param

This group of parameters controls the Metallic of the material. It has two categories, the Combined Parameter Data, and the Texture Parameter Data. If the Texture Parameter Data is left as default, it will use the Combined Parameter Data. If both categories are left as default, it will use the default Metallic value of 0.

Specular Param

This group of parameters controls the Specular of the material. It has two categories, the Combined Parameter Data, and the Texture Parameter Data. If the Texture Parameter Data is left as default, it will use the Combined Parameter Data. If both categories are left as default, it will use the default Specular value of 0.5.

Normals Param

This group of parameters controls the Normals of the material. It has two categories, the Combined Parameter Data, and the Texture Parameter Data. If the Texture Parameter Data is left as default, it will use the default Normals value of 0.5. If the Combined Parameter Data value is populated, the Normal texture will have its strength be adjusted by the value of the Combined Parameter Data.

Combined Parameter Data

This data allows for a group of parameters to be combined into one for export.

Override

If set to true, the above parameter names will be ignored in favour of the given override value.

Value Override

If Override is true, this value will be used for the parameter instead of the named material parameter.

Param Name

The main parameter for the value. If Param Name 2 is empty, this will be the only parameter used and its value will be exported as is.

Param Name 2

The second parameter for the value. Many Automation materials blend between colours or other values via a noise/bump map or via some other user or child driven value. Because BeamNG needs a single value, we need to do the blending once for the whole material.

Param Name Lerp

This parameter, if named, controls the blending between the values of Param Name and Param Name 2. If Param Name 2 is empty, this value has no effect. If this value is empty but Param Name 2 is not, the two values will be averaged.

Param Name Lerp Power

This parameter, if named, controls the strength of the Param Name Lerp. See Custom Paint Lerp Scalar for it's example usage.

Texture Parameter Data

This data allows the exporter to select a texture parameter, or texture parameter from a list, for export as a single texture.

Param Name

The main parameter for the texture. If the Param Name List is empty, this is the only parameter used and its texture will be used.

Param Name List

If the Param Name Selector is also populated, this list will select a single texture to use based off the value of the Param Name Selector. Many Automation materials allow the player to select a texture using a slider, and this is the list of textures that are picked up for that by the exporter.

Param Name Selector

This scalar parameter value is used to select the texture from the Param Name List. It is only used if the Param Name List is also populated with textures.

Examples

If you have a texture parameter, with no additional modification to it, leave all parameters within the Diffuse parameters list empty, except for the Diffuse Texture Param > Param Name:

ExportParameters DiffuseParameterSet.jpg

If your diffuse value is instead a solid colour, leave all parameters within the diffuse parameters list empty, except for the Colour Param > Param Name:

ExportParameters DiffuseParamName.jpg