Spoiler tag

Thursday, July 18, 2019

JSRF ModTool 2.4 - And character model importing

Hey there, here's the new version of the tool that can import models of the type named "MDLB" (characters and objects).




For learning the basics on how to use the tool, see this post and also this post

While its now possible to import models, keep in mind if you want to do so you will need to have some 3D modelling, uv mapping and rigging skills if you want to make a brand new character and import it.

Therefore this is not going to be a tutorial on how to do 3D modelling as that's a separate gigantic topic, you can find various 3D modelling apps and tutorials online, you might however be able to try doing simple edits on models like changing proportions of the body if you follow this example.



Three new buttons have been added to the top right of the model viewer to import/export models.
The JSRF ModTool will export and import models as .SMD model file format.


The "Collapse vertices" button will move all the model's points to the origin position (0 0 0) making the model invisible, this can be useful to hide parts of the original model such as the different facial expressions the game switches through as the character is animated.
If you don't want to bother making separate models for each facial expression, you can have the body and head model all contained in the first imported MDLB and then you could just make all the other original head models invisible by using the "Collapse vertices" button.


As for the tiny buttons "Expt." and "Impt." they let you export or import the selected item(block of data) as a binary file if you want to take a look with a hexadecimal editor to mod some particular data manually.



Anatomy of a JSRF character .dat file

Here's how playable character models are organized in the .dat file






                          Exporting a model

Just select an MDLB item and click "Extract MDL", it will let you select a folder where you want the model to be exported as .smd files, give it a name and click Save.

The tool also exports the lower level parts of the model which have to have the same naming as the main model so when importing the tool can find the lower parts of the model to import as well to rebuild the model properly.






Using Blender (2.79) to edit a model

Since the JSRF ModTool exports the models in .smd file format, for Blender you will need the Source Tools here  to import the model(s).
Installation instructions for the plugin are on this page

Once the plugin is installed and enabled you should be able to import .smd files by going into the menu File > Import > Source Engine



In this example I am going to make a small edit to the body of Beat, which I exported as "beat_body.smd"

First thing you'll notice is you need to rotate the model 90 degrees on the X axis.
Also note that the models comes inverted on the X axis, unfortunately I don't have the math/trigonometry etc knowledge and skills to code something so the JSRF Tool would sort these issues,luckily you won't need to turn it front 90 degrees again as the SMD exoprting tool can manage that for you.







Unfortunately with the SMD file format I haven't searched a way to have the models export with its texture(s), so you'll need to export them, select a texture and click "Edit texture", the texture will be extracted in the JSRF ModTool folder "resources\tmp"
Then assign the texture(s) manually in blender.


Made some edits to the model here:



Since I am barely familiar with blender, I just make some simple edits for demonstration, making his skates tubes ridiculously long and his shoulder spikes longer.

Once you are done with your edits, go to the top right panel where you see the list of the objects in the scene, right click on "beat_body_skeleton" and "Selected Hierarchy"







Blender and SMD export settings


Now before exporting we need to setup a few things in the Source Engine export panel.

Click on the  third button highlighted by the red circle, to display the
Source Engine export panel with which we can export the model back to SMD format.


Under "Source Engine Export" there's a few things to setup.

1-Set the export path, to the folder where you extracted the models (same folder where you extracted with the JSRF Tool)

2-Set the export format to SMD

3-Set the Target Up axis to Y


4-Now click the "Export" button, that's it!


Importing a model on the JSRF ModTool

Go back to the JSRf ModTool and with the original MDLB selected click  "Import MDL"
Select the first model on the list, in my case "beat_body.smd" and click Open.

This window should show up if there are no errors with the model files.
The lower level models (p_0 p_1 p_2) should be also loaded automatically if the naming is as on this example.



There are many settings here that you'll most likely never will need to modify but I am going to explain them anyways:

-Vertex definition size: size of the block of data defining a vertex(point) and other properties depending on the size, such as UV, Normals, sekeleton/bone ID,
bone deformation factor etc

-Global draw distance
: distance at which the model disappears (for performance optimization)




Materials

A JSRF player model usually has multiple materials/shaders that define the shading style.

Your model's materials groups should be named "mat_" and the corresponding number you want the material to be.

You can change the color and transparency of the material with the RGBA values, though this might depend on the type of "Material ID", this seems to be mostly used on models for the menus where they used a flat/solid color, and so the RGBA seems to work mainly on materials types dedicated to menu/UI models.


Material ID: this defines the type of shading for this material group (mat_0), there are many many more material IDs in other models that will show up as a number since I haven't researched them all to give them a name.

Float: this is an unknown parameter, it rarely changes, if you figure out what it does, don't hesitate to post in the comments.

You can remove materials by clicking the [x] box on the top right, and add materials from the button on the top right.



Importing

Now that all is setup click "Import", if everything about the model is properly setup it should import without giving any error messages.

Please note that JSRF models are limited to 2 deformers(bones) per vertex


There's the modified model imported, recompiled and ready for the game. 

And there it is ingame.


Some info and tips for full custom character mods

 You must keep the original bone hierarchy, modifying it or replacing it might cause animations to get messed up or even cause a crash.

If you're going to rig a different model, a new model, or ported mesh from some other game, note that you can move the bones around quite a bit(if the proportions differ from the JSRF's original character model) and the game engine will tolerate and will compensate for it anyways, so you can make a character shorter or taller moving bones around.

As you might notice, the exported character model's bones do not have a rotation, they are set to 0 0 0, it seems the rotation is completely dependent and applied by the animation data(which I haven't reverse engineered), some animations seem to be shared between characters and they all share the same or very similar rig(bone hierarchy and placement).



Well, I think that's more or less all there is to it, if you have any questions don't hesitate to ask in the comments.

Cheers