veryfancypants / hs2_blender_export

35 stars 4 forks source link

This is a Blender add-on that allows you to import HS2/AI characters and to manipulate them.

FEATURES

STEP BY STEP INSTRUCTIONS

INSTALLATION

Blender 4 is required (4.0.2 is known to work).

Download the project as a ZIP. In Blender, go to Edit -> Preferences -> Add-ons -> Install ..., select the downloaded package, install and enable it. You will see a 'HS2Rig' tab on the right side of the 3D viewport window.

CHARACTER EXPORT/IMPORT

Install Grey's MeshExporter. (It comes as 'optional' with HS2 BetterRepack.)

Launch Studio Neo. Load the character. Put it in T-pose. If it is a female, remove high-heel shoes (they are known to interfere with export). Turn off blinking (Anim -> Kinematics -> Face).

Hit F1, find Runtime Unity Editor, bind a key to open it.

Use MeshExporter to export everything. Do ask for converted bump maps. Don't ask to pack png's into the fbx.

Hit the key for Runtime Unity Editor. In the "Scene Unity Editor", find the node called "Common Space". Inside it, there's a node called "ChaF_001" or something similar. Select that one and hit 'dump'. Save it in the same folder where MeshExporter put the fbx (it is typically called something like "\Export\20221213104852_Kazumi"), make sure to give it the '.txt' extension.

studio_neo_export.jpg Return to Blender. Click on "Import new dump" in the HS2Rig tab and select the folder containing the dump.

Import

Wait for it to complete (it may take a while.)

If the process is successful, several new controls will appear, including hair color and eye color settings and a few posing controls.

The character can then be customized / fine-tuned in a number of ways:

Import 2

Skin detail ("alternate skin" on, base skin gloss 0.3, pore_depth 2.0, pore_intensity 2.0)

You will also see an "Add as a new preset" button, which will save the information about the imported character, including the path, hair/eye colors, shape customizations, and some material customizations, into a permanent config file. This character could then be reloaded by selecting it in the "presets" drop box and clicking "Load preset character".

TROUBLESHOOTING

Double check that the dump directory contains everything it should (there should be a .fbx, a text file, and a subdirectory called "Textures".) If everything is in order, you've probably encountered a bug in the importer. If a major failure occurs, the script will report the error in the "HS2 rig" panel. Detailed information will be printed in the system console.

May have a few different causes. One possibility is that the Unity dump is wrong (it is for the wrong character, or you've exported the wrong node). It also occurs when importing a character wearing high heels. Remove the shoes and retry. (Most shoes are okay, though. As a general rule, if the character moves up/down when you toggle 'shoes' in Studio Neo, we're going to have trouble.)

To import male characters, you may need to turn off their injectors. If you don't, the injector texture may overwrite the main body texture. (Even if this problem does not occur, the importer currently does not texture them correctly. It may be safer to export the character without an injector; the importer can attach a standard version.)

Something went wrong with bump mapping. Disable by editing the torso material and setting both bump map levels to 0.

Either something went wrong with bump mapping (as above, set levels to 0 on the torso and the head); or the script failed to delete some extraneous bits of mesh inside the character's neck. Look inside the neck. If there's a ring of faces sticking out (or rather, in), delete it.

This is probably a bug in Studio Neo (you may notice that the character has low-quality teeth there too.) Use MeshExporter to dump the character directly out of the game (you won't be able to do the whole process, since you can't put the character in T-pose, but you can at least get the fbx).

This happens when one pair is drawn in the head texture and the other pair is overlayed by the shader. Go to head material shader settings and set "Eyebrow scale" to 0.

This is the expected outcome if the script is unable to figure out how to excise the "original" body part. In particular, this is expected to happen if "HighPoly" uncensor is in use. Manually cut out the duplicate mesh and sew on the remaining copy.

Switch the material of the clothing item from 'Alpha Clip' to 'Alpha Blend'.

TUNING

To pose or reshape the character, go to "pose mode" on the armature, select layers, then select bones and rotate them with the mouse (click 'r' to go into rotation mode) or directly from the item transform window (top right corner of the 3D view panel).

Shape changes can be committed into the preset by clicking on "Save shape to preset". This only updates the preset in memory; you'll need to click "Save presets" to commit the changes into the preset file (otherwise, changes will be lost when you close Blender.) "Save presets" also commits material settings (such as eyebrow scale) for the currently selected character only.

The preferred way to control the face is to use shape keys. "Body", "object mode", "object data properties" (green triangle in the properties panel), "shape keys" window. E.g., to open the character's mouth, set k09_open1 to 1.0. Most names are in Japanese. "Warai" - laughing, "Kanasimi" - sad, "ikari" - angry, "fukure" - bulge(?), "damage" - hurt, "fera" - blow, "sitadasi" - sticking the tongue out, "ahe" - cough(?), "tehepero" - sticking the tongue out at an angle. You also get 'k18_a', 'k19_i', etc, that you can use to simulate speech.

For more complex facial emotions, you need to use multiple shape keys. E.g., for a proper "hurt", you need e05_damage (eyes), g07_damage (eyebrows), and k06_damage (mouth).

Gaze direction is set with cf_J_look_L, cf_J_look_R.

As mentioned, some skin parameters are found in "object properties" of the body mesh (o_body_cm/o_body_cf), since they are shared by all materials (of which there are at least two and possibly up to four), and more shared settings will be moved there in future.

Two types of skin are available: the "default" skin, which emulates in-game skin (left), and the "alternate" skin (right). The "alternate" skin is on by default. Skin types

To match in-game skin reflectivity, raise "Base skin gloss" from 0.1 to 0.3 or so.

To add uniform gloss (lip gloss, liquids, etc.) to the face, generate an appropriate texture and plug it into the "Clear coat" port on the "head texture shader":

Clear coat

To transfer clothing between characters (requires "Refactor armature" on both):

KNOWN ISSUES