Organization of Starfield’s Meshes and Related Assets

Organization of Starfield's Meshes and Related Assets

Guideline:
This article talks about what the community knows about Starfield’s mesh-related assets, where are they located, how are they organized, what does each type of file contain, and etc. These assets include:

Geometry data: .mesh files
Morph data: morph.dat

Disclaimer:
Other referenced files in this article include:

Nif files.
Material files.
Texture files.

and will NOT be discussed in detail in this article. Additionally, technical details will NOT be thoroughly discussed in this article.

Catalogue:

General Q&A: Brief introduction to Starfield’s assets.
Assets Organization: How assets are referenced and organized.
Import Export Tips: Things you should care about when importing/exporting.

General Q&A:
Q: How do Starfield’s assets differ from those of Skyrim of Fallout 4?
A: In Starfield, the geometry data is no longer stored in .nif files, and what’s make things worse is that most file formats are changed. Old tools without update will no longer apply to Starfield’s assets creation. Besides all this, Starfield’s assets are organized in a over-complicated and non-intuitive way which takes a lot of effort to comprehend.

Q: What’s actually stored inside the aforementioned files?
A: Here’s what we know so far about what these files hold:

Nif files: Transformations, Asset references, Physics data, Bone list/positions, and other property specifiers.
Geometry files: Mesh geometry data, UV coords data, Normal/Tangent data, Vertex color data, Bone weighting data, Mesh LoD data, Meshlets data, Face culling data.
Morph files: Morph offsets, Vertex color offsets, Delta normals, Delta tangents, Vertex indexing data.
Material files: Unclear to me. There are other groups trying to decode the .mat format.
Texture files: dds textures.

Assets Organization:
A. Geometry files: Data/geometries/foldername/filename.mesh
Nif file should be the first thing you look for when creating mods. Basically, Nif files contain a lot of references to other assets. To find the reference to a geometry file, you need to:

Locate “BSGeometry” node in the block list.
Find the property name called “Meshes”.
These meshes represent different levels of LoD. Open the desired one.
Find “Mesh Path”, and copy the hex string as hex1/hex2.
Browse the ba2 file containing meshes, locate geometries/hex1/hex2.mesh. This is the referenced mesh file.

Similarly, you can also find the material file paths in nif files.

B. Morph files: Data/meshes/morphs/…/morph.dat
All morph files are referenced in esm files and are associated with nif files. You can find the corresponding morph file the model is currently using with xEdit or alternative tools.

Import Export Tips:
A. Import Meshes and Morphs:
To import a mesh, you can simply use the import button in the import dropdown menu of blender. To import a morph, you need to firstly import the corresponding mesh file and then import the morph file with your desired mesh active.

After the import of geometry file is complete, the weighting data will be stored as Vertex Groups in your object, you can do weight painting as you wish. However, the names of the bones are lost simply because the names are stored in nif files. To match the Vertex Groups with the actual bone names, you can take the following steps:

Open the corresponding nif file.
Find the “BSGeometry” that referenced the mesh.
Find the “SkinAttach” block, under the properties, you should find the bone list.
Rename the bone0 to boneXX in blender to the corresponding names in nif.

After the import of morph file is complete, the corresponding model will have new Shape Keys, which directly correspond with the sliders in game.

B. Export Meshes:
To export a mesh, you need firstly to make sure:

Your mesh is UV unwrapped.
Your mesh has vertex number lower than 65535.
Your model has correct face orientation.
Your model has no duplicated faces.

To make sure your model is UV unwrapped:

Go to “UV Editing” workspace in blender.
Select all verts by pressing “A” button.
Check the UV map.
If UV map doesn’t exist, try “UV -> Smart UV Project”.
Make sure your texture is aligned with the new UV map.

To make sure your mesh has vertex number lower than 65535:

Find “Viewport Overlays” at the up-right conner of your blender viewport.
Toggle on “Statistics”.
Observe the statistics at your up-left viewport window.

To make sure your model has correct face orientation:

In “Viewport Overlays”, toggle on “Face Orientation”
Make sure red points to the inside and blue points to the outside.
If not, try using “Mesh -> Normals -> Recalculate Outside” in Edit mode with all verts selected.

To make sure your model has no duplicated faces:

If your model has duplicated faces, go to Edit mode.
Select all verts by pressing “A” button.
Press “M” button and select “By distance”.
Check the face orientations and other properties after this operation.

C. Normals Export Control:
This part should no longer be your concern in version 0.10, make sure you turned on “Auto Smooth” for your mesh in Blender, and What You See Is What You Get.

How to follow the Seamless Workflow for body mesh creation:

Prepare your body mesh and reference meshes (head and hands).
Create Base Meshes from them. A Base Mesh means the mesh has “Auto Smooth” on with no visible seams in blender. Base Meshes are used to properly calculate normal and tangent information.
For instance, if you want to create Base Mesh for imported vanilla body, you should: “Merge verts by distance” -> “Turn on Auto Smooth”.
Select the body Base Mesh as Active Object, and the reference Base Meshes as Selected Objects. Body mesh is now subject to reference meshes.
Set “Compression Border” to 2. This is to make sure the positions of verts will be quantified at the same level.
Export the body object to Mesh or Morph or both at the same time according to your needs.
Export the references normally, they don’t need to reference the body mesh.
Import the exported meshes and morphs in game.

Some notes on how to prepare your Base Mesh:

Merge the verts by distance to eliminate seams from mesh islands.
Mark sharp edges if you want sharpness at certain area.

D. Export Morphs:
To export a morph file, you can either export the morph data individually by clicking on the export morph button in the dropdown menu, or export morph along with the mesh with the sidebar button. Before exporting the morph, you want to make sure:

Your model has one “Basis” morph key, which is the basic looking of your model without any morph.
All shape keys are from range 0 to 1, and they should be relative and referencing the “Basis” key.

Be Warned: Starfield’s models are highly disorganized in terms of the definition of axes in the geometry file. Which means you have to be careful with the rotation of your model in blender and try different rotations if morph deformation doesn’t work as expected.

E. Debug Tricks:
If you are experiencing issues with the exported meshes or morphs, you can always re-import the exported mesh files or/and morph data to check if things are good. The vertex normal and optionally meshlet and culldata will be preserved on import.

Credits:

SesamePaste

5/5 - (1 vote)
Share mod:

Leave a Reply

Your email address will not be published. Required fields are marked *