Jump to content

Trials of Mana Mod Creation Guide


Recommended Posts

4 hours ago, yock0723 said:

 

Great work!

Can I use your model in my mod?

You should wait until oscateexor release his update and improved version. He's creating a base nude model that is going to be legendary as it will eventually be the one all future modders should use for their work. Of course, I do hope he allows it, so more mods can expand from it.

Link to comment

As it turns out, .psk file format just doesn't have the capability of holding vertex normals. Exporting models as glTF format however, does retain normals.

It's a completely different file format though and it's unsupported and there is very little information about it. But in my testing, I believe this can export Morphed normals data correctly.

 

thg1.png.d98f7279c1c2c1e0d45e45fe7dfbd605.png

 

umodel_morph_fix2.zip

 

- Source code is now based on (forked from) May 6, 2020 revision of the main repository. https://github.com/gildor2/UEViewer/tree/252ef9a7bc286ee3e06270bebd577afe2b473a60 

 

- Disabled vertex welding in psk export. As it was causing some MorphTargets to apply deltas on the wrong vertices.

This was a false alarm. It's actually the original model uasset does not have the TargetDelta data on that particular vertex (VertexBufferIndex 23975-23980 to be precise, missing 6 vertex deltas from its counterparts). Most likely an oversight from Square Enix.
This change will result in the exported psk models to be more separated geometries, more duplicated vertices and more file size. (certainly a deterimental change if you don't care about custom split normals)

psk file exported from this version and previous versions (or original umodel from Gildor) are not interchangeable.


- Replaced "Export LOD Models" with "Export Morphed Models" for glTF 2.0 export, the same treatment as psk.
- Enabled "CStartupSettings" table for the config file. It was just commented out in UmodelSettings header file. Maybe it was removed for a good reason, but I couldn't resist.

 

Quote

Q. Is that worth the hassle?

A. Idk

 

Q. Morphed vertices appear to be inside out?

A. Because exported Morphed glTF files only have the normal deltas. Combine them into the base mesh with "Join as Shapes" as-is.

This was a lie. Blender does not support custom normals per shape key. "Join as Shapes" only takes account for vertex positions and rotations, but normals are discarded. (As opposed to the UE4 MorphTarget structure. Which can store normal deltas per morph) But this should be a minor problem.

 

Q. Is it possible to merge glTF into psk and just use the normals data only?

A. I couldn't find an easy way... You can "Join as Shapes" between psk and glTL (It requires both models to have the exact same number of vertices), but the custom normals data will not transfer. See below

 

Q. This is my first time modding a game.

A. Don't use this version.

 

05/15 edit: This entire "transfer normals" method seems to be unnecessary complicated. Use the resize method instead.

Spoiler

Edit: (Still experimental) How to transfer normals from glTF to psk

Both files must be exported from the same uasset, without vertex welding.

Remove your mods from the game folder (Trials of Mana\Content\Paks) before exporting assets. Otherwise umodel will export modded assets.

 

Note: Using the "Stable" (ver 2.7.8) .psk import plugin will cause the failed data transfer.

import2.png.20f947dbd4b36320c7d3d4902373894e.png

 

Switch to the "Current" (ver 2.7.13) import plugin if you have the stable one installed.

 

import3.png.c94a1cf0ee5a90371f39b9a0baae751c.png

 

Quote

 

The original pc02_01a model (uasset/uexp) has a total of 27632 vertices.

verts1.png.316fa5a3c978b54cb951a874cb3a0343.png

 

psk exported by fix 2

verts2.png.287efd89c924e43e6a5e97e039de1af3.png

 

psk exported by fix 1 or earlier. Some vertices are merged. (Which is normally useful for 3D modeling)

This mesh is not applicable for normals data transferring. Don't use this.

verts3.png.1f8593fcda0ad79880ddfc8ca6df4e00.png

 

glTF export. Does not have vertex welding option in any version of umodel.

verts4.png.8f406fc858768bc770c5e8b94283e674.png

 

 

Before doing this, select the target mesh object, enable "Shade Smooth" and "Auto Smooth" in Normals property. As psk model files do not have any vertex normal data by default, you have to manually turn them on.

 

nm2.png.899c5746a7729de9415394969057b140.png

 

Don't click "Add Custom Split Normals Data", it suggests that the mesh has no normal data yet. (If there is, you may clear it before transferring)

 

nm3.png.f44fc9b83a9c7171f6c1c961644a0e56.png

 

Add "DataTransfer" modifier on the psk mesh. Set glTF mesh object as source.

And choose "Topology" method. This doesn't interpolate like other methods, but it requires both meshes to have the exact same number of vertices, edges, faces, and adjacency information (matrices), hence it's 1 : 1 carbon copy.

 

gltf2.png.e6ad886803d04c3d4c4f3f170b50d81f.png

 

Some models meet the condition right after importing, but some others do not match for some reason. (in most cases, glTF ends up having fewer faces than psk). I suspect the problem is the way two importers validate meshes differently.

For now, I wrote a Blender script that removes the duplicated faces in psk. This should enable topological normals data transfer for such models.

 

Spoiler

Run in Edit mode - for single mesh



import bpy
import bmesh

obj = bpy.context.object
me = obj.data
bm = bmesh.from_edit_mesh(me)
dict = set()
deletethis = set()

for face in bm.faces:
    if len(face.edges) == 3:
        vhindex = [vert.index for vert in face.verts]
        vhash = frozenset(vhindex)
        if vhash not in dict:
            dict.add(vhash)
        else:
            deletethis.add(face.index)
dupedfaces = [face for face in bm.faces if face.index in deletethis]
bmesh.ops.delete(bm, geom=dupedfaces, context='FACES')
bm.verts.ensure_lookup_table()
bm.edges.ensure_lookup_table()
bm.faces.ensure_lookup_table()
bmesh.update_edit_mesh(me)

 

psk mesh after running this script

verts5.png.6af60d66506de5a51570348ca6db7ba4.png

 

Thanks to wutdahax and @kazahana_p for helping me figure out.

 

05/10 edit: Shitty batch scripts

 

Spoiler

- Import all glTFs then psks. not the other way around.

 

- You may import morphed psk files with "Mesh only" option (import "All" for the base model). glTF importer doesn't have these options.

y1.png.f074442c034235b7c2cb641b82818055.png

 

 

Batch remove duped faces

Select psk meshes in Object mode



import bpy
import bmesh

for ob in bpy.context.selected_objects:
    if ob.type == 'MESH':
        me = ob.data
        bm = bmesh.new()
        bm.from_mesh(me)
        dict = set()
        deletethis = set()

        for face in bm.faces:
            if len(face.edges) == 3:
                vhindex = [vert.index for vert in face.verts]
                vhash = frozenset(vhindex)
                if vhash not in dict:
                    dict.add(vhash)
                else:
                    deletethis.add(face.index)
        dupedfaces = [face for face in bm.faces if face.index in deletethis]
        bmesh.ops.delete(bm, geom=dupedfaces, context='FACES')
        bm.verts.ensure_lookup_table()
        bm.edges.ensure_lookup_table()
        bm.faces.ensure_lookup_table()
        bm.to_mesh(me)
        bm.free()

 

Batch transfer normals (it then deletes glTF objects)

Select psk meshes in Object mode, must have a corresponding glTF mesh for each psk mesh (the pair detection is just object name matching)



import bpy

obj_del = set()
for ob in bpy.context.scene.objects:
    if ob.select_get():
        if ob.type == 'MESH' and '.mo' in ob.name:
            gname = ob.name.rsplit('.mo')[0]
            glTF = [g for g in bpy.context.scene.objects if g.name == gname]
            if len(glTF) != 1:
                raise Exception("{} has no pair or too many: {}".format(ob.name, len(glTF)))
            else:
                obj_del.add(glTF[0])
                bpy.context.view_layer.objects.active = ob
                bpy.ops.object.shade_smooth()
                ob.data.use_auto_smooth = True
                try:
                    mod = ob.modifiers.new(name="_Normals_From_glTF", type='DATA_TRANSFER')
                    mod.use_loop_data = True
                    mod.data_types_loops = {'CUSTOM_NORMAL'}
                    mod.loop_mapping = 'TOPOLOGY'
                    mod.object = glTF[0]
                    bpy.ops.object.modifier_apply(modifier="_Normals_From_glTF")
                except Exception as e:
                    print("\n[Data Transfer Failed at {}]\nError: {}\n".format(ob.name, e))
for ob in bpy.context.scene.objects:
    if ob.parent in obj_del:
        obj_del.add(ob)
obj_del = list(obj_del)
override = bpy.context.copy()
override['selected_objects'] = list(obj_del)
bpy.ops.object.delete(override)

(Operate "Join as Shapes" manually)

 

 

Rename shape keys

Select a model with shape keys in Object mode



import bpy
import re

obj = bpy.context.object
me = obj.data
if obj.type == 'MESH':
    shapekeys = me.shape_keys.key_blocks
    for key in shapekeys:
        if key.name != 'Basis':
            key.name = re.sub(r'^SK.*?Morph\d{1,2}_', '', key.name).replace('.mo', '')

 

- Ctrl+Z does not work for actions done by scripts. Don't forget to save the blender file before execution.

 

 

NEXT UP: Separate face01 material section -> duplicate verts around the boundary between face and neck -> "merge verts by distance" on the duplicated mesh -> transfer normals from the duplicated mesh to the edge of neck and face with "Nearest Corner and Best Matching Face Normal" method

[Also refer to wutdahax's tutorial Step 4b]

 

 

Link to comment
20 minutes ago, oscateexor said:

As it turns out, .psk file format just doesn't have the capability of holding vertex normals. Exporting models as glTF format however, does retain normals.

It's a completely different file format and it's unsupported and there is very little information about it. But in my testing, I believe this can export Morphed normal data correctly.

 

thg1.png.d98f7279c1c2c1e0d45e45fe7dfbd605.png

 

umodel_morph_fix2.zip 1.01 MB · 2 downloads

 

- Source code is now based on May 6, 2020 revision of the main repository. https://github.com/gildor2/UEViewer/tree/252ef9a7bc286ee3e06270bebd577afe2b473a60 

 

- Disabled vertex welding in psk export. As it was causing some MorphTargets to apply deltas on the wrong vertices.
This change will result in the exported psk models to be more separated geometries, more duplicated vertices and more file size. (certainly a deterimental change if you don't care about custom split normals)

psk file exported from this version and previous version (or original umodel from Gildor) are not interchangeable.


- Replaced "Export LOD Models" with "Export Morphed Models" for glTF 2.0 export, the same treatment as psk.
- Enabled "CStartupSettings" table for the config file. It was just commented out in UmodelSettings header file. Maybe it was removed for a good reason, but I couldn't resist.

 

  

Sure, you need to credit Kakomiki (the original author of the 3D model made for MMD). The model is not prohibited for any usage except gore/snuff, but he asked for the credit.

May I ask what you are currently working on? Sinyu  says you are creating base models. Is that true?

Link to comment

Added "Step 11" to the tutorial for this new UModel. I haven't tried it yet but I think it's important information which is only useful after somebody has already got their mod working so they can start doing more advanced stuff.

Link to comment

I've never been able to create a MOD before, but I read this article and I was able to create Angela's MOD.
I'm very grateful to the person who created this article for me and answered my questions.


Once again, I want to thank you. Thank you very much.

I challenged myself to make a Reese's mod in the next step.
I was able to make it to a certain extent, but I hit a huge wall.

I made it to the bottom image, but I can't get rid of the traces of the clothes.
This mod is a modified version of Fenrir Knight.
The work is done using blender 2.8.
I want to get rid of these clothes marks.
If anyone can give me some advice, I wonder if they would be willing to help me.20200508110808_1.jpg20200508110849_1.jpg20200508110904_1.jpg
I apologize for the impertinent request, but thank you very much.
(I'm using machine translation.)

Link to comment

I finally got this working, something about 10th time is the charm or whatever. But one question I have: Anyone know how to properly rescale models? Every time I try rescaling, it scales the characters only in their attack animations, but still has them at the normal scale for everything else. I've tried changing the scale they export out of blender at, changing the scale of all objects indiscriminately in blender, and changing the scale of objects as they're imported into UE. Anyone know of a way to scale for all animations? 

 

Thanks!

Link to comment
12 minutes ago, DekonFrost said:

Duran's dark classes costumes are really bad. Who can change Gladiator Costume to Lord Costume? also, Swordmaster to Divine Hero. just change the color.

Please Make this mod...I really want to play with this mod....

Link to comment
21 hours ago, Sinyu said:

You should wait until oscateexor release his update and improved version. He's creating a base nude model that is going to be legendary as it will eventually be the one all future modders should use for their work. Of course, I do hope he allows it, so more mods can expand from it.

Yes,ofcourse.However, I wanted to use his mod immediately. Sorry I was impatient.

But,now oscateexor gave me permit to use his mod. He is so kindful.

 

 

 

21 hours ago, oscateexor said:

Sure, you need to credit Kakomiki (the original author of the 3D model made for MMD). The model is not prohibited for any usage except gore/snuff, but he asks for the credit.

Thank you very much. You are the best!

OK, I will write Kakomiki and your name credits.

Link to comment
18 hours ago, gagyou said:

I made it to the bottom image, but I can't get rid of the traces of the clothes.
This mod is a modified version of Fenrir Knight.
The work is done using blender 2.8.
I want to get rid of these clothes marks.
If anyone can give me some advice, I wonder if they would be willing to help me.

Spoiler

20200508110849_1.jpg

 

 

I believe this is due to the texture surface map T_pc06_03d_wear01_M. You should change the material slot for the body so that it no longer uses wear01, but only uses body01. Edit the UV so that the polygons fit on T_pc06_01a_body01_C

 

You should edit the UVs and make very minor changes to the textures (add nipples, pubic hair etc) without changing the position of things in the image. That will make sure the same texture will work correctly on other costumes that you have not modified. Face -> Tris to Quads (Alt+J) might help.

Spoiler

image.thumb.png.1b9da2320c749b5d6580348ba96a2e3f.png

 

The artifacts you are seeing are caused by the texture (pc06_03d_wear01_M) responsible for various surface effects. I believe it controls specular, metallic, roughness and possibly ambient occlusion, but I'm not sure. You need to make the whole body use the MI_pc06_01a_body01 material slot and correct the positions of vertices that do not fit in the UV map.

 

This article helped us figure out some important things before I wrote my tutorial: http://hal51.click/game/tom_modding

Part 5 will be particularly interesting to you:

Quote

 

5.1 テクスチャ編集
pngファイルは一般的な画像拡張子なのでペイント等でも開けます。
今回はアンジェラの髪テクスチャである「T_pc02_01a_hair01_C.png」を、別途変換しておいたリースの髪テクスチャ「T_pc06_01a_hair01_C.png」で置き換えるので画像編集はしません。
これはMOD動作確認のための置き換えなので本格的にMODを作る場合はGIMP等で編集してください。

ちなみに、テクスチャ名末尾のアルファベットは、C=カラー、N=ノーマルマップ、M=srmがRGBチャンネルに重畳したものと想定。s=スペキュラ、r=ラフネス、m=メタルネス。

関連記事:PC版『FF15』3Dモデルど素人がMODを作成してみる2

 

Additionally, seams between meshes can be fixed with Vertex -> Merge Vertices -> By Distance. You may need to select the overlapping vertices in wireframe view and adjust the distance to get the desired result.

Spoiler

image.png.727d04518ff46426dcd85e80395d07b0.png

 

Link to comment

I would definitely recommend throwing this info in the first post so it doesn't get lost:

 

Certain types of edits can severely mess up shape keys when dealing with the morphs, but it is possible to add them in after the fact if you end up breaking them (or if you forgot in the first place).

 

Here's how:

 

This method should work reliably on models where the face hasn't been messed with. 

 

Download the Shape Key Transfer addon for blender 2.8 (https://github.com/fblah/ShapeKeyTransferBlender/tree/Blender28). In blender, go to edit => preferences => install addon from file. Double click on the zip file and then enable the new addon "Shape Key Transfer". 

 

For this to work, you're going to need 2 different .blend files:

1. Your normal .blend file that you've edited the mesh on

2. A .blend file of the mesh that is imported correctly with the morphs that hasn't been touched (I.E. you've imported the .psk and the morphs, renamed everything properly, then used the "join as shape keys" function to make all of your morphs into shape keys)

 

Now, open .blend file number 1 (the one of your final product mesh, the mesh you actually want to show up in game). Now click File => Append. Navigate to the blend file # 2 (the file that contains the untouched mesh and shape keys). Double click the blend file, then click on "objects" and import the mesh (SK_pcXX_XXX). Push A twice to deselect everything.

 

Push N to open up the tool sidebar. You should see a little window to the right that says "tools" (see screenshot below. Click on that, it'll pop open our new "shape key tools" addon.

image.png.e980b2c5887ec5658aed46fc2adf46da.png

Click on the "source" button and select the base, unmodified mesh (should be whatever the mesh title is and .001, as you see in the image above). Click on destination and select your modified mesh. Then push "Transfer Shape keys" and let it run. This'll take a minute.

 

Once it's done, open up your modified mesh and check the shape keys section. You should now see all of our lovely shape keys transfered over. Test out a few of them by setting the value to 1 (one at a time so they don't overlap) to make sure nothing wonky happened. If everything is in order, delete the armature that we appended in so that you only have 1 armature. Export this file as an .fbx like normal and continue on from here. Congrats! You've added shape keys. 

Link to comment
18 hours ago, ptonino said:

Anyone know the solution to getting hair to move about when replacing models?  There's something I'm missing but I'm not sure.

 The animation blueprint (ABP) contains logic for specific bones found in the skeletal mesh. If your new skeletal mesh does not contain those bones, it won't be able to make them move. (we don't know the exact contents of these blueprints so we leave them empty and don't include them in our pak so that the originals are loaded in place of our empties)

 

The common skeleton contains all the bones for all the meshes that share it. Here's an example of my skeleton previewing Angela after I imported a few different characters. Here you can see that some of the bones in the common skeleton are not used by Angela:

image.png.ebcbe5b1aae6e88182cf551962af099a.png

 

You will need to make note of which bones exist in the original skeleton and blend them with your new mesh. In my opinion, the simplest way is to load both models into blender, delete the skeleton from one model, the mesh from the other model, and then update the armature modifier on the mesh to point to the skeleton. You will need to update the vertex groups (at the very least rename the old ones to match the new names) or do some weight painting, but theoretically it should work.

Link to comment

@koechophe there is no need to transfer shape keys if the "face" part is a separate mesh. Once you have appended the face mesh with working morphs, just delete the broken one and connect the working one to the armature and material.

 

Having the face as a separate mesh is practically required anyway because it's the only part that uses a master material with "use morph targets" enabled. If you have other material types on the same mesh, they will be replaced with placeholders when the face morphs at run time.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use