<?xml version="1.0"?>
<rss version="2.0"><channel><title/><link>https://www.loverslab.com/blogs/blog/2168-mixis-mod-mayhem/</link><description><![CDATA[<p>
	Just some notes on the modding I've been doing.
</p>
]]></description><language>en</language><item><title><![CDATA[Converting Skyrim Outfits to Blade & Sorcery NPCs]]></title><link>https://www.loverslab.com/blogs/entry/19827-converting-skyrim-outfits-to-blade-sorcery-npcs/</link><description><![CDATA[<div>
	People are sleeping on modding this game. Here's how you can bring your favorite Skyrim stuff over to play with.
</div>

<p>
	 
</p>

<div style="font-size:15px;">
	What you need:
</div>

<ul>
	<li style="font-size:15px;">
		The latest Blender - <a href="https://www.blender.org/download/" rel="external nofollow">https://www.blender.org/download/</a>
	</li>
	<li style="font-size:15px;">
		The NIF plugin for it - <a href="https://github.com/niftools/blender_niftools_addon" rel="external nofollow">https://github.com/niftools/blender_niftools_addon</a>
	</li>
	<li style="font-size:15px;">
		A skeleton to work off of. I'm using this one - <a href="https://www.nexusmods.com/skyrim/mods/98111" rel="external nofollow">https://www.nexusmods.com/skyrim/mods/98111</a>
	</li>
	<li style="font-size:15px;">
		A texture editor of some sort. In this tutorial I'll be using chaiNNer to do my texture conversion - <a href="https://github.com/chaiNNer-org/chaiNNer" rel="external nofollow">https://github.com/chaiNNer-org/chaiNNer</a>
	</li>
	<li style="font-size:15px;">
		and a little bit of Krita for editing -https://krita.org/en/
	</li>
	<li style="font-size:15px;">
		The BaS SDK - <a href="https://github.com/KospY/BasSDK/" rel="external nofollow">https://github.com/KospY/BasSDK/</a>
	</li>
	<li style="font-size:15px;">
		Unity Hub - <a href="https://unity.com/unity-hub" rel="external nofollow">https://unity.com/unity-hub</a>
	</li>
	<li style="font-size:15px;">
		My BaS NPC script for Unity - <a href="https://www.nexusmods.com/bladeandsorcery/mods/9146" rel="external nofollow">https://www.nexusmods.com/bladeandsorcery/mods/9146</a>
	</li>
	<li style="font-size:15px;">
		An outfit mod you want to make into an enemy or avatar. You can certainly bring over weapons as well, but the offical wiki covers how to make those already.
	</li>
</ul>

<p>
	 
</p>

<div style="font-size:15px;">
	Install all that mess. Open up the skeleton file, and import all the pieces you want to make into an NPC. Here I'll be using an older mod I made myself, plus the body pieces and skin textures it requires.
</div>

<div>
	 
</div>

<p>
	<a class="ipsAttachLink ipsAttachLink_image" data-fileext="png" data-fileid="1811920" href="https://www.loverslab.com/uploads/monthly_2023_09/image.png.9f000935b17c0105757ca7d0be22c521.png" rel=""><img alt="image.thumb.png.3ddad439cf3cb2b7087a605868f9b7ee.png" class="ipsImage ipsImage_thumbnailed" data-fileid="1811920" data-ratio="54.37" width="1920" src="https://www.loverslab.com/uploads/monthly_2023_09/image.thumb.png.3ddad439cf3cb2b7087a605868f9b7ee.png" /></a>
</p>

<p>
	 
</p>

<div style="font-size:15px;">
	Note that multiple armatures come in while doing this, since each NIF contains the bones that mesh requires. What I'm going to do is rename the full one to "Rig" (important for the Unity script later) and attach everything to that skeleton, making sure to apply all transforms as I go.
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	You want your model to be human scale in Blender and facing the negative Y.
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	I'm also gonig to lift up my character and move the toe bones down, since she's wearing heels. In Skyrim this had to be corrected via a mod at runtime, but here we want to adjust the skeleton.
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	It's very important to rotate the head bone so it points up, not forward.
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	While we're adjusting the skeleton, we need to make sure we have bones for every part of the unity humanoid, even if we're not using them. And in fact, as of this writing we should make sure not to skin anything to the eye bones. There's a bug with them on custom NPCs that causes the face to collapse, so for now we're just going to make sure our head is fully rigged to the head and jaw bones. For the skeleton I'm using in this tutorial, I have to add two eye bones and a jaw bone.
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	We also need to sanitize the bone roll of the skeleton to match what BaS expects. Turn on bone axes in Viewport Display for the armature, then roll the bones so the Z axis is forward for everything. Roll the hands, hips, spine, and head bones 180 degrees.
</div>

<div style="font-size:15px;">
	 
</div>

<div>
	<a class="ipsAttachLink ipsAttachLink_image" data-fileext="png" data-fileid="1811921" href="https://www.loverslab.com/uploads/monthly_2023_09/image.png.92fb43411b45d8b104c1c92cadb7cf4e.png" rel=""><img alt="image.thumb.png.bdc131466d843d6435137c54ad098691.png" class="ipsImage ipsImage_thumbnailed" data-fileid="1811921" data-ratio="54.37" width="1920" src="https://www.loverslab.com/uploads/monthly_2023_09/image.thumb.png.bdc131466d843d6435137c54ad098691.png" /></a>
</div>

<p>
	 
</p>

<div style="font-size:15px;">
	One of the things BaS lets us do is assign material types per mesh or with an ID map. ID maps are more performant (More individual meshes = more draw calls) but for a quick and easy way to separate materials, you can split them up in Blender.
</div>

<p>
	 
</p>

<div style="font-size:15px;">
	Next up, we need to convert the textures from Skyrim's format to one the BaS shader likes. The BaS shader takes a base color, a normal map, and then a mask texture that's split up like this:
</div>

<div style="font-size:15px;">
	 
</div>

<ul>
	<li style="font-size:15px;">
		Red: Metallic
	</li>
	<li style="font-size:15px;">
		Green: Occlusion strength
	</li>
	<li style="font-size:15px;">
		Blue: Emission mask
	</li>
	<li style="font-size:15px;">
		Alpha: Smoothness
	</li>
</ul>

<p style="font-size:15px;">
	 
</p>

<div style="font-size:15px;">
	In Skyrim the metallic map is in the alpha channel of the normal map, so I'm going to use chaiNNer to extract that and put it in the new texture, along with a 50% occlusion strength, black emission mask, and as a quick kludge for the purposes of this conversion, reuse the metal map as my smoothness map. For a high quality result, go ahead and make a proper smoothness map.
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	It's also important to convert everything from Skyrim's DDS settings to PNG, otherwise they import into Unity upside down. Just Unity things I guess.
</div>

<div style="font-size:15px;">
	 
</div>

<div>
	<a class="ipsAttachLink ipsAttachLink_image" data-fileext="png" data-fileid="1811524" href="https://www.loverslab.com/uploads/monthly_2023_09/image.png.fd0b588524d0d0f60e438bbb3b8ae4b5.png" rel=""><img alt="image.thumb.png.f7b524d63e9e22bba30cafc6ba4c1c31.png" class="ipsImage ipsImage_thumbnailed" data-fileid="1811524" data-ratio="54.37" width="1920" src="https://www.loverslab.com/uploads/monthly_2023_09/image.thumb.png.f7b524d63e9e22bba30cafc6ba4c1c31.png" /></a>
</div>

<p>
	 
</p>

<div style="font-size:15px;">
	Skyrim skin base color textures are very dark due to the shader they use, so I take them into Krita and adjust the color curves until they're the tone I want.
</div>

<p>
	 
</p>

<div style="font-size:15px;">
	Before we export double check that your mesh is scaled correctly, facing negative Y, and has all its transforms applied. Then export with these settings:
</div>

<p>
	 
</p>

<div>
	<img alt="image.png.f6913d913c9986c1def3bfbefa81b924.png" class="ipsImage ipsImage_thumbnailed" data-fileid="1811525" data-ratio="321.89" width="233" src="https://www.loverslab.com/uploads/monthly_2023_09/image.png.f6913d913c9986c1def3bfbefa81b924.png" />
</div>

<div>
	 
</div>

<div style="font-size:15px;">
	Pay close attention to the axis settings here. If they aren't exported like that, all your bones will be rotated wrong and you'll have a bad day. If your model comes out looking like jelly, this is probably what you skipped.
</div>

<p>
	 
</p>

<div style="font-size:15px;">
	Open up Unity Hub, load the BaS SDK, and make yourself a new folder to work in. Import all your textures and FBX file. On the model, make sure Read/Write is set (or dismemberment will glitch out) and set up your humanoid rig. You'll need to assign some of those dummy bones like the eyes.
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	Set up your materials. Make them ThunderRoad/Lit. Use the textures we converted in chaiNNer. Set the occlusion slider to .5. For anything that's going to get damage decals, enable Reveal Layers and auto-fill them.
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	Make a material to use to fill in cut body parts as well. If you don't have anything appropriately gory on hand, just a flat red standard material works.
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	Once that's all set up, drop your character into an empty scene. Unpack the prefab completely. Drop the NPC helper script onto its root. Type in a name and assign the cut fill material in the script component. Click on the little menu dots in the upper right of the component and select Create BAS NPC.
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	<a class="ipsAttachLink ipsAttachLink_image" data-fileext="png" data-fileid="1811924" href="https://www.loverslab.com/uploads/monthly_2023_09/image.png.ac904fc560ed3533d5e47d6268c92353.png" rel=""><img alt="image.thumb.png.5ef36d5ff63480878e1cf5ccc4a453d1.png" class="ipsImage ipsImage_thumbnailed" data-fileid="1811924" data-ratio="54.37" width="1920" src="https://www.loverslab.com/uploads/monthly_2023_09/image.thumb.png.5ef36d5ff63480878e1cf5ccc4a453d1.png" /></a>
</div>

<div>
	 
</div>

<div style="font-size:15px;">
	If it worked, examining the character should give you something like this:
</div>

<div style="font-size:15px;">
	 
</div>

<div>
	<a class="ipsAttachLink ipsAttachLink_image" data-fileext="png" data-fileid="1811925" href="https://www.loverslab.com/uploads/monthly_2023_09/image.png.35901048c030416c4207faf7af476964.png" rel=""><img alt="image.thumb.png.ec0ff62c1fc8fde99aada9ce9f661849.png" class="ipsImage ipsImage_thumbnailed" data-fileid="1811925" data-ratio="54.37" width="1920" src="https://www.loverslab.com/uploads/monthly_2023_09/image.thumb.png.ec0ff62c1fc8fde99aada9ce9f661849.png" /></a>
</div>

<div>
	 
</div>

<div style="font-size:15px;">
	Under the Mesh group, click on each part and if it needs to show damage, give it a Reveal Decal component. If it's something other than flesh, give it a Mesh Part component and set the mesh and physic material. Note that the material does affect gameplay! Set your armor mesh to Metal and it's going to deflect blows.
</div>

<p>
	 
</p>

<div style="font-size:15px;">
	With that done, open up the ragdoll parts and examine each one. Underneath each part is a collider group. Adjust these colliders to fit your model as best you can. Duplicate or add more to the group as needed. You can assign physic materials to the colliders as well, if you want them to override the underlying mesh settings.
</div>

<p>
	 
</p>

<div style="font-size:15px;">
	If you have colliders that greatly intersect, click on the ragdoll part, and drag the other offending ragdoll part into the Ignored Parts list. If your character is jittering when ragdolling in game, it's probably because you need to do this.
</div>

<p>
	 
</p>

<div style="font-size:15px;">
	With all those edits done, drag the character from the hierarchy to the asset browser to make a prefab. Make that prefab addressable, make an addressable group for your mod, set the folder name and manifest info, then use the ThunderRoad SDK menu to build the bundle. Export it and you should now have a mod folder under \Steam\steamapps\common\Blade &amp; Sorcery\BladeAndSorcery_Data\StreamingAssets\Mods\
</div>

<p>
	 
</p>

<div style="font-size:15px;">
	Open up your Steam folder and find Blade &amp; Sorcery\BladeAndSorcery_Data\StreamingAssets\Default\bas.jsondb. Extract this somewhere safe with your favorite archive program. Into your mod folder, copy Creature_HumanFemale.json and rename it something relevant to your mod. Open it up, and change the id to the name you gave the character when you ran the script, and set prefabaAddress to the address you gave it after you were done. There are some things you can tweak in here, but that's all you need to do to get it working for now.
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	<strong>It is currently vital that you set the pooling maximum to 0. If you allow it to pool your NPCs and they are dismembered, they will respawn with invisible parts. I've reached out to WF about this bug already.</strong>
</div>

<p>
	 
</p>

<div style="font-size:15px;">
	Make a new file named something like CreatureTable_MyNPC and add this:
</div>

<p>
	 
</p>

<pre class="ipsCode">{

  "$type": "ThunderRoad.CreatureTable, ThunderRoad",

  "id": "DemoGirlTable",

  "saveFolder": "bas",

  "version": 1,

  "description": null,

  "linkedToGenderRatio": false,

  "minMaxDifficulty": {

    "x": 0,

    "y": 3

  },

  "drops": [

    {

      "$type": "ThunderRoad.CreatureTable+Drop, ThunderRoad",

      "reference": "Creature",

      "referenceID": "DemoGirl",

      "overrideFaction": false,

      "factionID": 0,

      "overrideContainer": false,

      "overrideContainerID": "",

      "overrideBrain": false,

      "overrideBrainID": "",

      "probabilityWeights": [85, 85, 85, 85, 85]

    }

  ]

}</pre>

<p>
	 
</p>

<div style="font-size:15px;">
	And another file named Wave_MyNPC:
</div>

<pre class="ipsCode">{

  "$type": "ThunderRoad.WaveData, ThunderRoad",

  "id": "DemoGirl3",

  "sensitiveContent": "None",

  "sensitiveFilterBehaviour": "Discard",

  "version": 2,

  "category": "Mixi",

  "localizationId": "DemoGirl3",

  "title": "DemoGirl 1v3",

  "description": "Bwee!",

  "loopBehavior": "LoopSeamless",

  "totalMaxAlive": 3,

  "alwaysAvailable": false,

  "waveSelectors": ["Arena", "Ruins", "Market", "Canyon", "Citadel"],

  "playerHealthMultiplier": 1.0,

  "enemiesHealthMultiplier": 1.0,

  "factions": [

    {

      "$type": "ThunderRoad.WaveData+WaveFaction, ThunderRoad",

      "factionID": 3,

      "factionHealthMultiplier": 1.0,

      "factionMaxAlive": 3

    }

  ],

  "groups": [

    {

      "$type": "ThunderRoad.WaveData+Group, ThunderRoad",

      "reference": "Table",

      "referenceID": "DemoGirlTable",

      "overrideFaction": false,

      "factionID": 0,

      "overrideContainer": false,

      "overrideContainerID": "",

      "overrideBrain": false,

      "overrideBrainID": "",

      "overrideMaxMelee": true,

      "overrideMaxMeleeCount": 2,

      "groupHealthMultiplier": 1.0,

      "minMaxCount": {

        "x": 20,

        "y": 20

      },

      "spawnPointIndex": -1,

      "prereqGroupIndex": -1,

      "prereqMaxRemainingAlive": 0

    }

  ]

}</pre>

<p>
	 
</p>

<div style="font-size:15px;">
	Save all that and run the game. Now in the spawn book, there should be a new category with your new NPC wave in it.
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	<a class="ipsAttachLink ipsAttachLink_image" data-fileext="jpeg" data-fileid="1811926" href="https://www.loverslab.com/uploads/monthly_2023_09/image.jpeg.7c1f39766fb63659fd327848e7a20c7f.jpeg" rel=""><img alt="image.thumb.jpeg.aaeadca3accde4b3e8b00a3359d43229.jpeg" class="ipsImage ipsImage_thumbnailed" data-fileid="1811926" data-ratio="56.25" width="1920" src="https://www.loverslab.com/uploads/monthly_2023_09/image.thumb.jpeg.aaeadca3accde4b3e8b00a3359d43229.jpeg" /></a>
</div>

<div style="font-size:15px;">
	 
</div>

<div style="font-size:15px;">
	Go and enjoy some perfectly normal mediaeval fantasy combat. 
</div>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>

<p>
	 
</p>
]]></description><guid isPermaLink="false">19827</guid><pubDate>Thu, 14 Sep 2023 00:22:32 +0000</pubDate></item></channel></rss>
