Difference between revisions of "Documentation/Engine/Units/accessory paint job data"

From SCS Modding Wiki
Jump to navigation Jump to search
(Still work in progress. Brief writeup for colormask mode.)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The '''accessory_paint_job_data''' unit is used to define paint jobs for trucks and trailers (as of ETS2 [[Games/ETS2/Modding_guides/1.25|1.25]]/ATS 1.4).
+
The '''accessory_paint_job_data''' unit class is used to define paint jobs for trucks and trailers (as of ETS2 [[Games/ETS2/Modding_guides/1.25|1.25]]/ATS 1.4).
  
 
== Usage ==
 
== Usage ==
Line 7: Line 7:
 
=== Colormask ===
 
=== Colormask ===
 
In the colormask mode, each of '''paint_job_mask''''s color channels (RGB) acts as a mask for a color being blended over the base texture. They are applied in the order ''blue'', ''green'', and ''red''. So the red channel has the highest “priority”, followed by green and then blue.
 
In the colormask mode, each of '''paint_job_mask''''s color channels (RGB) acts as a mask for a color being blended over the base texture. They are applied in the order ''blue'', ''green'', and ''red''. So the red channel has the highest “priority”, followed by green and then blue.
{{Tip|Texture compression can lead to some minor aliasing at sharp boundaries between the mask channels. To avoid colors ‘bleeding through’ at these boundaries, try blending some of the lower-priority channel ‘under’ the higher-priority channel along their shared boundary. For example, at a sharp boundary between the ''red'' (255, 0, 0) and ''green'' (0, 255, 0) channels, a thin line of the base color may be visible. This can be mitigated by coloring the edge of the }}
+
{{Tip|Texture compression can lead to some minor aliasing at sharp boundaries between the mask channels. To avoid colors ‘bleeding through’ at these boundaries, try blending some of the lower-priority channel ‘under’ the higher-priority channel along their shared boundary. For example, at a sharp boundary between the ''red'' (255, 0, 0) and ''green'' (0, 255, 0) channels, a thin line of the base color may be visible. This can be mitigated by extending the edge of the lower-priority mask ‘under’ the higher-priority mask. So in the case where there is a sharp line between the red mask and the green mask, the green mask should be extended slightly into the area of the red mask. The resultant color looking at the RGB image would be yellow (255, 255, 0).}}
 +
<!-- Section hidden until completion
 
=== Flipflake ===
 
=== Flipflake ===
 +
 +
-->
  
 
== Attributes ==
 
== Attributes ==
Line 15: Line 18:
 
!Name
 
!Name
 
![[Documentation/Engine/Units#Attribute_types|Type]]
 
![[Documentation/Engine/Units#Attribute_types|Type]]
!Required/Optional
+
!Default Value
 
!Modes
 
!Modes
 
!Description
 
!Description
Line 21: Line 24:
 
|mask_r_color
 
|mask_r_color
 
|rowspan="3"|float3
 
|rowspan="3"|float3
|rowspan="3"|optional
+
|(1, 0, 0)
 
|rowspan="3"|colormask
 
|rowspan="3"|colormask
 
|rowspan="3"|Defines the default color applied to each channel of the color mask.
 
|rowspan="3"|Defines the default color applied to each channel of the color mask.
 
|-
 
|-
 
|mask_g_color
 
|mask_g_color
 +
|(0, 1, 0)
 
|-
 
|-
 
|mask_b_color
 
|mask_b_color
 +
|(0, 0, 1)
 
|-
 
|-
 
|base_color
 
|base_color
 
|float3
 
|float3
|required
+
|(1, 1, 1)
 
|all
 
|all
 
|Defines the default color of the paint job.
 
|Defines the default color of the paint job.
Line 37: Line 42:
 
|mask_r_locked
 
|mask_r_locked
 
|rowspan="3"|bool
 
|rowspan="3"|bool
|rowspan="3"|optional
+
|true
 
|rowspan="3"|colormask
 
|rowspan="3"|colormask
 
|rowspan="3"|When false, the player may change each channel's color via the color picker.
 
|rowspan="3"|When false, the player may change each channel's color via the color picker.
 
|-
 
|-
 
|mask_g_locked
 
|mask_g_locked
 +
|true
 
|-
 
|-
 
|mask_b_locked
 
|mask_b_locked
 +
|true
 
|-
 
|-
 
|base_color_locked
 
|base_color_locked
 
|bool
 
|bool
|required
+
|true
 
|all
 
|all
 
|When false, the player may change the base color via the color picker.
 
|When false, the player may change the base color via the color picker.
Line 53: Line 60:
 
|flip_color_locked
 
|flip_color_locked
 
|bool
 
|bool
|optional
+
|true
 
|flipflake
 
|flipflake
 
|When false, the player may change the flip color via the color picker.
 
|When false, the player may change the flip color via the color picker.
Line 59: Line 66:
 
|flake_color_locked
 
|flake_color_locked
 
|bool
 
|bool
|optional
+
|true
 
|flipflake
 
|flipflake
 
|When false, the player may change the flake color via the color picker.
 
|When false, the player may change the flake color via the color picker.
Line 65: Line 72:
 
|flip_color
 
|flip_color
 
|float3
 
|float3
|optional
+
|(1, 0, 0)
 
|flipflake
 
|flipflake
|
+
|Defines the color of the flip effect.
 
|-
 
|-
 
|flip_strength
 
|flip_strength
 
|float
 
|float
|optional
+
|0.27
 
|flipflake
 
|flipflake
|
+
|Defines the relative strength of the flip effect.
 
|-
 
|-
 
|flake_color
 
|flake_color
 
|float3
 
|float3
|optional
+
|(0, 1, 0)
 
|flipflake
 
|flipflake
|
+
|Defines the color of the flake effect.
 
|-
 
|-
 
|flake_uvscale
 
|flake_uvscale
 
|float
 
|float
|optional
+
|32.0
 
|flipflake
 
|flipflake
|
+
|Defines how many times the flake_noise texture repeats within one UV tile. (Another way to think of this is that the UV coordinates are divided by this factor when addressing flake_noise.)
 
|-
 
|-
 
|flake_density
 
|flake_density
 
|float
 
|float
|optional
+
|1.0
 
|flipflake
 
|flipflake
|
+
|Defines how 'tight' the flake effect is to the specular highlight. Higher values result in a smaller area of the flake effect, while smaller values result in a broad area having it.
 
|-
 
|-
 
|flake_shininess
 
|flake_shininess
 
|float
 
|float
|optional
+
|50.0
 
|flipflake
 
|flipflake
 
|
 
|
Line 101: Line 108:
 
|flake_clearcoat_rolloff
 
|flake_clearcoat_rolloff
 
|float
 
|float
|optional
+
|2.2
 
|flipflake
 
|flipflake
|
+
|Adjusts the sharpness of the clearcoat specular highlight. Higher values yield sharper edges.
 
|-
 
|-
 
|flake_noise
 
|flake_noise
 
|string
 
|string
|optional
+
|"/material/custom/flake_noise.tobj"
 
|flipflake
 
|flipflake
|Path to the flipflake texture.
+
|Path to the flipflake texture. The RGB component multiplies the flake_color, and the A component masks the flake effect.
 
|-
 
|-
 
|flipflake
 
|flipflake
 
|bool
 
|bool
|optional
+
|false
 
|
 
|
 
|When true, flipflake (metallic/pearlescent) behavior and attributes are enabled. Cannot be used with colormask.
 
|When true, flipflake (metallic/pearlescent) behavior and attributes are enabled. Cannot be used with colormask.
Line 119: Line 126:
 
|airbrush
 
|airbrush
 
|bool
 
|bool
|optional
+
|false
 
|
 
|
 
|When true, airbrush behavior and attributes are enabled. Cannot be used with colormask.
 
|When true, airbrush behavior and attributes are enabled. Cannot be used with colormask.
Line 125: Line 132:
 
|alternate_uvset
 
|alternate_uvset
 
|bool
 
|bool
|optional
+
|false
 
|all
 
|all
 
|When true, the resulting material will have the ''altuv'' flavor. This triggers usage of the alternate UV layout, if configured.
 
|When true, the resulting material will have the ''altuv'' flavor. This triggers usage of the alternate UV layout, if configured.
Line 131: Line 138:
 
|stock
 
|stock
 
|bool
 
|bool
|required
+
|false
 
|all
 
|all
|Defaults to '''true'''. This was previously used to mark paintjobs available when purchasing a truck when true, and only available from the upgrade shop when false. Currently must be set to '''false''' to avoid undesirable behavior.
+
|Defaults to '''false'''. This was previously used to mark paintjobs available when purchasing a truck when true, and only available from the upgrade shop when false. Currently must be set to '''false''' to avoid undesirable behavior.
 
|-
 
|-
 
|paint_job_mask
 
|paint_job_mask
 
|string
 
|string
|optional
+
|
|colormask, airbrush
+
|all
|Defines the path to the texture resource (.tobj) to be used for color masking (colormask) or for blending (airbrush).
+
|Defines the path to the texture resource (.tobj) to be used for color masking (colormask) or for blending (airbrush). If empty, mask is ignored and final result is composed purely from color attributes.
 
|-
 
|-
|base_texture
+
|base_texture_override
 
|string
 
|string
|optional
+
|
 
|all
 
|all
|Can be used to override the base texture of the truckpaint material. Requires that all truckpaint materials on the vehicle use the same base texture in the first place.
+
|Defines the path to a texture resource (.tobj) to override the base texture of the truckpaint material(s). If empty, the base texture will be used as defined in the truckpaint material(s). This is useful for overriding the alpha channel of the base texture if a different specularity is desired.
 
|}
 
|}
 
== Raw Unit Definition ==
 
<pre style="max-height:300px;overflow:auto">  "accessory_paint_job_data":{
 
  "superclass":"accessory_data",
 
  "attrs":{
 
    "name":{
 
    "type": "string"
 
    },
 
    "short_name":{
 
    "type": "string"
 
    },
 
    "icon":{
 
    "type": "string"
 
    },
 
    "info":{
 
    "type": "string_array"
 
    },
 
    "price":{
 
    "type": "s64"
 
    },
 
    "unlock":{
 
    "type": "uint"
 
    },
 
    "suitable_for":{
 
    "type": "string_array"
 
    },
 
    "conflict_with":{
 
    "type": "string_array"
 
    },
 
    "defaults":{
 
    "type": "string_array"
 
    },
 
    "require":{
 
    "type": "token_array"
 
    },
 
    "mask_r_color":{
 
    "type": "float3"
 
    },
 
    "mask_g_color":{
 
    "type": "float3"
 
    },
 
    "mask_b_color":{
 
    "type": "float3"
 
    },
 
    "base_color":{
 
    "type": "float3"
 
    },
 
    "mask_r_locked":{
 
    "type": "bool"
 
    },
 
    "mask_g_locked":{
 
    "type": "bool"
 
    },
 
    "mask_b_locked":{
 
    "type": "bool"
 
    },
 
    "base_color_locked":{
 
    "type": "bool"
 
    },
 
    "flip_color_locked":{
 
    "type": "bool"
 
    },
 
    "flake_color_locked":{
 
    "type": "bool"
 
    },
 
    "flip_color":{
 
    "type": "float3"
 
    },
 
    "flip_strength":{
 
    "type": "float"
 
    },
 
    "flake_color":{
 
    "type": "float3"
 
    },
 
    "flake_uvscale":{
 
    "type": "float"
 
    },
 
    "flake_density":{
 
    "type": "float"
 
    },
 
    "flake_shininess":{
 
    "type": "float"
 
    },
 
    "flake_clearcoat_rolloff":{
 
    "type": "float"
 
    },
 
    "flake_noise":{
 
    "type": "string"
 
    },
 
    "flipflake":{
 
    "type": "bool"
 
    },
 
    "airbrush":{
 
    "type": "bool"
 
    },
 
    "alternate_uvset":{
 
    "type": "bool"
 
    },
 
    "stock":{
 
    "type": "bool"
 
    },
 
    "paint_job_mask":{
 
    "type": "string"
 
    },
 
    "base_texture":{
 
    "type": "string"
 
    }
 
  }
 
  },</pre>
 

Latest revision as of 15:06, 5 May 2022

The accessory_paint_job_data unit class is used to define paint jobs for trucks and trailers (as of ETS2 1.25/ATS 1.4).

Usage

Airbrush

In the airbrush mode, the RGB of paint_job_mask is blended with the base color, using the alpha channel as the blend factor. This mode is active when the attribute airbrush is true.

Colormask

In the colormask mode, each of paint_job_mask's color channels (RGB) acts as a mask for a color being blended over the base texture. They are applied in the order blue, green, and red. So the red channel has the highest “priority”, followed by green and then blue.

TIP: Texture compression can lead to some minor aliasing at sharp boundaries between the mask channels. To avoid colors ‘bleeding through’ at these boundaries, try blending some of the lower-priority channel ‘under’ the higher-priority channel along their shared boundary. For example, at a sharp boundary between the red (255, 0, 0) and green (0, 255, 0) channels, a thin line of the base color may be visible. This can be mitigated by extending the edge of the lower-priority mask ‘under’ the higher-priority mask. So in the case where there is a sharp line between the red mask and the green mask, the green mask should be extended slightly into the area of the red mask. The resultant color looking at the RGB image would be yellow (255, 255, 0).

Attributes

Many common attributes are inherited from accessory_data.

Name Type Default Value Modes Description
mask_r_color float3 (1, 0, 0) colormask Defines the default color applied to each channel of the color mask.
mask_g_color (0, 1, 0)
mask_b_color (0, 0, 1)
base_color float3 (1, 1, 1) all Defines the default color of the paint job.
mask_r_locked bool true colormask When false, the player may change each channel's color via the color picker.
mask_g_locked true
mask_b_locked true
base_color_locked bool true all When false, the player may change the base color via the color picker.
flip_color_locked bool true flipflake When false, the player may change the flip color via the color picker.
flake_color_locked bool true flipflake When false, the player may change the flake color via the color picker.
flip_color float3 (1, 0, 0) flipflake Defines the color of the flip effect.
flip_strength float 0.27 flipflake Defines the relative strength of the flip effect.
flake_color float3 (0, 1, 0) flipflake Defines the color of the flake effect.
flake_uvscale float 32.0 flipflake Defines how many times the flake_noise texture repeats within one UV tile. (Another way to think of this is that the UV coordinates are divided by this factor when addressing flake_noise.)
flake_density float 1.0 flipflake Defines how 'tight' the flake effect is to the specular highlight. Higher values result in a smaller area of the flake effect, while smaller values result in a broad area having it.
flake_shininess float 50.0 flipflake
flake_clearcoat_rolloff float 2.2 flipflake Adjusts the sharpness of the clearcoat specular highlight. Higher values yield sharper edges.
flake_noise string "/material/custom/flake_noise.tobj" flipflake Path to the flipflake texture. The RGB component multiplies the flake_color, and the A component masks the flake effect.
flipflake bool false When true, flipflake (metallic/pearlescent) behavior and attributes are enabled. Cannot be used with colormask.
airbrush bool false When true, airbrush behavior and attributes are enabled. Cannot be used with colormask.
alternate_uvset bool false all When true, the resulting material will have the altuv flavor. This triggers usage of the alternate UV layout, if configured.
stock bool false all Defaults to false. This was previously used to mark paintjobs available when purchasing a truck when true, and only available from the upgrade shop when false. Currently must be set to false to avoid undesirable behavior.
paint_job_mask string all Defines the path to the texture resource (.tobj) to be used for color masking (colormask) or for blending (airbrush). If empty, mask is ignored and final result is composed purely from color attributes.
base_texture_override string all Defines the path to a texture resource (.tobj) to override the base texture of the truckpaint material(s). If empty, the base texture will be used as defined in the truckpaint material(s). This is useful for overriding the alpha channel of the base texture if a different specularity is desired.