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 17: Line 17:
You should at least extract [[Modding:Body Models|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 [[Modding:Body Models|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. [[File:MeshImportsWithLODSS.webp|thumb|A mesh importing. It has only 1 Lod.]]'''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.
When you have found a 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. [[File:MeshImportsWithLODSS.webp|thumb|A mesh importing. It has only 1 Lod.]]'''You generally cannot import a modded-in mesh without the plugin crashing Blender.''' Hopefully you 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.


==Importing==
==Importing==
It will be a fairly standard rig with an Armature modifier (see Modifier tab).Your armatures will import in at 90 degrees. This will cause it to export flat to the floor and follow a naked character around like a weird windsock, so you need to fix it. '''[Object Mode] Object > Apply> All Transforms''' on the armature, until the coordinates for its location all read '''0, 0, 0'''. You may need to do the same thing on the mesh as well.
It will be a fairly standard rig with an Armature modifier (see Modifier tab).
 
Your armatures will import in at 90 degrees. This will cause it to export flat to the floor and follow a naked character around like a weird sad windsock, so you need to fix it.  
 
'''[Object Mode] Object > Apply> All Transforms''' on the armature, until the coordinates for its location all read '''0, 0, 0'''. You may need to do the same thing on the meshes as well.
[[File:UrMeshImported90.webp|thumb|Your mesh will likely import this way- note 90 degree angle.|276x276px]]
[[File:UrMeshImported90.webp|thumb|Your mesh will likely import this way- note 90 degree angle.|276x276px]]
The mesh will import in with 1 or more LODS. These are level of detail meshes, intended to be viewed at a distance so they are lower poly. You only need the best quality one as we are making new LODs later, so delete anything that has LOD in the name.
The mesh will import in with 1 or more LODS. These are level of detail meshes, intended to be viewed at a distance so they are lower poly. You only need the best quality one as we are making new LODs later, so delete anything that has LOD in the name.
Line 56: Line 60:
== How to Vertex Paint Sleeves and Pant Legs ==
== How to Vertex Paint Sleeves and Pant Legs ==
If you handpaint vertex paint on your own meshes, the mesh will often glitch. You may need to use this method to make it work.
If you handpaint vertex paint on your own meshes, the mesh will often glitch. You may need to use this method to make it work.




Line 73: Line 76:
==Fixing meshes that import in wrong==
==Fixing meshes that import in wrong==
[[File:BlenderTutAlfiraBustedNormals.webp|thumb|203x203px|Fixing Meshes that import in wrong: Sometimes the normals of skirts import this way- unusable in game.]]
[[File:BlenderTutAlfiraBustedNormals.webp|thumb|203x203px|Fixing Meshes that import in wrong: Sometimes the normals of skirts import this way- unusable in game.]]
Sometimes meshes will import in with broken shading and stuck together, usually on skirt meshes. This is because the verts were too close together and the importer made a hiccup. This is often an issue with the normals as well.
Sometimes meshes will import in with broken shading and stuck together, usually on skirt meshes. This is because the verts were too close together and the importer couldn't interpret it. This is often an issue with the normals as well.


[https://www.youtube.com/watch?v=NCDGhz3RSr8 See this video] for how to fix meshes that import in with messed up normals like a blue/red checkerboard, and export looking like see through checkerboards.   
[https://www.youtube.com/watch?v=NCDGhz3RSr8 See this video] for how to fix meshes that import in with messed up normals and export looking like see through checkerboards.   


You can also fix with '''[Edit Mode] Mesh> Clean Up> Merge By Distance''', and then put a solidify modifier at 00.1 thickness.
You can also fix with '''[Edit Mode] Mesh> Clean Up> Merge By Distance''', and then put a solidify modifier at 00.1 thickness.
[[File:How2ViewFaceorientationoverlay.webp|thumb|291x291px|How to view face orientation overlay on Blender. Blue is outside, red is inside. Red will be invisible in-game, unless you set up a 2 sided shader in your LSX code later.]]
[[File:How2ViewFaceorientationoverlay.webp|thumb|291x291px|How to view face orientation overlay on Blender. Blue is outside, red is inside. Red will be invisible in-game, unless you set up a 2 sided shader in your LSX code later.]]
==Physics==
==Physics==
Unfortunately physics are not quite at game export quality yet at this stage.
Unfortunately physics are not quite at game quality yet at this stage.


Physics are set with red vertex paint. Hot pink vertex paint counterbalances the physics.
Physics are set with red vertex paint. Hot pink vertex paint counterbalances the physics.
Line 88: Line 91:
[https://www.nexusmods.com/baldursgate3/articles/311 Here is a tutorial about how to add physics to your mesh by ReallyLazyIcarus.]
[https://www.nexusmods.com/baldursgate3/articles/311 Here is a tutorial about how to add physics to your mesh by ReallyLazyIcarus.]


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 and enabled the collider mesh to be exported without issues. 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 lsx mesh code, specifically clothbuffer values, which caused the physics to be less flappy and enabled the collider mesh to be exported without issues. Which is worth a try if you have a lot of patience and experience with coding.  
[[File:ScreenyExampleOfPhysicsMesh.webp|thumb|134x134px|Example of red vertex paint for Physics. (Daisy Dress Mesh)]]
[[File:ScreenyExampleOfPhysicsMesh.webp|thumb|134x134px|Example of red vertex paint for Physics. (Daisy Dress Mesh)]]
If you learn anything new, add it here!
If you learn anything new, add it here!
Line 98: Line 101:
[[File:Screenshot LOD Distance level Explained.webp|thumb|LOD order in BG3 settings. You can find this in your Object/Object Properties tab.]]
[[File:Screenshot LOD Distance level Explained.webp|thumb|LOD order in BG3 settings. You can find this in your Object/Object Properties tab.]]


'''-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. LOD0 is the best quality, cutscene one. 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 or important NPC may have only 1 LOD.)
 
'''-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, while your last LOD always needs to be set to 0. Or it will vanish from a distance. There are certain cutscenes in Act 3 and elsewhere where your player character is seen from a very long distance, so this is important!


'''-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.
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.  
'''-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.
If you get the export order wrong in the code, some meshes may end up with the wrong material assigned to them.


==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 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. See here for an example.


Remember to save as '''.GR2''' and use that in all your code, the game is very concerned with capitalisation.
Remember to save as '''.GR2''' not .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!


If you parented your mesh to the nude body armature, remember to delete the nude body!
If you parented your mesh to the nude body armature, remember to delete the nude body before exporting it!
[[File:BlenderTtut3.6ExportSettings.webp|thumb|Default export settings for Blender 3.6|445x445px]]
[[File:BlenderTtut3.6ExportSettings.webp|thumb|Default export settings for Blender 3.6|445x445px]]


Navigation menu