Temp-new mod materials: Difference between revisions

From Automation Game Wiki
mNo edit summary
mNo edit summary
Line 1: Line 1:
New material parameters
New material parameters


Car body and fixture mods should in theory export to Beam.NG just like the built in bodies and fixtures. If it works in Automation, then the exporter should be able to deal with it. One exception to this is custom materials.
Car body and fixture mods should in theory export just like the built in bodies and fixtures. If it works in Automation, then the exporter should be able to deal with it. One exception to this is custom materials.
 
=Custom Materials=
=Custom Materials=
When the exporter exports a material, it checks which base material is being used and chooses from a series of built-in handlers based on that. Custom materials that are material instances of existing car/fixture materials should already export properly. Where possible, it’s best to use instances of existing materials rather than create new ones.
When the exporter exports a material, it checks which base material is being used and chooses from a series of built-in handlers based on that. Custom materials that are material instances of existing car/fixture materials should already export properly. Where possible, it’s best to use instances of existing materials rather than create new ones.
==Textures==
==Textures==
Pixel formats (selected in the “Compression settings” dropdown) supported by the exporter:
Pixel formats (selected in the “Compression settings” dropdown) supported by the exporter:
Line 18: Line 22:


= Material Export Parameters =
= Material Export Parameters =
This is the data attached to Automation materials to help the BeamNG exporter know how to interpret these materials in order to build one that works in BeamNG. Developed after all attempts at naming conventions failed, it basically defines the naming convention used by the material, as well as storing a few other bits of information that the exporter needs to know about.
This is the data attached to Automation materials to help the exporter know how to interpret these materials in order to build one that works externally. Developed after all attempts at naming conventions failed, it basically defines the naming convention used by the material, as well as storing a few other bits of information that the exporter needs to know about.
 
Many of the parameters use the '''Combined Parameter Data''' and '''Texture Data''' types, which allow a group of parameters to be combined into one for export.


* An exported material defaults to a colour and opacity of #FFFFFFFF. This is a hexadecimal colour of "White, and completely opaque."
Many of the parameters use the [[#Combined Parameter Data|'''Combined Parameter Data''']] and [[#Texture Parameter Data|'''Texture Parameter Data''']] types, which allow a group of parameters to be combined into one for export.
* If a vector or texture parameter is specified in the Colour Param or Diffuse Tex variables within the Export Material User Data, those variables will be used for the colour of the exported material.
* If both are specified, they will be multiplied together.
* The exported opacity is assumed to be 1 (completely opaque) if no Alpha Param is specified. if a Diffuse Tex variable is specified, then the opacity is defined by the alpha channel of the texture. If the texture is single-channel, it is assumed to be an alpha texture as well as a diffuse texture. If a texture is RGB without an alpha, the alpha is unaffected by the diffuse tex.


== To Add ==
== To Add ==
To add export parameters, click the plus icon next to Asset User Data, in the material editor. In the dropdown that appears, select "Export Material User Data".
Export parameters should be added to the base material, not to a material instance. To add export parameters, click the plus icon next to Asset User Data, in the material editor. In the dropdown that appears, select "Export Material User Data".


== Basic Parameters ==
== Basic Parameters ==


=== Material Type ===
=== 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.
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.


Line 40: Line 38:
* '''Decal''' - One of a set series of materials each with custom handling for the diffuse texture. Do not put this type on new materials.
* '''Decal''' - One of a set series of materials each with custom handling for the diffuse texture. Do not put this type on new materials.
* '''Other''' - default behaviour. If in doubt, use this value.
* '''Other''' - default behaviour. If in doubt, use this value.
==Diffuse Colour==


=== Colour Param (Vector Parameters) ===
=== Colour Param (Vector Parameters) ===
This group of parameters controls the diffuse colour of the material. See '''[[Mods and the Beam.NG Exporter#Combined Parameter Data|Combined Parameter Data]]''', below.
This group of parameters controls the diffuse colour of the material. See '''[[#Combined Parameter Data|Combined Parameter Data]]''', below.


=== Diffuse Texture Param (Texture Parameters) ===
This group of parameters controls the diffuse map of the material. See [[#Texture Parameter Data|'''Texture Parameter Data''']], below.


=== Opacity Param (Scalar Parameters) ===
=== DiffuseTextureToColourLerp (Scalar Parameters) ===
This group of parameters controls the opacity of the material. See [[Mods and the Beam.NG Exporter#Combined Parameter Data|'''Combined Parameter Data''']], below.
This group of parameters controls the value for lerping from the given diffuse texture to the diffuse colour of the material. See [[#Combined Parameter Data|'''Combined Parameter Data''']], below.
 
=== ColourSecondaryParam (Vector Parameters) ===
This group of parameters controls the secondary diffuse colour of the material. See [[#Combined Parameter Data|'''Combined Parameter Data''']], below.
 
=== ColourSecondaryMaskParam (Texture Parameters) ===
This group of parameters controls the mask that blends between the primary and secondary colours of the material. See [[#Texture Parameter Data|'''Texture Parameter Data''']], below.


==Mask Values==


=== Roughness Param (Scalar Parameters) ===
=== Roughness Param (Scalar Parameters) ===
This group of parameters controls the roughness of the material. See [[Mods and the Beam.NG Exporter#Combined Parameter Data|'''Combined Parameter Data''']], below.
This group of parameters controls the roughness of the material. See [[#Combined Parameter Data|'''Combined Parameter Data''']], below.
=== Roughness Texture Param (Texture Parameters) ===
=== Roughness Texture Param (Texture Parameters) ===
This group of parameters controls the roughness map of the material. See [[#Texture Parameter Data|'''Texture Parameter Data''']], below.
This group of parameters controls the roughness map of the material. See [[#Texture Parameter Data|'''Texture Parameter Data''']], below.


=== Metallic Param (Scalar Parameters) ===
=== Metallic Param (Scalar Parameters) ===
This group of parameters controls the metallic value of the material. See [[Mods and the Beam.NG Exporter#Combined Parameter Data|'''Combined Parameter Data''']], below.
This group of parameters controls the metallic value of the material. See [[#Combined Parameter Data|'''Combined Parameter Data''']], below.
=== Metallic Texture Param (Texture Parameters) ===
=== Metallic Texture Param (Texture Parameters) ===
This group of parameters controls the metallic map of the material. See [[Mods and the Beam.NG Exporter#Texture Data|'''Texture Data''']], below.
This group of parameters controls the metallic map of the material. See [[#Texture Parameter Data|'''Texture Parameter Data''']], below.


=== Specular Param (Scalar Parameters) ===
=== Specular Param (Scalar Parameters) ===
This group of parameters controls the specular value of the material. See [[Mods and the Beam.NG Exporter#Combined Parameter Data|'''Combined Parameter Data''']], below.
This group of parameters controls the specular value of the material. See [[#Combined Parameter Data|'''Combined Parameter Data''']], below.
=== Specular Texture Param (Texture Parameters) ===
=== Specular Texture Param (Texture Parameters) ===
This group of parameters controls the specular value map of the material. See [[Mods and the Beam.NG Exporter#Texture Data|'''Texture Data''']], below.
This group of parameters controls the specular value map of the material. See [[#Texture Parameter Data|'''Texture Parameter Data''']], below.
 
== Normal Map ==


=== Normal Strength (Scalar Parameters) ===
This group of parameters controls the normal strength of the material. See [[#Combined Parameter Data|'''Combined Parameter Data''']], below.
=== Normal Texture Param (Texture Parameters) ===
This group of parameters controls the normal map of the material. See [[#Texture Parameter Data|'''Texture Parameter Data''']], below.


== Extra Parameters ==
==Opacity==
Materials with no information set here will defaut to an opacity of 1.0 (completely opaque).


=== Opacity Param (Scalar Parameters) ===
This group of parameters controls the opacity of the material. See [[#Combined Parameter Data|'''Combined Parameter Data''']], below.
=== Opacity Texture Param (Texture Parameters) ===
This group of parameters controls the opacity map of the material. See [[#Texture Parameter Data|'''Texture Parameter Data''']], below.
=== Alpha Cutoff Name ===
=== Alpha Cutoff Name ===
This parameter determines the alpha cutoff, or the point where the pixel being rendered gets culled.
This parameter determines the alpha cutoff, or the point where the pixel being rendered gets culled.
=== Stamp Map Has Priority ===
If set to true, the stamp map has priority over other opacity sources when both are present. Defaults to true.


=== Secondary Colour ===
This is a secondary colour parameter. Not currently used.


=== Multi Colour Decal Texture ===
== UVs ==
This parameter identifies the texture for a multicoloured decal.


== Normal Map ==
=== World Space UVs ===
If true, the mesh will be unwrapped according to the world space positions of its vertices.
 
=== Magical Mystery Multiplier ===
All the world space UVs work the same, they said...


=== Bypass Normal Map ===
This value specifies a multiplier to apply to the world space UVs. Depending on what the material is doing, you may need to adjust this value til the export looks right.
If true, this material will not be exported with a normal map.


=== Normal Switch Name ===
=== UV Scale Param (Scalar Parameters) ===
The name of the switch parameter that turns normal mapping on/off for this material.
This group of parameters controls the uniform scaling of the material UVs. See [[#Combined Parameter Data|'''Combined Parameter Data''']], below.


=== Explicit Normal Map ===
=== U Scale Param (Scalar Parameters) ===
Normally, the exporter will pull out all of the textures in a material and use the first one it finds with the normal map pixel type as the material’s normal map. If the material has a 'detail normal' and a 'normal map', or multiple normal maps, the explicit normal map should be set to 'normal map' (or the same name as the variable name of the texture you want to be the normal map).
This group of parameters controls the U (horizontal) scaling of the material UVs. See [[#Combined Parameter Data|'''Combined Parameter Data''']], below.


== UV Tiling ==
This value will be multiplied by that of UV Scale Param.
UV tiling in Automation uses all kinds of projection maths that is not available to us in BeamNG. These parameters are used to help us get something that looks approximately right, though it will likely never be an exact match.


Because BeamNG does not support UV offset and scale, the UV data in the mesh vertices need to be modified for tiled UVs to work.
=== V Scale Param (Scalar Parameters) ===
This group of parameters controls the V (vertical) scaling of the material UVs. See [[#Combined Parameter Data|'''Combined Parameter Data''']], below.


=== UV Tiling ===
This value will be multiplied by that of UV Scale Param.
The name of the parameter that controls UV tiling.


=== V Stretch ===
=== U Offset Param (Scalar Parameters) ===
This parameter controls a scaling multiplier in the Z axis of the object. Only has effect if World Scaled UVs is true.
This group of parameters controls the U (horizontal) offset of the material UVs. See [[#Combined Parameter Data|'''Combined Parameter Data''']], below.


=== World Scaled UVs ===
=== V Offset Param (Scalar Parameters) ===
If true, the UV scale is determined by the size of the mesh.
This group of parameters controls the V (vertical) offset of the material UVs. See [[#Combined Parameter Data|'''Combined Parameter Data''']], below.


=== Uniform Scaled UVs ===
If true, UV scale values are forced to be the same in all 3 axes. Only has effect if World Scaled UVs is true.


=== Force Rescale UVs ===
If true, overrides the meshes UVs to a Z-projected (top-down) version of the vertex position, scaled to 2cm per UV tile.


= Combined Parameter Data =
= Combined Parameter Data =
Line 118: Line 135:


=== Param Name 2 ===
=== 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.
The second parameter for the value.


=== Param Name Lerp (Scalar Parameter) ===
=== Param Name Lerp (Scalar Parameter) ===

Revision as of 16:51, 16 November 2021

New material parameters

Car body and fixture mods should in theory export just like the built in bodies and fixtures. If it works in Automation, then the exporter should be able to deal with it. One exception to this is custom materials.

Custom Materials

When the exporter exports a material, it checks which base material is being used and chooses from a series of built-in handlers based on that. Custom materials that are material instances of existing car/fixture materials should already export properly. Where possible, it’s best to use instances of existing materials rather than create new ones.


Textures

Pixel formats (selected in the “Compression settings” dropdown) supported by the exporter:

  • RGBA8
  • DTX1/BC1
  • DXT3/BC2
  • DXT5/BC3
  • BC4 (Alpha)
  • BC5 (Normal map)

RGBA textures will be saved with DTX5/BC3 compression by the exporter.

For best results on export, make sure the “Global Force Resident Mip Levels” option is ticked on, otherwise the texture may export down-resed, depending on whether or not Unreal feels like loading the full resolution texture at that time.

Material Export Parameters

This is the data attached to Automation materials to help the exporter know how to interpret these materials in order to build one that works externally. Developed after all attempts at naming conventions failed, it basically defines the naming convention used by the material, as well as storing a few other bits of information that the exporter needs to know about.

Many of the parameters use the Combined Parameter Data and Texture Parameter Data types, which allow a group of parameters to be combined into one for export.

To Add

Export parameters should be added to the base material, not to a material instance. To add export parameters, click the plus icon next to Asset User Data, in the material editor. In the dropdown that appears, select "Export Material User Data".

Basic Parameters

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 - A material using a mask to blend between metal and a (usually black) background.
  • Clear Glass - For transparent glass materials.
  • Decal - One of a set series of materials each with custom handling for the diffuse texture. Do not put this type on new materials.
  • Other - default behaviour. If in doubt, use this value.

Diffuse Colour

Colour Param (Vector Parameters)

This group of parameters controls the diffuse colour of the material. See Combined Parameter Data, below.

Diffuse Texture Param (Texture Parameters)

This group of parameters controls the diffuse map of the material. See Texture Parameter Data, below.

DiffuseTextureToColourLerp (Scalar Parameters)

This group of parameters controls the value for lerping from the given diffuse texture to the diffuse colour of the material. See Combined Parameter Data, below.

ColourSecondaryParam (Vector Parameters)

This group of parameters controls the secondary diffuse colour of the material. See Combined Parameter Data, below.

ColourSecondaryMaskParam (Texture Parameters)

This group of parameters controls the mask that blends between the primary and secondary colours of the material. See Texture Parameter Data, below.

Mask Values

Roughness Param (Scalar Parameters)

This group of parameters controls the roughness of the material. See Combined Parameter Data, below.

Roughness Texture Param (Texture Parameters)

This group of parameters controls the roughness map of the material. See Texture Parameter Data, below.

Metallic Param (Scalar Parameters)

This group of parameters controls the metallic value of the material. See Combined Parameter Data, below.

Metallic Texture Param (Texture Parameters)

This group of parameters controls the metallic map of the material. See Texture Parameter Data, below.

Specular Param (Scalar Parameters)

This group of parameters controls the specular value of the material. See Combined Parameter Data, below.

Specular Texture Param (Texture Parameters)

This group of parameters controls the specular value map of the material. See Texture Parameter Data, below.

Normal Map

Normal Strength (Scalar Parameters)

This group of parameters controls the normal strength of the material. See Combined Parameter Data, below.

Normal Texture Param (Texture Parameters)

This group of parameters controls the normal map of the material. See Texture Parameter Data, below.

Opacity

Materials with no information set here will defaut to an opacity of 1.0 (completely opaque).

Opacity Param (Scalar Parameters)

This group of parameters controls the opacity of the material. See Combined Parameter Data, below.

Opacity Texture Param (Texture Parameters)

This group of parameters controls the opacity map of the material. See Texture Parameter Data, below.

Alpha Cutoff Name

This parameter determines the alpha cutoff, or the point where the pixel being rendered gets culled.

Stamp Map Has Priority

If set to true, the stamp map has priority over other opacity sources when both are present. Defaults to true.


UVs

World Space UVs

If true, the mesh will be unwrapped according to the world space positions of its vertices.

Magical Mystery Multiplier

All the world space UVs work the same, they said...

This value specifies a multiplier to apply to the world space UVs. Depending on what the material is doing, you may need to adjust this value til the export looks right.

UV Scale Param (Scalar Parameters)

This group of parameters controls the uniform scaling of the material UVs. See Combined Parameter Data, below.

U Scale Param (Scalar Parameters)

This group of parameters controls the U (horizontal) scaling of the material UVs. See Combined Parameter Data, below.

This value will be multiplied by that of UV Scale Param.

V Scale Param (Scalar Parameters)

This group of parameters controls the V (vertical) scaling of the material UVs. See Combined Parameter Data, below.

This value will be multiplied by that of UV Scale Param.

U Offset Param (Scalar Parameters)

This group of parameters controls the U (horizontal) offset of the material UVs. See Combined Parameter Data, below.

V Offset Param (Scalar Parameters)

This group of parameters controls the V (vertical) offset of the material UVs. See Combined Parameter Data, below.


Combined Parameter Data

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

Unless Override has been set, the final value for the material will be an interpolation between [Name] and [Name2] by [Lerp][Lerp Power].

The Name and Name2 parameters will both either be for scalar or vector parameters.

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.

Param Name Lerp (Scalar Parameter)

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. This defaults to 0.5 if no valid parameter is specified.

Param Name Lerp Power (Scalar Parameter)

This parameter is an exponent applied to the value of the lerp parameter. This defaults to 1.0 if no valid parameter is specified.

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.

Texture Parameter Data

This data allows for the various ways textures are defined for Automation materials.

Param Name (Texture Parameter)

The main parameter for the value.

Param Name List (Texture Parameters)

Some materials select a texture from a list, instead of just defining one.

This list takes priority over Param Name.

Param Name Selector (Scalar Parameter)

This parameter controls the selection from the above list. It has no effect if the list is empty. The value of the parameter should be a normalised (0 - 1) value.

Mask Channel

If the texture being defined is a single-coloured mask, this allows you to specify which channel of the Automation texture is being used as the mask.