Modding:Armor/Clothing Texture Maps: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
No edit summary
(Added a note regarding shaders using different spellings for the GlowColour/GlowColor property.)
 
(43 intermediate revisions by 6 users not shown)
Line 3: Line 3:
|description=This page is a hub for everything related to Modding Baldur's Gate 3. Check out the following guides to learn how to mod BG3.
|description=This page is a hub for everything related to Modding Baldur's Gate 3. Check out the following guides to learn how to mod BG3.
|image=Modding_resources.webp
|image=Modding_resources.webp
}}{{NavModding}}
}}{{Modding box}}{{Modding sidebar}}
== MSCLOTH ==
 
The MSKCLOTH file defines the material colours.
== Armor/Clothing Texture Maps (Basic) ==
=== Base Map - BM ===
=== Base Map - BM ===
Colour strength
Colour strength
=== Physical Map - PM ===
=== Physical Map - PM ===
Glossiness
Glossiness
* Red Channel = Metallic (Darker = Matte)
* Red Channel = Metallic (Darker = Matte)
* Green Channel = Roughness (Darker = Glossier)
* Green Channel = Roughness (Darker = Glossier)
* Blue Channel = Ambient Occlusion (Contains Lighting Data)
* Blue Channel = Ambient Occlusion (Contains Lighting Data)


== Parameters and corresponding colours inside MSKCOLOR ==
=== Normal Map - NM ===
[[File:mskcloth.webp]]
Normals
Note: Red channel is not used, moved to Alpha instead
 
=== Color Map - MSKColor/MSKcloth ===
Defines the material colours based on area - also needed to make Dyes work on armor/clothing.
 
== Parameters and corresponding colours inside MSKColor/MSKcloth ==
 
{| class="wikitable"
|+Parameters & Colors
!Parameter
!0-1
!Hex
|-
|Cloth_Primary
|1 0.5 0
|#FF8000
|-
|Cloth_Secondary
|1 0 0
|#FF0000
|-
|Cloth_Tertiary
|1 0.5 0.5
|#FF8080
|-
|Leather_Primary
|0.5 0 1
|#8000FF
|-
|Leather_Secondary
|0 0 1
|#0000FF
|-
|Leather_Tertiary
|0.5 0.5 1
|#8080FF
|-
|Metal_Primary
|0 1 0.5
|#00FF80
|-
|Metal_Secondary
|0 1 0
|#00FF00
|-
|Metal_Tertiary
|0.5 1 0.5
|#80FF80
|-
|Accent_Color
|1 0 0.5
|#FF0080
|-
|Custom_1
|0 0.5 1
|#0080FF
|-
|Custom_2
|0.5 1 0
|#80FF00
|}
 
[[File:MSKcloth.webp|600x600px]]
 
== Armor/Clothing Texture Maps (Advanced) ==
One can read [[Modding:Creating Outfit Textures|here]] to learn about the actual creation of textures for your custom armor/clothing, and check out [[Modding:Coding An Item|here]] for more in-depth explanations on inserting your textures into a mod. This section is only meant to expand on the previous one with some images and the occasional code example, and with only brief mentions of texture editing. 
 
 
=== Shader (Configs) ===
These files get assigned to each and every material used for models, and essentially tells the game how to render an object - what texture maps it allows and the different parameters one can edit.
 
A lot of the shaders used in the game are VT-only (short for Virtual Textures), meaning their textures can only be loaded via specially encoded .gtp files. Currently we can unpack and edit these but not re-insert them back into the game as VT’s or create custom ones without the setup and use of Script Extender (see guide [https://github.com/Norbyte/bg3se/blob/main/Docs/VirtualTextures.md here] if interested).
'''Shader configs are inserted as paths leading to the file into the SourceFile section of your material entry:'''<syntaxhighlight lang="xml">
<node id="Resource">
    <attribute id="DiffusionProfileUUID" type="FixedString" value="" />
    <attribute id="ID" type="FixedString" value="yourUUIDHere" /> Material ID for model
    <attribute id="MaterialType" type="uint8" value="4" />
    <attribute id="Name" type="LSString" value="YourModelName" />
    <attribute id="SourceFile" type="LSString" value="Public/Shared/Assets/Materials/Characters/CHAR_BASE.lsf" />
    <attribute id="_OriginalFileVersion_" type="int64" value="144115198813274414" />
    <children>
        your textures + settings here etc
    </children>
</node>
</syntaxhighlight>
 
This is the standard shader config you can use to insert your own Normal Maps, Physical Maps, Base Color Maps and MSKColor maps for your custom armor/clothing:<blockquote>Public/Shared/Assets/Materials/Characters/CHAR_BASE.lsf</blockquote>'''And these are the basic code entries needed to insert said texture maps:'''<syntaxhighlight lang="xml">
<node id="Texture2DParameters"> _BM
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="01 Texture Map" />
    <attribute id="ID" type="FixedString" value="yourUUIDhere" />
    <attribute id="ParameterName" type="FixedString" value="basecolor" />
</node>
 
<node id="Texture2DParameters"> _NM
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="01 Texture Map" />
    <attribute id="ID" type="FixedString" value="yourUUIDhere" />
    <attribute id="ParameterName" type="FixedString" value="normalmap" />
</node>
 
<node id="Texture2DParameters"> _PM
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="01 Texture Map" />
    <attribute id="ID" type="FixedString" value="yourUUIDhere" />
    <attribute id="ParameterName" type="FixedString" value="physicalmap" />
</node>
 
<node id="Texture2DParameters">
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="01 Texture Map" />
    <attribute id="ID" type="FixedString" value="yourUUIDhere" />
    <attribute id="ParameterName" type="FixedString" value="MSKColor" />
</node>
</syntaxhighlight>
 
 
 
Some shaders allow for additional maps or features to be used for armor/clothing, such as:
 
=== Glow Maps ===
As their name implies, these allow for glowing sections to be added to armor/clothing. You’d need to swap to a shader config that allows for Glow Maps to be able to use insert them. There's a few non-VT possibilities for this, depending on what look you’re trying to achieve. Some standard ones are:
 
<blockquote>Public/Shared/Assets/Materials/Characters/CHAR_BASE_GM.lsf</blockquote>^ Basic, this one only lets you set glowmap color via an overlaid GlowColor. Supports MSKcolor maps!
 
<blockquote>Public/Shared/Assets/Materials/Base/Base_GM_Pulse_FX.lsf</blockquote>^ A little more advanced, as it lets you set Glow Map color via either an overlaid GlowColor OR you can insert the colors directly into the Glow Map depending on your chosen settings, and also lets you set a pulse animation on the glow. Does not support MSKcolor maps!
 
 
[[File:Example of Base GM Pulse FX (animated).mp4|none|thumb|Example of Base_GM_Pulse_FX]]
 
 
'''To insert a Glow Map once you’ve switched to a _GM shader and have a Glow Map ready:'''<syntaxhighlight lang="xml+velocity">
<node id="Texture2DParameters"> _GM
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="01 Texture Map" />
    <attribute id="ID" type="FixedString" value="yourUUIDhere" />
    <attribute id="ParameterName" type="FixedString" value="Glowmap" />
</node>
</syntaxhighlight>
 
'''And the GlowColor setting for both shader configs:'''
 
(Note: You may need to use the American spelling 'GlowColor' and not the British spelling 'GlowColour' depending on which shader you're using. You can extract the config file for the shader you're using (e.g. 'CHAR_BASE_GM.lsf') if you want to double-check which spelling it uses).<syntaxhighlight lang="xml">
<node id="Vector3Parameters">
    <attribute id="BaseValue" type="fvec3" value="0 0 0" />
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="Glow" />
    <attribute id="IsColor" type="bool" value="True" />
    <attribute id="ParameterName" type="FixedString" value="GlowColour" />
    <attribute id="Value" type="fvec3" value="1 1 1" />
</node>
</syntaxhighlight>
 
'''These settings are for Base_GM_Pulse_FX specifically:''' <syntaxhighlight lang="xml">
<node id="ScalarParameters">
    <attribute id="BaseValue" type="float" value="0" />
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="Glow" />
    <attribute id="ParameterName" type="FixedString" value="UseGMColor" />
    <attribute id="Value" type="float" value="1" />
</node>
</syntaxhighlight>0 = GlowColor sets the overall color of the Glow Map
1 = the color of the Glow Map itself dictates colors
<syntaxhighlight lang="xml">
<node id="ScalarParameters">
    <attribute id="BaseValue" type="float" value="1" />
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="Glow" />
    <attribute id="ParameterName" type="FixedString" value="PulseSpeed" />
    <attribute id="Value" type="float" value="1" />
</node>
</syntaxhighlight>0 = no pulse animation
Between 0 - 1 = pulse animation and its speed
 
 
There are some Glow Map shaders that let you set colors via a ColorMap, which essentially is a colored gradient - these are more often used for VFX stuff than armor/clothing.
 
 
=== Alpha (aka Transparancy) ===
 
Some shader configs allow you to create completely (or partially) transparent parts on armor/clothing without needing to edit the mesh. A standard one is:<blockquote>Materials\Public\Shared\Assets\Materials\Characters\CHAR_BASE_AlphaTest.lsf</blockquote>Any transparency is added via the Base Color map, by creating a white Alpha channel and painting in parts you want fully transparent with black (grey for partial transparancy). In the game files these files might be called _BMA instead of _BM, but the naming doesn’t matter - they’re just _BM files exported with Alpha active.
 
 
[[File:Example_of_BMA_file_with_Alpha_channel.jpg|thumb|429x429px|Example custom Base Color + Alpha Map|left]][[File:Example_of_shader_use_with_Alpha.png|alt=Example of shader used + _BM with Alpha|thumb|541x541px|none|In-game view]]
 
 
 
 
=== Backfaces (Two-sided textures) ===
 
A way to make your model appear double-sided without editing the mesh, is to use a shader config that allows for Backfaces. A standard one is:<blockquote>Materials\Public\Shared\Assets\Materials\Characters\CHAR_BASE_AlphaTest_2S.lsf</blockquote>
 
 
You don’t need to do anything special when switching to this shader, the textures used within the materials will now just appear double-sided. Note that this one also allows for transparency, as a non-VT alternative just for _2s exclusively doesn’t exist for us to use. As long as you don’t have an Alpha channel in your Base Color Map it won’t affect your textures.
 
 
=== VertCut ===
Shaders with this term in their name allow for using vertex colors to mask parts of clothing. For example, a pair of boots are too long and clip through pants - a VertCut shader will allow you (with an appropriately set up model) to hide the part of the pants the boot overlays and avoid clipping. You can read more about them in general [[Modding:VertexColorMaskSlots|here]]. A standard one is:<blockquote>Materials\Public\Shared\Assets\Materials\Characters\CHAR_BASE_VertCut.lsf</blockquote>
 
This one supports alphas, MSKColours, and vertcut:
<blockquote>Public/Shared/Assets/Materials/Characters/CHAR_BASE_AlphaTest_2S_Dither.lsf</blockquote>
 
 
=== What if I want to use x and x? ===
Some combinations of the above are also possible, though again, we are limited by the amount of non-VT ones that allow for them. See the page [[Modding:Non-VT Shaders|here]].
 
Many more shader configs with specific purposes exist, you can always check within the shader config .lsf file to see what texture maps + parameters it allows.
 
<br>
<br>
[https://substance3d.adobe.com/magazine/bringing-life-to-legends-character-art-in-baldurs-gate-3/ Source]
[https://substance3d.adobe.com/magazine/bringing-life-to-legends-character-art-in-baldurs-gate-3/ Source]
[[Category:Modding]]
 
{{Modding navbox}}
[[Category:Modding resources]]
[[Category:Armor modding]]

Latest revision as of 23:59, 25 August 2024

Armor/Clothing Texture Maps (Basic)[edit | edit source]

Base Map - BM[edit | edit source]

Colour strength

Physical Map - PM[edit | edit source]

Glossiness

  • Red Channel = Metallic (Darker = Matte)
  • Green Channel = Roughness (Darker = Glossier)
  • Blue Channel = Ambient Occlusion (Contains Lighting Data)

Normal Map - NM[edit | edit source]

Normals Note: Red channel is not used, moved to Alpha instead

Color Map - MSKColor/MSKcloth[edit | edit source]

Defines the material colours based on area - also needed to make Dyes work on armor/clothing.

Parameters and corresponding colours inside MSKColor/MSKcloth[edit | edit source]

Parameters & Colors
Parameter 0-1 Hex
Cloth_Primary 1 0.5 0 #FF8000
Cloth_Secondary 1 0 0 #FF0000
Cloth_Tertiary 1 0.5 0.5 #FF8080
Leather_Primary 0.5 0 1 #8000FF
Leather_Secondary 0 0 1 #0000FF
Leather_Tertiary 0.5 0.5 1 #8080FF
Metal_Primary 0 1 0.5 #00FF80
Metal_Secondary 0 1 0 #00FF00
Metal_Tertiary 0.5 1 0.5 #80FF80
Accent_Color 1 0 0.5 #FF0080
Custom_1 0 0.5 1 #0080FF
Custom_2 0.5 1 0 #80FF00

MSKcloth.webp

Armor/Clothing Texture Maps (Advanced)[edit | edit source]

One can read here to learn about the actual creation of textures for your custom armor/clothing, and check out here for more in-depth explanations on inserting your textures into a mod. This section is only meant to expand on the previous one with some images and the occasional code example, and with only brief mentions of texture editing.


Shader (Configs)[edit | edit source]

These files get assigned to each and every material used for models, and essentially tells the game how to render an object - what texture maps it allows and the different parameters one can edit.

A lot of the shaders used in the game are VT-only (short for Virtual Textures), meaning their textures can only be loaded via specially encoded .gtp files. Currently we can unpack and edit these but not re-insert them back into the game as VT’s or create custom ones without the setup and use of Script Extender (see guide here if interested).

Shader configs are inserted as paths leading to the file into the SourceFile section of your material entry:
<node id="Resource">
    <attribute id="DiffusionProfileUUID" type="FixedString" value="" />
    <attribute id="ID" type="FixedString" value="yourUUIDHere" /> Material ID for model
    <attribute id="MaterialType" type="uint8" value="4" />
    <attribute id="Name" type="LSString" value="YourModelName" />
    <attribute id="SourceFile" type="LSString" value="Public/Shared/Assets/Materials/Characters/CHAR_BASE.lsf" />
    <attribute id="_OriginalFileVersion_" type="int64" value="144115198813274414" />
    <children>
        your textures + settings here etc
    </children>
</node>
This is the standard shader config you can use to insert your own Normal Maps, Physical Maps, Base Color Maps and MSKColor maps for your custom armor/clothing:
Public/Shared/Assets/Materials/Characters/CHAR_BASE.lsf
And these are the basic code entries needed to insert said texture maps:
<node id="Texture2DParameters"> _BM
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="01 Texture Map" />
    <attribute id="ID" type="FixedString" value="yourUUIDhere" />
    <attribute id="ParameterName" type="FixedString" value="basecolor" />
</node>

<node id="Texture2DParameters"> _NM
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="01 Texture Map" />
    <attribute id="ID" type="FixedString" value="yourUUIDhere" />
    <attribute id="ParameterName" type="FixedString" value="normalmap" />
</node>

<node id="Texture2DParameters"> _PM
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="01 Texture Map" />
    <attribute id="ID" type="FixedString" value="yourUUIDhere" />
    <attribute id="ParameterName" type="FixedString" value="physicalmap" />
</node>

<node id="Texture2DParameters">
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="01 Texture Map" />
    <attribute id="ID" type="FixedString" value="yourUUIDhere" />
    <attribute id="ParameterName" type="FixedString" value="MSKColor" />
</node>


Some shaders allow for additional maps or features to be used for armor/clothing, such as:

Glow Maps[edit | edit source]

As their name implies, these allow for glowing sections to be added to armor/clothing. You’d need to swap to a shader config that allows for Glow Maps to be able to use insert them. There's a few non-VT possibilities for this, depending on what look you’re trying to achieve. Some standard ones are:

Public/Shared/Assets/Materials/Characters/CHAR_BASE_GM.lsf
^ Basic, this one only lets you set glowmap color via an overlaid GlowColor. Supports MSKcolor maps!
Public/Shared/Assets/Materials/Base/Base_GM_Pulse_FX.lsf
^ A little more advanced, as it lets you set Glow Map color via either an overlaid GlowColor OR you can insert the colors directly into the Glow Map depending on your chosen settings, and also lets you set a pulse animation on the glow. Does not support MSKcolor maps!


Example of Base_GM_Pulse_FX


To insert a Glow Map once you’ve switched to a _GM shader and have a Glow Map ready:
<node id="Texture2DParameters"> _GM
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="01 Texture Map" />
    <attribute id="ID" type="FixedString" value="yourUUIDhere" />
    <attribute id="ParameterName" type="FixedString" value="Glowmap" />
</node>

And the GlowColor setting for both shader configs:

(Note: You may need to use the American spelling 'GlowColor' and not the British spelling 'GlowColour' depending on which shader you're using. You can extract the config file for the shader you're using (e.g. 'CHAR_BASE_GM.lsf') if you want to double-check which spelling it uses).
<node id="Vector3Parameters">
    <attribute id="BaseValue" type="fvec3" value="0 0 0" />
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="Glow" />
    <attribute id="IsColor" type="bool" value="True" />
    <attribute id="ParameterName" type="FixedString" value="GlowColour" />
    <attribute id="Value" type="fvec3" value="1 1 1" />
</node>
These settings are for Base_GM_Pulse_FX specifically:
<node id="ScalarParameters">
    <attribute id="BaseValue" type="float" value="0" />
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="Glow" />
    <attribute id="ParameterName" type="FixedString" value="UseGMColor" />
    <attribute id="Value" type="float" value="1" />
</node>
0 = GlowColor sets the overall color of the Glow Map

1 = the color of the Glow Map itself dictates colors

<node id="ScalarParameters">
    <attribute id="BaseValue" type="float" value="1" />
    <attribute id="Enabled" type="bool" value="True" />
    <attribute id="ExportAsPreset" type="bool" value="True" />
    <attribute id="GroupName" type="FixedString" value="Glow" />
    <attribute id="ParameterName" type="FixedString" value="PulseSpeed" />
    <attribute id="Value" type="float" value="1" />
</node>
0 = no pulse animation

Between 0 - 1 = pulse animation and its speed


There are some Glow Map shaders that let you set colors via a ColorMap, which essentially is a colored gradient - these are more often used for VFX stuff than armor/clothing.


Alpha (aka Transparancy)[edit | edit source]

Some shader configs allow you to create completely (or partially) transparent parts on armor/clothing without needing to edit the mesh. A standard one is:
Materials\Public\Shared\Assets\Materials\Characters\CHAR_BASE_AlphaTest.lsf
Any transparency is added via the Base Color map, by creating a white Alpha channel and painting in parts you want fully transparent with black (grey for partial transparancy). In the game files these files might be called _BMA instead of _BM, but the naming doesn’t matter - they’re just _BM files exported with Alpha active.


Example custom Base Color + Alpha Map
Example of shader used + _BM with Alpha
In-game view



Backfaces (Two-sided textures)[edit | edit source]

A way to make your model appear double-sided without editing the mesh, is to use a shader config that allows for Backfaces. A standard one is:
Materials\Public\Shared\Assets\Materials\Characters\CHAR_BASE_AlphaTest_2S.lsf


You don’t need to do anything special when switching to this shader, the textures used within the materials will now just appear double-sided. Note that this one also allows for transparency, as a non-VT alternative just for _2s exclusively doesn’t exist for us to use. As long as you don’t have an Alpha channel in your Base Color Map it won’t affect your textures.


VertCut[edit | edit source]

Shaders with this term in their name allow for using vertex colors to mask parts of clothing. For example, a pair of boots are too long and clip through pants - a VertCut shader will allow you (with an appropriately set up model) to hide the part of the pants the boot overlays and avoid clipping. You can read more about them in general here. A standard one is:
Materials\Public\Shared\Assets\Materials\Characters\CHAR_BASE_VertCut.lsf

This one supports alphas, MSKColours, and vertcut:

Public/Shared/Assets/Materials/Characters/CHAR_BASE_AlphaTest_2S_Dither.lsf


What if I want to use x and x?[edit | edit source]

Some combinations of the above are also possible, though again, we are limited by the amount of non-VT ones that allow for them. See the page here.

Many more shader configs with specific purposes exist, you can always check within the shader config .lsf file to see what texture maps + parameters it allows.


Source