Line 82: | Line 82: | ||
== Texture Parameter Data == | == 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. | This data allows the exporter to select a texture parameter, or texture parameter from a list, for export as a single texture. | ||
=== Mask Channel === | |||
This setting is only visible for the greyscale texture outputs (Roughness, Metallic, Specular, Opacity). It is not visible for the Diffuse, or Normal texture parameters. | |||
It controls the channel of the texture that is used for the output texture. If your texture is a greyscale texture, the output channel is not so important, but should be set to the G (Green) channel simply because the textures in Automation are compressed, and this channel contains slightly more bit-depth than other channels and therefore results in a higher-quality output texture. | |||
=== Param Name === | === Param Name === |
Revision as of 21:21, 18 January 2023
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:
Material Type
The type of material. Some materials need special handling by the exporter. The type is used to help determine these. If in doubt as to the correct type, leave it as the default (Other) value.
- Grille - The exporter will create a proper two layered material and generate a blend map. One layer is chrome, the other is black.
- Glass - For transparent glass materials.
- Decal - This is for multicoloured decals. Because these don’t work in a consistent way in Automation, the output is hard-coded for each base material. Don’t use this value for a brand new material as the exporter won’t know what to do with it.
- Badge - This defaults to full metallic and specular values, if those parameters are not specified.
- Other - default behaviour. If in doubt, use this value.
- (removed) - These are older, legacy categories that no longer exist. They default to the Other behaviour.
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:
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.
Opacity Param
This group of parameters controls the Opacity of the material. Along with the normal two categories for the Combined Parameter Data, and the Texture Parameter Data, it also has two additional settings; the Alpha Cutoff Name, and the Stamp Map Has Priority bool.
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 Opacity value of 1
.
The Alpha Cutoff Name controls the value at which the opacity value or texture switches between opaque and transparent. for instance, a standard opacity input for a game renderer is about 0.05
, but some textures in Automation have the alpha cutoff at 0.5
. By specifying a parameter that controls what value is the alpha cutoff, we can better control the opacity texture itself.
The Stamp Map Has Priority bool is set to True
by default, and should not be changed.
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.
Mask Channel
This setting is only visible for the greyscale texture outputs (Roughness, Metallic, Specular, Opacity). It is not visible for the Diffuse, or Normal texture parameters.
It controls the channel of the texture that is used for the output texture. If your texture is a greyscale texture, the output channel is not so important, but should be set to the G (Green) channel simply because the textures in Automation are compressed, and this channel contains slightly more bit-depth than other channels and therefore results in a higher-quality output 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
:
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
: