IntroductionBy default, when compiling a model for the Source engine, if a vertex has a link to a bone with a "weight" below 0.05 (5%), that bone is ignored for that vertex.
For very high-poly and/or smooth models, this can result in rigging that might look a little rough or broken when moving bones around. (See the animated gif down below for an example.)
Fortunately, it's possible to "hack" StudioMDL to change that value from below 0.05 to below almost nothing, giving you as much freedom with the rigging as you want (as long as you stay within the 3-bone limit per vertex, which unfortunately can not be hacked in the same way).
I do not claim to have found out about the fix for it myself at all. Who discovered it (at least this time, not sure if it has been discovered in the past) says I don't have to credit them for it. I still won't claim the discovery as my own, however.
Note that this tutorial will not benefit people who don't make/port models themselves! Also note that if you share a resulting model, other people do not have to do this themselves to use the model properly.
Requirements- The Source Filmmaker (or potentially another Source engine program coming with a StudioMDL, but then you're on your own)
- A hex editor (I'll be using HxD, but you may be better off with a more modern tool)
InstructionsWhat you want to do first of all is finding StudioMDL. Right-click Source Filmmaker in your Steam library, choose Properties > Local Files > Browse Local Files..., and then navigate into the game > bin folder. You should be able to find studiomdl.exe inside this folder.
Now, make sure to make a backup of studiomdl.exe, since you'll be editing it, and you might make mistakes. I do not take responsibility if anything breaks from you trying to do this!
After you've made a backup, open up studiomdl.exe in your hex editor of choice. Now go to offset 0x5BE020. The next 8 bytes should be "9A 99 99 99 - 99 99 A9 3F" (a Little-Endian representation of 0.05 as a 64-bit float ("Double") value), immediately followed by "54".
Change those 8 bytes to "01 00 00 00 - 00 00 00 00" (make sure to not change the "54"!). This value is a (Little-Endian) representation of the smallest possible positive number you can use here, besides 0. (Simply using a value of 0 can cause a few issues. Just trust the value I'm showing.) Save it, and... now you're done!
(Please note that the offset to edit and possibly also the value to edit will be different for different versions of StudioMDL.)
Here are two screenshots of the hex editing:
Result ExampleHere's a gif of before and after doing this. Credit goes to Steam user Marco Skoll for supplying it. Don't mind the fact that it's from Blender, the end result in the Source engine is the exact same.
The blue-ish coloured mesh is from before doing the StudioMDL edit, and the pink-ish coloured mesh is from after doing it. The object in question is the collar/shoulder of a humanoid character, being moved upwards through bone movement.
Disclaimer: This is relatively untested. If you encounter any issues, please let me know about them in the comments section.