Ad placeholder

Modding:Creating and Exporting Meshes in Blender: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:


In this tutorial I will assume you are generally knowledgable about how to put meshes together, so this will focus on things specific to Baldur’s Gate 3 exporter.
In this tutorial we will assume you are generally knowledgable about how to put meshes together, so this will focus on things specific to Baldur’s Gate 3 exporter made by Norbyte.


==Setup==
==Setup==
[[Modding:Tools Check here for a list of tools.]]  
[[Modding:Tools|Check here for a list of tools.]]  
Here we are using Modder's Multitool, Blender 3.6, and [[https://github.com/Norbyte/dos2de_collada_exporter Norbyte’s Blender installer.]]
 
Here we are using Modder's Multitool, Blender 3.6, and [https://github.com/Norbyte/dos2de_collada_exporter Norbyte’s Blender installer.] Until the update specifically says it has been updated to work with Blender 4.0, we recommend sticking with Blender 3.6 currently.


Make sure you install it correctly- this video is quite out of date but should give you some example of how to install it.
Make sure you install it correctly- this video is quite out of date but should give you some example of how to install it.
You should also install [[https://www.nexusmods.com/baldursgate3/mods/346 Padme’s Addon, ‘Create LODs’]].
 
You should also install [Https://www.nexusmods.com/baldursgate3/mods/346 Padme’s Addon, ‘Create LODs’].


==Extracting a model to work with==
==Extracting a model to work with==
Line 13: Line 15:


You should at least extract HUM_F_NKD_Body_A (or whatever nude you are basing your outfit on) to fit your new outfit around.
You should at least extract HUM_F_NKD_Body_A (or whatever nude you are basing your outfit on) to fit your new outfit around.
When you have found a t-posing model to your liking. Click the extract file/open folder. You should find the mesh in .GR2 and .dae form on your computer. Use the .dae- the Blender importer likes .dae format a lot more than it likes .gr2.  
When you have found a t-posing model to your liking. Click the extract file/open folder. You should find the mesh in .GR2 and .dae form on your computer. Use the .dae- the Blender importer likes .dae format a lot more than it likes .gr2.  
'''You generally cannot import a modded-in mesh without the plugin crashing Blender.''' Hopefully are sensible and you save your own work often and can re-export it from there, and have obtained permission to edit all the modded items you want to import anyway.
'''You generally cannot import a modded-in mesh without the plugin crashing Blender.''' Hopefully are sensible and you save your own work often and can re-export it from there, and have obtained permission to edit all the modded items you want to import anyway.


Line 27: Line 31:


==Vertex Paint==
==Vertex Paint==
The game’s armour system works by vertex paint. It uses this, in combination with the .lsx code, to tell it what to hide and what to show. For example, an armour mesh may unload the torso as it will not be shown. The bottom half of a pant leg may not show when boots are equipped. You can use existing meshes as a reference for this. [[Modding:VertexColorMaskSlots Check here for a resource and Hex codes for the vertex paint.]]
The game’s armour system works by vertex paint. It uses this, in combination with the .lsx code, to tell it what to hide and what to show. For example, an armour mesh may unload the torso as it will not be shown. The bottom half of a pant leg may not show when boots are equipped. You can use existing meshes as a reference for this.
The HUM_F_NKD_Body_A is useful as reference here. For example, if you set an upper arm to be hidden for some gloves, you may wish to fit it around these seams to ensure there is no gap in the body showing.
 
[[Modding:VertexColorMaskSlots|Check here for a resource and Hex codes for the vertex paint.]]  
 
The HUM_F_NKD_Body_A is useful as reference here. For example, if you set an upper arm to be hidden for some gloves, you may wish to fit it around these seams to ensure there is no gap in the body showing.  
 
You can turn on the vertex paint to look at it in non-Vertex Paint modes by touching the Blender attributes menu.  
You can turn on the vertex paint to look at it in non-Vertex Paint modes by touching the Blender attributes menu.  


Generally outfit meshes are black in vertex paint, with some dark green on elements intended to disappear such as the pant legs.
Generally outfit meshes are black in vertex paint, with some dark green on elements intended to disappear such as the pant legs.  
 
If you intend to use part of an underwear mesh on an outerwear outfit, make sure you paint it black in Vertex Paint or it will hide when it’s not supposed to.  
If you intend to use part of an underwear mesh on an outerwear outfit, make sure you paint it black in Vertex Paint or it will hide when it’s not supposed to.  


==Fixing meshes that import in wrong==
==Fixing meshes that import in wrong==
See this video https://www.youtube.com/watch?v=NCDGhz3RSr8
[https://www.youtube.com/watch?v=NCDGhz3RSr8 See this video] for how to fix meshes that import in with messed up normals.Sometimes meshes will import in stuck together, usually on skirt meshes. This is because the verts were too close together and the importer made a hiccup. You can also fix with '''[Edit Mode] Mesh> Clean Up> Merge By Distance''', and then put a solidify modifier at 00.1 thickness.
Sometimes meshes will import in stuck together, usually on skirt meshes. This is because the verts were too close together and the importer made a hiccup. You can also fix with '''[Edit Mode] Mesh> Clean Up> Merge By Distance''', and then put a solidify modifier at 00.1 thickness.
==Physics==
Physics are set with red vertex paint. Hot pink vertex paint counterbalances the physics. You may need to delete the cloth mesh your mesh imported with, as it can cause to export badly.


[https://www.nexusmods.com/baldursgate3/articles/311 Here is a tutorial about how to add physics to your mesh by ReallyLazyIcarus.]


==Physics==
Physics are set with red vertex paint. Hot pink vertex paint counterbalances the physics.
You may need to delete the cloth mesh your mesh imported with as it can cause to export badly.
Here is a tutorial about how to add physics to your mesh by ReallyLazyIcarus.
https://www.nexusmods.com/baldursgate3/articles/311
Some people have had success pasting the code from in game meshes into their code, specifically clothbuffer values, which caused the physics to be less flappy. Which is worth a try if you have a lot of patience and experience with coding.  
Some people have had success pasting the code from in game meshes into their code, specifically clothbuffer values, which caused the physics to be less flappy. Which is worth a try if you have a lot of patience and experience with coding.  
If you learn anything new, add it here!
If you learn anything new, add it here!


==Lods and Load Order==
==Lods and Load Order==
Padme’s addons
[https://www.youtube.com/watch?v=5TpdCBxYO1Q Here is a video of Padme’s addons being used]
https://www.youtube.com/watch?v=5TpdCBxYO1Q


Using Padme’s addon tool, click the button to generate LOD and you will have your nice set of LODs.
Using Padme’s addon tool, click the button to generate LOD and you will have your nice set of LODs.
You may need to edit the LOD0 it’s a new mesh as it won't know what settings a should have.
You may need to edit the LOD0 it’s a new mesh as it won't know what settings a should have.


'''LOD Level''' is what level of LOD it is. Meshes generally have no more than 4-5 LODS, usually depending on how 'common' an asset it is. (A common peasant shirt will have many LODS while an armour intended only for the player may have only 1 LOD.)
'''-LOD Level''' is what level of LOD it is. Meshes generally have no more than 4-5 LODS, usually depending on how 'common' an asset it is. (A common peasant shirt will have many LODS while an armour intended only for the player may have only 1 LOD.)
'''-Lod Distance is the distance from which your mesh swaps to the next LOD.''' For this reason your high quality should probably be something like 9-15 metres, while your last LOD always needs to be set to 0. If you don’t particularly care about it performing well on bad computers, you can have no LOD and just set your high quality mesh to have a Lod distance of 0.
 
'''-Export order.''' Generally all your LOD0 meshes go first, then your LOD1, LOD2, LOD3, assuming you have multiple LOD0 meshes. Look at imported game meshes for reference. If there is not a consistent export order, the mesh will refuse to export. If you get this wrong in the code some meshes may end up with the wrong material assigned to them, but no other consequences.
'''-Lod Distance''' is the distance from which your mesh swaps to the next LOD. For this reason, your highest quality mesh should probably be something like 9-15 metres, your middle ones 15-20, whatever else, while your last LOD always needs to be set to 0. If you don’t particularly care about it performing well on bad computers, you can have no LOD and just set your high quality mesh to have a Lod distance of 0.
 
'''-Export order.''' Generally all your LOD0 meshes go first, then your LOD1, LOD2, LOD3, assuming you have multiple LOD0 meshes. Look at imported game meshes for reference. If there is not a consistent 1, 2, 3, 4, export order, the mesh will refuse to export.  
 
If you get this wrong in the code some meshes may end up with the wrong material assigned to them, but no other consequences.


==Exporting==
==Exporting==
Remember to set all of your mesh to the same material in Blender, or ideally delete all materials assigned to the mesh before exporting, or some parts of the outfit may not show up in the game.
Remember to set all of your mesh to the same material in Blender, or ideally delete all materials assigned to the mesh before exporting, or some parts of the outfit may not show up in the game.
Default export settings are fine to use.
Default export settings are fine to use.
Remember to save as '''.GR2''' and use that in all your code, the game is very concerned with capitalisation.
Remember to save as '''.GR2''' and use that in all your code, the game is very concerned with capitalisation.
Your mesh will export x-mirrored. Meshes import in from the multitool x-mirrored, so they are the right way around now!
Your mesh will export x-mirrored. Meshes import in from the multitool x-mirrored, so they are the right way around now!


Line 68: Line 81:


==Hotloading==
==Hotloading==
It is not only possible but very recommended to hotload meshes, it enables you to fix them in action. [[Modding:Hotloading See here for how.]]
It is not only possible but very recommended to hotload meshes, it enables you to fix them in action. [[Modding:Hotloading|See here for how.]]

Navigation menu