godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.78k stars 20.13k forks source link

Unable to import PMX(MMD/Miku Miku Dance) model. #37269

Closed Kashouryo closed 3 years ago

Kashouryo commented 4 years ago

Godot version: Tested with both 3.2.1 Mono and standard version

OS/device including version: Windows 10 1903 64 bit Workstation

Issue description: Since this commit #23837, godot should be able to import .pmx files as shown in the screenshot.

Steps to reproduce: Drag any pmx file into assets browser does nothing. Godot does not recognise my pmx file at all.

Minimal reproduction project: N/A

aaronfranke commented 4 years ago

Most users don't have PMX models laying around. Please provide a minimal reproduction project.

Kashouryo commented 4 years ago

https://www.deviantart.com/piloulabaka/art/MMD-YYB-Miku-Magical-mirai-2019-DL-812574746 Here is a pmx model.

The one that I am trying to use: https://www.deviantart.com/schavel/art/MMD-Ayumu-Uehara-TOKIMEKI-Runners-Uniform-DL-818185563 This one is way simpler and only contains two textures.

Calinou commented 4 years ago

I remember reading about Assimp's Godot integration being refactored in 3.2, which removed support for lesser-used formats to focus on FBX instead. Therefore, this may not actually be a bug, but rather a documentation issue. Please link to documentation pages that state incorrect information :slightly_smiling_face:

akien-mga commented 4 years ago

MMD support was partially implemented in #23837 and then disabled in #33347. We're moving further away from Assimp to focus on FBX import well designed for the engine internals (#37230), so we're unlikely to enable more Assimp import types (the intent was never to make Godot able to import any kind of model like Assimp attempts to, we only want to support what we can support fully).

Kashouryo commented 4 years ago

Is there any way I can still import my MMD model? I tried using blender to convert pmx to fbx. But it does not contains any skeletons.

rsubtil commented 4 years ago

Is there any way I can still import my MMD model? I tried using blender to convert pmx to fbx. But it does not contains any skeletons.

If you can open in Blender without any problems, could you use this? AFAIK it's the most robust way of importing Blender models to Godot.

akien-mga commented 4 years ago

If you can open in Blender without any problems, could you use this? AFAIK it's the most robust way of importing Blender models to Godot.

Actually this exporter needs an update for Blender 2.81+, so right now it might not be the best solution. The glTF pipeline however should be quite good with Blender 2.82 and Godot 3.2, so I'd advise trying to import the MMD in Blender and export as glTF 2.0.

Kashouryo commented 4 years ago

akien-mga is correct. Right now, the current master branch of blender godot export will throw tons of errors upon export. But glTF 2.0 is also not working. There are some texture issues on the character's face.

Click to see the picture(a little bit scary) ![image](https://user-images.githubusercontent.com/37679684/77459047-7b297e80-6dd5-11ea-866a-25d18e7ae163.png)
fire commented 4 years ago

I wrote the initial version of the assimp importer which was improved by @RevoluPowered .

We removed lesser used importer before the merge.

However, here's a guide to import pmx assets (easier) with vmd (harder) animations.

https://github.com/assimp/assimp/issues/644#issuecomment-582252048

I recommend using Blender 2.83 (unstable) because it handles importing more things into the internal gltf2.

fire commented 4 years ago

For your second model, here is the conversion using the above method.

mmd_ayumu_uehara.zip

See https://www.deviantart.com/schavel/art/MMD-Ayumu-Uehara-TOKIMEKI-Runners-Uniform-DL-818185563 for the original legal conditions.

 scene/3d/skeleton.cpp:398 - Condition "p_name == "" || p_name.find(":") != -1 || p_name.find("/") != -1" is true.
 scene/3d/skeleton.cpp:497 - Index p_bone = 18 is out of bounds (bones.size() = 18).
 scene/3d/skeleton.cpp:450 - Index p_bone = 18 is out of bounds (bones.size() = 18).
 editor/import/editor_scene_importer_gltf.cpp:2185 - Condition "bone_index < 0" is true. Returned: FAILED
 editor/import/editor_scene_importer_gltf.cpp:2167 - Condition "_map_skin_joints_indices_to_skeleton_bone_indices(state)" is true. Returned: ERR_PARSE_ERROR
 core/os/file_access.cpp:667 - Condition "!f" is true. Continuing.

They don't load into Godot Engine. There's an error message about the bones.

Kashouryo commented 4 years ago

That's what I am talking about. None of the bone related things works.

fire commented 3 years ago

This uses mmd_tools, blender 2.9 and a recent version of godot 3.2 git.

image

I don't see any problems.

Edited:

Was fixed recently. Not in stable 3.2

fire commented 3 years ago

https://github.com/godotengine/godot/commit/1f87bca8fb69c48b35c1dfccbce7cf73550d68cb I think this is the fix commit for importing this gltf2.

akien-mga commented 3 years ago

Thanks, closing as fixed in 4.0 and 3.2.4.