Skip to content

Instantly share code, notes, and snippets.

@libjared
Last active December 12, 2023 08:35
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save libjared/9bd25f0e3f2dd1780a6f078d5d76473b to your computer and use it in GitHub Desktop.
Save libjared/9bd25f0e3f2dd1780a6f078d5d76473b to your computer and use it in GitHub Desktop.
how to use xiv character model for vrchat

This is gonna be long and I might not finish it but here's what I got. This shit is so long that if I get it down to a science I might make a program to automate it.

Overview

We will study your character stats, use FFXIV TexTools to export the model parts, Blender to fix it up....

Collecting data

Do you have your character appearance saved? It's not essential but it's very useful to have. It's in the form of a DAT. I hope you backed it up if you created them on an old PC. I'm not sure if you can resave it from an existing character. What I did was use the Shadowbringers Benchmark. I seem to remember there was a way to import your character from the base game but I can't remember. Anyway first you'll need to copy the character DAT to the benchmark folder.

  • Benchmark - \Documents\My Games\FINAL FANTASY XIV - A Realm Reborn (Benchmark)\FFXIV_CHARA_BENCH01.dat
  • Main game - \Documents\My Games\FINAL FANTASY XIV - A Realm Reborn\FFXIV_CHARA_01.dat

... where 01 is character appearance slot 1.

In the benchmark click start a new character, load appearance data, and select character slot. Now you can

Exporting Models/Textures

Install FFXIV TexTools. To export things, it also needs a program called assetcc2.exe from the Havok SDK, I got it from a youtube video, kinda sketchy, but it's not a free program so whaddya gunna do. (TODO link it here)

make sure to set all colors in the settings to full white, as the edits here will end up being more accurate

when you load your face and look at the rendered view, your face is solid black. materials are broken up into several channels:

  • diffuse
  • alpha
  • normal
  • specular
  • emissive

there are several problems with this.

  • the blender material sets alpha channel to 0 instead of reading from the alpha image file
  • what we recieved out of the tool was just BMPs representing these channels. Use GIMP to add layer mask from greyscale, replace base image with black, add alpha channel and save appending _channel.png to filename.

materials starting with X use the Y mesh:

  • fac_0 - eyes
  • fac_1 - head, ears, and scars
  • fac_2 - facial hair and elezen clasps

For every material, turn on backface culling, blend mode = alpha blend, turn off show backface (or else you'll see your teeth show through). Also for each, Normal = Normal Map and in Color row, click dot and add image texture from the normal BMP.

material diffuse? alpha? normal? specular? emissive?
fac_0 (eyes) Y n Y Y n
fac_1 (head) Y Y Y n n
fac_2 (facial hair) Y Y Y Y n

where it is n, the BMP file is solid black in the case of emissive or specular, or white in the case of alpha. Please note that the eye still has specular, it's just very dark grey, not solid black like it looks.

content tools?

copy the contents of HavokContentTools\bin to the dir where ffxiv tex tools exe lives, also assetcc2.exe

Eyes

So fucked up it needs its own section. what even are these things? Layers:

  • normal map, making up the radial lines in the iris
  • eye highlight (composed of one large dot, one small dot, and some very subtle reflections of windows)
  • "specular map", in quotes because it ends up just being an alpha channel for a solid black color, comprising the pupil
  • solid color (your character's chosen color)
@libjared
Copy link
Author

libjared commented Mar 22, 2020

armature for top (Edengate Mail of Fending) was missing, pose is impossible. CATS blender plugin cannot find "Left arm", "Left elbow", and "Left wrist", same for right side. the vgrps and weights are there okay, but the relevant bones aren't being created for some reason. either the fault lies in by TexTools or the blender COLLADA importer.

the solution is to import the bones from a different model that works, like Elezen Surcoat perhaps, then move the armature to the edengate model. yes, the solution is to move some armature bones to another object.

CATS recognizes these bones, but couldn't find them:

  • \Left arm - J_Ude_A_\L
  • \Left elbow - J_Ude_B_\L
  • \Left wrist - J_Te_\L
  • I'm assuming in the code, \L means L is substituted for R, and a similar transformation for \Left.

@libjared
Copy link
Author

libjared commented Mar 22, 2020

to take one armature's bones and move to another object
https://www.youtube.com/watch?v=o5f18T7Rjmc
https://blender.stackexchange.com/questions/92564/how-do-i-copy-bones-from-one-armature-to-another/92593

  • two objects. Base has 90% of the armature, Other has the remaining 10%.
  • Other has irrelevant meshes, delete them.
  • in object mode, in outline panel, LMB on Base, then ctrl+LMB on Other, then with your mouse hovering over 3D view, Ctrl+J (join objects).
  • the hierarchies are joined, but there are probably some bones ending in .0001 now...
  • in edit mode, in those "duplicate" trees, find the first bone that doesn't have a .0001 suffix and in Bone Properties, set its parent to the original by removing the .0001. repeat until the armature has two roots, with a tree each, where one tree has all original bones and the other tree has duplicate bones. (AKA vestigial, LOL!)
  • delete the tree of now-unused duplicate bones by selecting the duplicate's root and Shift+G, click on children (or via the menu: Select -> Similar -> Children) then, with mouse over 3D view, Delete key.

@libjared
Copy link
Author

libjared commented Mar 23, 2020

scale elezen body parts by 1.135x

(but also maybe another 1.02435x, thus equalling 1.16263725x)

@libjared
Copy link
Author

what's the difference between n_ and j_? Example: n_hte_l and j_te_l have the same origin, both have associated vertex groups
I think....... it's to separate a part, with a part and its hierarchy. for example, n_hte_l moves the hand while j_te_l moves the hand and its fingers. but that's just how the pose tree works?

@libjared
Copy link
Author

libjared commented Mar 23, 2020

Locations are (XYZ), rotations are (WXYZ).

Blink R:

  • J_F_Umab_R (0 m, 0.0022 m, -0.014 m)

Viseme OH:

  • J_Ago (1, 0.072001, 0, 0)
  • J_F_Lip_L (-0.0091 m, -0.005 m, 0 m) (and opposite)

Viseme CH:

  • J_F_Dlip_B (1, 0.075, 0, 0)
  • J_F_Ulip_B (1, -0.05, 0, 0)

@libjared
Copy link
Author

libjared commented Mar 23, 2020

some verts don't react to any pose, as if their bone is gone, or they aren't a part of a vgroup. in my case, this was two body parts:

  • the thumb. the upper part wouldn't move at all, even if I posed the root bone 20 meters back. my solution was just to manually weight paint it to the regular thumb group.

    • I think at some point, thumbs had only 1 bone, and then they started having 2. I copied the armature from elezen surcoat, which is probably really old, and of course Edengate gear is less than a year old, so it didn't match up 100%.
  • armor elbowpads. the vertex group is called n_hijisoubi_l, AKA "elbow equipment".

    • I am going to attach the pads to the forearms:
      • Select mesh in Object mode
      • Switch to Edit mode
      • in Properties panel (lower right), click Object Data Properties tab (green triangle)
      • in the Vertex Groups accordion, click n_hijisoubi_l vgroup and click Select button to select those verts
      • click on Right elbow vgroup, then click Assign
      • done. the hijisoubi vgroup still exists but we'll just leave it there for no good reason /shrug
    • just like the thumb, I think hijisoubi is a bone type only supported in later XIV versions so copying the armature from old gear doesn't cover everything. that, or it's missing because elezen surcoat doesn't have elbowpads.
    • I find the latter more likely as I know unused parts for gear means the bones are missing from the armature. for example, you know how the Elezen Surcoat has a right shoulderpad, but not a left one? well the armature only has a bone for the right: n_kataarmor_r (kata means shoulder) meaning the left one is purposefully omitted.
    • because of this, and now that I think of it, it would have been better to copy the armature from similar-looking gear in patches that TexTools doesn't shit itself trying to produce bones for. such as ... uhhhh, Ironworks gear maybe.

@libjared
Copy link
Author

@libjared
Copy link
Author

libjared commented Mar 29, 2020

atlas material combiner problems

  • alpha channel messed up
    • alpha blend does not work. alpha clip is often the only way (this isn't because of the atlas, this is a result of the mesh combiner)
    • this affects:
      • complex shapes on armor, like wings (which are just simple faces with cutouts)
      • eyelashes, eyebrows (both solid black)
      • hair (the front layers representing bangs are transparent in the corners. normally this would mean the next layer of hair is shown through those faces, but for some reason it completely overwrites instead of blends, thus the skin of the scalp is shown)
        • why does the hair get overwritten but the scalp doesn't? is it because they are different materials?
    • for the alpha to kinda work (alpha clip only, in my experience), the alpha channel and diffuse must be the same Image Texture
      • meaning, the diffuse PNG should have the transparency where appropriate, and use the file browse to select the same PNG for both
  • normal map, specular map all totally ignored

@libjared
Copy link
Author

misc todo

  • eyebrows need coloring

@libjared
Copy link
Author

libjared commented Mar 30, 2020

how to color hair and eyebrow and eyelash texture: light variant of hair color below, multiply layer of black and white hair above

(my hair: #87644B)

@libjared
Copy link
Author

if gimp exports really pixelated alpha (alpha channel is 255 or 0 but nothing in between), switch from indexed color to rgb

@libjared
Copy link
Author

libjared commented Apr 1, 2020

For each mat, use the nodes editor to draw both color/alpha lines from the same image into the shader

@libjared
Copy link
Author

libjared commented Apr 2, 2020

finger bones were outside the model by 0.05m for some reason. I ended up completely redoing the hands as the bones aren't even remotely close.

@libjared
Copy link
Author

libjared commented Apr 2, 2020

in unity, only cutout mode works. a good alpha cutoff is 0.15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment