Modding:Unpacking and converting files: Difference between revisions

From Baldur's Gate 3 Wiki
No edit summary
 
(30 intermediate revisions by 10 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
}}Main page: [[Modding Resources]]
}}{{NavModding}}
== Tools ==
== Necessary Tools ==
* LSLIB by Norbyte
* LSLIB by Norbyte
** Install [https://github.com/Norbyte/lslib/releases/tag/v1.15.13 1.15.13] first, then install whichever is the [https://github.com/Norbyte/lslib/releases LATEST] release
** ''Note: This step is primarily for acquiring the '''granny2.dll''' from a previous version of LSLIB. The latest release version may already have this file present, in which case you can just install the latest release.''
** Install [https://github.com/Norbyte/lslib/releases/tag/v1.15.13 1.15.13] first, then install whichever is the [https://github.com/Norbyte/lslib/releases LATEST] release.
* Modders Multitool by ShinyHobo
* Modders Multitool by ShinyHobo
** Install [https://github.com/ShinyHobo/BG3-Modders-Multitool/releases LATEST] release
** Install [https://github.com/ShinyHobo/BG3-Modders-Multitool/releases LATEST] release.
** Make sure the folder you use for Multitool is separate from the LSLIB folder.


Unzip the Modders Multitool. This is a small program that simplifies unpacking and viewing of files. It throws all unpacked files into its own directory, so put it where there is enough free disk space.
'''The Tool has an official wiki that now breaks down unpacking and other parts of the tool: [https://github.com/ShinyHobo/BG3-Modders-Multitool/wiki BG3 Modders Multitool Wiki]'''


ExportTool of the latest version can be placed in any convenient place. This is the "engine" that decompresses files and converts them into a readable format. Modders Multitool uses it.
Please use that for the most up-to-date information.


== Tools Settings ==
<br>
Now to ExportTool.
 
This project needs the '''granny2.dll''' file to work correctly. Due to licensing issues at one point, Norbyte removed this file from some of the later versions of ExportTool, but it exists in older versions, such as v1.15.13, the link to which is above.
 
Verify that the '''granny2.dll''' file is present in the ExportTool's '''root folder''' and in the '''Tools''' sub-folder. If the file is present in both of these folders, then nothing more needs to be done with ExportTool and you can skip to the next section of this guide.


Before unpacking the files, you need to do a few tweaks.  
If the '''granny2.dll''' file is missing from the '''root folder''' and/or the '''Tools''' sub-folder of the latest version of ExportTool, then you will need to copy the file over from the older version v1.15.13. Open the archive '''ExportTool-v1.15.13.zip''', copy the '''granny2.dll''' file, and paste it where you unpacked the latest version of ExportTool in the '''root folder''' and in the '''Tools''' sub-folder. Nothing more needs to be done with ExportTool.
Run '''bg3-modders-multitool.exe''' from the folder where you unpacked Modders Multitool and click on the asterisk.


[[File:Modders Multitool_01.webp|650px|frameless|center]]
To run ExportTool, open ConverterApp.exe.


Here you will need to specify the path to divine.exe, which is located in '''ExportTool-vX.X.X/Tools'''
== Unpacking Process ==
And the <code>.exe</code> of the game itself in the path Baldurs Gate 3/bin. For '''Vulcan it is bg3.exe''', for '''DirectX bg3_dx11.exe'''
[[File:Modders Multitool 02.webp|650px|frameless|center]]


<br>
Currently we no longer need to directly unpack the game pak files thanks to Multitool updates. Instead, you can index your files and unpack the files as you need them. This saves you some hard drive space, as BG3 has a lot of files.
Now to ExportTool.  
 
=== Indexing ===
 
'''[https://github.com/ShinyHobo/BG3-Modders-Multitool/wiki/Index-Search Multitools wiki post on Indexing and Searching]'''
 
In Multitool, go to {{InfoBlob|Utilities > Index > Index Pak Files}} and this will now index all the unpacked pak files. Much quicker and easier to maintain than unpacking all of the paks.
* When we get new hot fixes, follow the above again to index the new hotfix paks.
 
However, whenever we get a full patch release, it is advised to first clear out the index and reindex using the following method: {{InfoBlob|Utilities > Index > Clear Index and then Utilities > Index > Index Pak Files}}
 
If you still want to unpack game paks manually rather than unpacking individual files via the new method, you can use: '''{{InfoBlob|'''Utilities''' > '''Game File Operations''' > '''Unpack Game Files'''.}}'''
** As of Patch 4, when a new patch is released, the hotfix paks get implemented into the main paks.
 
==== Index Search Unpacking ====
 
If you know the common name used on assets you want to unpack, you can use index search (once it has finished indexing) to unpack specific assets. For example, let’s say we want to create head mods, and thus we need the head models unpacked from the assets.
 
Here we search using the filter to only show GR2 Assets, as shown below:
 
[[File:Multitool Filter.webp|600px]]
 
Then we search for NKD_Head as shown below:
 
[[File:Multitool Extract Selected.webp|600px]]
 
Now we Select All and Extract Selected.


It needs the '''granny2.dll''' file to work correctly. Because of licensing problems, Norbyte removed it from the latest versions, but the file remains in the old ones, for example in v1.5.13, the link to which is above.  
Note that this will extract more than just the races we can play as, but will use considerably less space than extracting the whole of the models.pak, if all we want to do is create head mods. You can also use this to go through the list to select specific assets you want to extract. This is not exclusive to GR2's, just pick the assets you want to filter and then you can extract.
Open the archive '''ExportTool-v1.15.13.zip''', find there '''granny2.dll''', and throw it where you unpacked the latest version of ExportTool in the '''root folder''' and in the '''Tools''' folder. Nothing more needs to be done with ExportTool.
* Be aware of your hard drive space where you placed the multitool, as it will create an {{InfoBlob|UnpackedData}} folder where it extracts these files to.


== Unpacking Process ==
=== Manually Unpacking ===


Open Modders Multitool again and click '''Unpack.pak Files'''. A menu appears.
If you still want to unpack game paks manually rather than unpacking individual files via the new method you can use {{InfoBlob|'''Utilities''' > '''Game File Operations''' > '''Unpack Game Files'''.}}
* Generally this is only advised if you have more than enough hard drive space to dedicate to unpacked files, as they can take up quite a bit of space.
* A menu will appear similar to below:
** (As of Patch 4 when a new patch is released the hotfix packs get implemented into the main paks)


[[File:Pak Selection.webp|frameless|center]]
[[File:Unpack paks.webp]]


Common files:
Common files:
* English.pak —  this is where the localization files are located. All text strings that are displayed in the game.
* English.pak —  this is where the localization files are located, aka all text strings that are displayed in the game.
* Gustav.pak — text files in .lsf format. Level data, dialog files, equipment stats, spells.
* Gustav.pak — text files in .lsf format. Level data, dialog files, equipment stats, spells.
* Materials.pak — materials (shaders). It is useless in itself, but you can see what materials are in the game to assign them to your model.  
* Materials.pak — materials (shaders). It is useless in itself, but you can see what materials are in the game to assign them to your model.  
* Models.pak — models in .gr2 format. Heads, hair, armor, architecture, etc.
* Models.pak — models in .gr2 format. Heads, hair, armour, architecture, etc.
* Textures.pak — textures in .dds format. There are not a lot of them here, mostly they are color ID masks that divide the armor into zones for coloring. But there are textures for faces, hair, tattoos. Some environment textures.
* Textures.pak — textures in .dds format. There are not a lot of them here, since most textures are held in VirtualTextures. These are mostly color ID masks that divide the armour into zones for coloring. But there are textures for faces, hair, tattoos. Some environment textures.
* Shared.pak — text files in .lsf format. Overlaps with Gustav in some respects. Model data with assigned materials, skin, hair, eye colors, etc. for the character editor, also equipment stats, spells.
* Shared.pak — text files in .lsf format. Overlaps with Gustav in some respects. Model data with assigned materials, skin, hair, eye colors, etc. for the character editor, also equipment stats, spells.
* VirtualTextures.pak — most of the textures of the game, are packed in virtual textures to improve performance.  
* VirtualTextures.pak — Most of the textures of the game are here, packed in virtual textures to improve performance.
* Voice.pak — voice lines.
* Voice.pak — voice lines.


Line 51: Line 83:
== Files conversion ==
== Files conversion ==


Most unzipped files are not viewable or editable, so you will have to convert them to a readable format.  
Most unzipped files are not viewable or editable as-is, so you will have to convert them to a readable format.  


=== .lsf → .lsx ===
=== .lsf → .lsx ===
Line 61: Line 93:
These can be converted using ExportTool. In the first tab of the GR2 Tools program specify the path to the desired <code>.gr2</code> file and below the path where the converted file will be saved. '''!!!''' You must add <code>.dae</code> after the name '''!!!'''
These can be converted using ExportTool. In the first tab of the GR2 Tools program specify the path to the desired <code>.gr2</code> file and below the path where the converted file will be saved. '''!!!''' You must add <code>.dae</code> after the name '''!!!'''


[[File:Export Tool gr2 conversion.webp|650px|frameless|center]]
[[File:800px-Export_Tool_gr2_conversion.webp|650px|frameless|center]]


First click the Import button to import the game <code>.gr2</code> model, then Export to convert it to <code>.dae</code> format.  
First click the Import button to import the game <code>.gr2</code> model, then Export to convert it to <code>.dae</code> format.  
Line 67: Line 99:


You can also import <code>.gr2</code> directly into Blender 3.x.x+.  
You can also import <code>.gr2</code> directly into Blender 3.x.x+.  
Norbyte has updated their plugin for importing and exporting models, the latest version at the time of writing can be found [https://github.com/Norbyte/dos2de_collada_exporter here]. It's a beta version, but it works pretty stable especially for importing.
Norbyte has updated their plugin for importing and exporting models, the latest can be found [https://github.com/Norbyte/dos2de_collada_exporter here].
In the addon settings we specify the path to '''divine.exe''' from ExportTool.
In the addon settings we specify the path to '''divine.exe''' from ExportTool.


[[File:Blender gr2 addon 01.webp|800px|frameless|center]]
[[File:Blender gr2 addon 01.webp|650px|frameless|center]]


Now you can import <code>.gr2</code> directly into Blender.
Now you can import <code>.gr2</code> directly into Blender.


[[File:Blender gr2 addon 02.webp|650px|frameless|center]]
[[File:623px-Blender_gr2_addon_02.webp|650px|frameless|center]]


=== .dds ===
=== .dds ===
Texture files from '''Textures.pak'''.
Texture files from '''Textures.pak'''.
These can be opened by installing the [https://developer.nvidia.com/nvidia-texture-tools-exporter Adobe Photoshop Plugin] from the Nvidia website. For those who don't have Photoshop, the free [https://www.gimp.org/downloads/ Gimp] from version 2.10.10 onwards should have .dds support.
These can be opened by installing the [https://developer.nvidia.com/nvidia-texture-tools-exporter Adobe Photoshop Plugin] from the Nvidia website. For those who don't have Photoshop, the free [https://www.gimp.org/downloads/ Gimp] from version 2.10.10 onwards should have .dds support. [https://www.getpaint.net/ Paint.net] can also open .dds files and is free.
<br>
<br>
If you need to import textures into other programs or engines (Substance Painter, Blender, Unreal, Unity), it's best to save them in Targa (.tga) format. This will leave the alpha channel intact.
If you need to import textures into other programs or engines (Substance Painter, Blender, Unreal, Unity), it's best to save them in Targa (.tga) format. This will leave the alpha channel intact.
Line 90: Line 122:
For <code>.wem</code> you will need [https://www.nexusmods.com/monsterhunterworld/mods/1912?tab=description Automatic .wem to .ogg Converter] script from Nexus Mods. It is made for Monster Hunter: World, but it works perfectly with BG3 files.
For <code>.wem</code> you will need [https://www.nexusmods.com/monsterhunterworld/mods/1912?tab=description Automatic .wem to .ogg Converter] script from Nexus Mods. It is made for Monster Hunter: World, but it works perfectly with BG3 files.
Inside the archive there is a folder WEM to OGG Converter. You need to put the files from it into the folder where .wem files are located and run <code>script.bat</code>. The script will automatically convert all <code>.wem</code> to <code>.ogg</code> files that can be opened with a standard media player.
Inside the archive there is a folder WEM to OGG Converter. You need to put the files from it into the folder where .wem files are located and run <code>script.bat</code>. The script will automatically convert all <code>.wem</code> to <code>.ogg</code> files that can be opened with a standard media player.
[[Category:Modding]]
 
=== .loca → .xml ===
Localization text from '''English.pak''' (the same for other languages).
The <code>.loca</code> files can be converted with Export Tool. Select the <code>.loca</code> file and specify the name of a <code>.xml</code> file to use as output.
[[Category:Modding guides]]

Latest revision as of 19:57, 13 April 2024

Bgwiii.png CommunityGuidesModding

Modding guides
Modding resources

Necessary Tools[edit | edit source]

  • LSLIB by Norbyte
    • Note: This step is primarily for acquiring the granny2.dll from a previous version of LSLIB. The latest release version may already have this file present, in which case you can just install the latest release.
    • Install 1.15.13 first, then install whichever is the LATEST release.
  • Modders Multitool by ShinyHobo
    • Install LATEST release.
    • Make sure the folder you use for Multitool is separate from the LSLIB folder.

The Tool has an official wiki that now breaks down unpacking and other parts of the tool: BG3 Modders Multitool Wiki

Please use that for the most up-to-date information.


Now to ExportTool.

This project needs the granny2.dll file to work correctly. Due to licensing issues at one point, Norbyte removed this file from some of the later versions of ExportTool, but it exists in older versions, such as v1.15.13, the link to which is above.

Verify that the granny2.dll file is present in the ExportTool's root folder and in the Tools sub-folder. If the file is present in both of these folders, then nothing more needs to be done with ExportTool and you can skip to the next section of this guide.

If the granny2.dll file is missing from the root folder and/or the Tools sub-folder of the latest version of ExportTool, then you will need to copy the file over from the older version v1.15.13. Open the archive ExportTool-v1.15.13.zip, copy the granny2.dll file, and paste it where you unpacked the latest version of ExportTool in the root folder and in the Tools sub-folder. Nothing more needs to be done with ExportTool.

To run ExportTool, open ConverterApp.exe.

Unpacking Process[edit | edit source]

Currently we no longer need to directly unpack the game pak files thanks to Multitool updates. Instead, you can index your files and unpack the files as you need them. This saves you some hard drive space, as BG3 has a lot of files.

Indexing[edit | edit source]

Multitools wiki post on Indexing and Searching

In Multitool, go to Utilities > Index > Index Pak Files and this will now index all the unpacked pak files. Much quicker and easier to maintain than unpacking all of the paks.

  • When we get new hot fixes, follow the above again to index the new hotfix paks.

However, whenever we get a full patch release, it is advised to first clear out the index and reindex using the following method: Utilities > Index > Clear Index and then Utilities > Index > Index Pak Files

If you still want to unpack game paks manually rather than unpacking individual files via the new method, you can use: Utilities > Game File Operations > Unpack Game Files.

    • As of Patch 4, when a new patch is released, the hotfix paks get implemented into the main paks.

Index Search Unpacking[edit | edit source]

If you know the common name used on assets you want to unpack, you can use index search (once it has finished indexing) to unpack specific assets. For example, let’s say we want to create head mods, and thus we need the head models unpacked from the assets.

Here we search using the filter to only show GR2 Assets, as shown below:

Multitool Filter.webp

Then we search for NKD_Head as shown below:

Multitool Extract Selected.webp

Now we Select All and Extract Selected.

Note that this will extract more than just the races we can play as, but will use considerably less space than extracting the whole of the models.pak, if all we want to do is create head mods. You can also use this to go through the list to select specific assets you want to extract. This is not exclusive to GR2's, just pick the assets you want to filter and then you can extract.

  • Be aware of your hard drive space where you placed the multitool, as it will create an UnpackedData folder where it extracts these files to.

Manually Unpacking[edit | edit source]

If you still want to unpack game paks manually rather than unpacking individual files via the new method you can use Utilities > Game File Operations > Unpack Game Files.

  • Generally this is only advised if you have more than enough hard drive space to dedicate to unpacked files, as they can take up quite a bit of space.
  • A menu will appear similar to below:
    • (As of Patch 4 when a new patch is released the hotfix packs get implemented into the main paks)

Unpack paks.webp

Common files:

  • English.pak — this is where the localization files are located, aka all text strings that are displayed in the game.
  • Gustav.pak — text files in .lsf format. Level data, dialog files, equipment stats, spells.
  • Materials.pak — materials (shaders). It is useless in itself, but you can see what materials are in the game to assign them to your model.
  • Models.pak — models in .gr2 format. Heads, hair, armour, architecture, etc.
  • Textures.pak — textures in .dds format. There are not a lot of them here, since most textures are held in VirtualTextures. These are mostly color ID masks that divide the armour into zones for coloring. But there are textures for faces, hair, tattoos. Some environment textures.
  • Shared.pak — text files in .lsf format. Overlaps with Gustav in some respects. Model data with assigned materials, skin, hair, eye colors, etc. for the character editor, also equipment stats, spells.
  • VirtualTextures.pak — Most of the textures of the game are here, packed in virtual textures to improve performance.
  • Voice.pak — voice lines.

Check the boxes against what you need and click Confirm. Unpacking may take a while.

Files conversion[edit | edit source]

Most unzipped files are not viewable or editable as-is, so you will have to convert them to a readable format.

.lsf → .lsx[edit | edit source]

Most files from Gustav.pak and Shared.pak. Modders Multitool can convert them to readable .lsx. Once you are done unpacking the files, you need to click Decompress Files and wait for the files to be automatically converted.

.gr2 → .dae[edit | edit source]

Model (mesh) files from Models.pak. These can be converted using ExportTool. In the first tab of the GR2 Tools program specify the path to the desired .gr2 file and below the path where the converted file will be saved. !!! You must add .dae after the name !!!

800px-Export Tool gr2 conversion.webp

First click the Import button to import the game .gr2 model, then Export to convert it to .dae format. .dae can be opened with any 3D editor.

You can also import .gr2 directly into Blender 3.x.x+. Norbyte has updated their plugin for importing and exporting models, the latest can be found here. In the addon settings we specify the path to divine.exe from ExportTool.

Blender gr2 addon 01.webp

Now you can import .gr2 directly into Blender.

623px-Blender gr2 addon 02.webp

.dds[edit | edit source]

Texture files from Textures.pak. These can be opened by installing the Adobe Photoshop Plugin from the Nvidia website. For those who don't have Photoshop, the free Gimp from version 2.10.10 onwards should have .dds support. Paint.net can also open .dds files and is free.
If you need to import textures into other programs or engines (Substance Painter, Blender, Unreal, Unity), it's best to save them in Targa (.tga) format. This will leave the alpha channel intact.

.gts → .dds[edit | edit source]

Virtual textures from VirtualTextures.pak. They can also be unpacked with ExportTool (starting with version 1.17.0). Go to the Virtual Textures tab, specify the .gts file, export path and click Extract Textures. It will make a bunch of .dds files.

.wem → .ogg[edit | edit source]

Audio files from Voice.pak. For .wem you will need Automatic .wem to .ogg Converter script from Nexus Mods. It is made for Monster Hunter: World, but it works perfectly with BG3 files. Inside the archive there is a folder WEM to OGG Converter. You need to put the files from it into the folder where .wem files are located and run script.bat. The script will automatically convert all .wem to .ogg files that can be opened with a standard media player.

.loca → .xml[edit | edit source]

Localization text from English.pak (the same for other languages). The .loca files can be converted with Export Tool. Select the .loca file and specify the name of a .xml file to use as output.