Code Monkey home page Code Monkey logo

blender_mmd_tools's Introduction


This repository is NOT maintained!
The latest version is available in UuuNyaa/blender_mmd_tools.

このリポジトリはメンテナンスされていません!
最新版はUuuNyaa/blender_mmd_toolsで入手できます。


mmd_tools

Overview

mmd_tools is a blender addon for importing MMD (MikuMikuDance) model data (.pmd, .pmx), motion data (.vmd) and pose data (.vpd). Exporting model data (.pmx), motion data (.vmd) and pose data (.vpd) are supported as well.

mmd_toolsはMMD(MikuMikuDance)のモデルデータ(.pmd, .pmx)、モーションデータ(.vmd)、ポーズデータ(.vpd)をインポートするためのBlenderアドオンです。モデルデータ(.pmx)、モーションデータ(.vmd)、ポーズデータ(.vpd)のエクスポートにも対応しています。

The detailed documentation can be found at Wiki Documentation Page.

Environment

Compatible Versions

  • Blender 2.70 or later (Blender 2.75+ is recommended)

Usage

Download

Install

Extract the archive and put the folder mmd_tools into the addon folder of blender.

.../blender-2.70-windows64/2.70/scripts/addons/

Loading Addon

  1. User Preferences -> addon tab -> select the User filter with Community in 'Supported Level' check, then click the checkbox before mmd_tools (you can also find the addon using the search function)
  2. After the installation, you can find two panels called mmd_tools and mmd_utils on the left of the 3D view

Configuring Addon

The following settings can be configured under mmd_tools Addon Preferences.

  • Shared Toon Texture Folder
    • The Data directory within of your MikuMikuDance directory for toon textures (toon01.bmp ~ toon10.bmp).
  • Base Texture Folder
    • Path for textures shared between models. In order to copy textures properly while exporting to pmx file.
  • Dictionary Folder

Importing a model

  1. Go to the mmd_tools panel
  2. Press Import Model and select a .pmx or .pmd file

Importing motion data

  1. Load the MMD model. Then, select the imported model's Mesh, Armature and Camera.
  2. Click the Import Motion button of the mmd_tools panel.
  3. If a rigid body simulation is needed, press the Build button in the same panel.

Turn on the "update scene settings" checkbox to automatically update scene settings such as frame range after the motion import.

Various functions in detail

Import Model

Imports a MMD model. Corresponding file formats are .pmd and .pmx (version 2.0).

  • Scale
    • Size of the model
  • Rename bones
    • Renames the bones to be more blender suitable
  • Use MIP map for UV textures
    • Specify if mipmaps will be generated
    • Please turn it off when the textures seem messed up
  • Influence of .sph textures and influence of .spa textures
    • Used to set the diffuse_color_factor of texture slot for sphere textures.

Import Motion

Apply motion imported from vmd file to the Armature, Mesh and Camera currently selected.

  • Scale
    • Recommended to make it the same as the imported model's scale
  • Margin
    • It is used to add/offset some frames before the motion start, so the rigid bodies can have more smooth transition at the beginning
  • Update scene settings
    • Performs automatic setting of the camera range and frame rate after the motion data read.

Notes

  • If camera and character motions are not in one file, import two times. First, select Armature and Mesh and import the character motion. Second, select Camera and import the camera motion.
  • When mmd_tool imports motion data, mmd_tool uses the bone name to apply motion to each bone.
    • If the bone name and the bones structure matches with MMD model, you can import the motion to any model.
    • When you import MMD model by using other than mmd_tools, match bone names to those in MMD model.
  • mmd_tools creates an empty model named "MMD_Camera" and assigns the motion to the object.
  • If you want to import multiple motions or want to import motion with offset, edit the motion with NLA editor.
  • If the origin point of the motion is significantly different from the origin point of the model, rigid body simulation might break. If this happens, increase "margin" parameter in vmd import.
  • mmd_tool adds blank frames to avoid the glitch from physics simulation. The number of the blank frames is "margin" parameter in vmd import.
    • The imported motion starts from the frame number "margin" + 1. (e.g. If margin is 5, frame 6 is frame 0 in vmd motion)
  • pmx import
    • If the weight information is SDEF, mmd_tool processes as if it is in BDEF2.
    • mmd_tool only supports vertex morph.
    • mmd_tool treats "Physics + Bone location match" in rigid body setting as "Physics simulation".
  • Use the same scale in case you import multiple pmx files.

More Informations

Known issues

License

Distributed under the GPLv3 License.

blender_mmd_tools's People

Contributors

amirvincent64 avatar aoowweenn avatar darkblader24 avatar iri-e avatar lordscales91 avatar melonbreadvr avatar nagadomi avatar pixiy avatar powroupi avatar ptrthomas avatar qwertychouskie avatar stefnotch avatar sugiany avatar uuunyaa avatar vwings avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blender_mmd_tools's Issues

Feature request: UV morphs

I'm wondering if there could be some way to create and edit UV morphs in Blender via mmd_tools. (Or maybe there is and I just don't know about it?)

One way I was thinking this could be handled is via UV2+ fields. Subtract UV coordinates from UV2 coordinates to create a UV morph on export; create UV2+ fields out of UV morphs on import by just adding the UV morph values to UV coordinates. If I'm correct, that would allow for using Blender to visualize and edit these morphs.

But since I don't use Blender to animate, I'm not sure if that would be the best way to handle it-- ideally, you'd have a situation where an imported motion using a UV morph would display correctly in Blender.

Any ideas or interest?

General Discussion

Requesting @powroupi and @lordscales91 to join this discussion.

Really impressed to see the work you folks are doing, would like to help wherever I can. Meanwhile I have a few questions below, and would really like to get your thoughts.

  1. Is there a reason why the mix of rigid-bodies, joints and temporary-objects is so complex. When importing, would it be possible to simplify things so that only hinge-joints and springs are used, and avoid the whole need to "clean" and "build". I would really like to take a shot at this.
  2. @lordscales91 - if I were to attempt an english translation of the documentation, would you help review it ?
  3. Is exporting a motion / VMD something feasible ? I can take a look at this. I also want to build a library of NLA strips for common motions and poses.
  4. Do you guys feel the pain of rendering animations. I have been writing some python code to use AWS spot instances and do parallel renders etc. Would you folks be interested in testing / contributing if I open-source this ?

Attempting to change the order in the mesh sorter creates an error

Exact text of error is

Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender\2.77\scripts\addons\mmd_tools\operators\misc.py", line 182, in execute
prev_mesh = rig.findMeshByIndex(current_idx - 1)
File "C:\Program Files\Blender Foundation\Blender\2.77\scripts\addons\mmd_tools\core\model.py", line 408, in findMeshByIndex
if i < 0:
UnboundLocalError: local variable 'i' referenced before assignment

location: :-1

To reproduce:

Import a .pmx and separate by materials. Change to mmd_utils tab. Select a mesh in the mesh sorter subsection. Hit the up or down arrows. This seems easily reproducible throughout models, so I'm not including an example file, but let me know if you need one.

Documentation questions and issues

I'm making this as a general purpose thread to ask questions and report issues discovered during in-depth testing for creating decent documentation.

  1. Apply and Clean Bone constraints. I'm having a lot of trouble understanding what this does. It apparently does something though.

  2. Rename bones. In my testing, enabling or disabling this checkbox on model import has no effect. Either way, I get a bunch of boxes for my bone names. Is this not implemented, or am I doing something wrong?

  3. Influence of .sph and .spa textures. This also appears to be non-functional. I'm not seeing a difference in any fields when changing this value, and I'm not seeing any difference in the rendered view. Is this working?

  4. Log file. When enabled, where does the log file get written? I can't find it anywhere.

  5. Build and clean rigid bodies. My interpretation of this is that "build" transforms rigid bodies as used in MMD into a fashion that can be used in Blender, whereas "clean" returns them to their MMD-friendly state, and so built rigids should be used when animating in Blender, whereas clean rigids should be used when exporting. Is that accurate?

Rotational appends not being treated appropriately by Blender

http://www.mediafire.com/download/ebeh9jk12dfp2al/betterhalf.pmx

Load it up into PMXE/transform and rotate R_hipZBase. The structure uses a -2.0 rotational append on R_hipZExtender to move R_hipXZ in the X axis when R_hipZBase is rotated in the Z axis. Notice how the hip stretches when rotating R_hipZBase.

Now load it into Blender and enter pose mode. Rotate R_hipZBase in the Y axis (due to axis differences between MMD and Blender). Doesn't behave the same-- looks like the rotational append is using only a -1.0 influence, even though MMD Additional Transformation lists the rotation append properly at -2.0.

Can't play around with this more, because it gives me a mysterious message when trying to edit the transformation influence: "Changes has not been applied." Not sure how to apply the changes to see exactly how MMD Additional Transformation impacts bone rotation.

Question about the version of Blender

Hi, thank you so much for sharing this amazing 'MMD_Tools'!
Well, I have donwloaded the latest files of 'MMD_Tools', however I have no idea about the version of Blender that I should install.
Looking forward to your reply! THX!

Unnormalized weights getting improper normalization on export

http://www.mediafire.com/download/vhhae4gc2csbdvz/4.blend -- an imported pmx that I messed with a bit.

Don't know how to identify Blender vertices by number or I could direct you to specific examples. Blend file provided contains several unnormalized vertices. Relative weights are pretty reasonable, which you can see at a glance in pose mode.

On export, relative weights are getting mangled. On one vertex (exports as #425 for me), Blender vertex weights of 0.008/0.765 are getting turned into MMD weights of 0.2352941/0.7647059. Looks like it's just subtracting the main weight to figure the second weight.

(Not even sure how I managed to get an un-normalized weight, I wasn't doing any weight painting, nor did I delete any bones or vertex groups from Blender. No relevant errors on PMX validation on the source either.)

Pretty obvious work around, of course.

MMD tools features, and features which are not yet implemented

Thank you and congratulations to @powroupi and to @lordscales91 for your excellent work in debugging mmd_tools. I am trying to make a list of features of mmd_tools, so if someone can please review this list of MMD tools features and correct or fill in the blanks for me and also for other people, that would be great:

MMD tools features:

Ability to pose or animate these morphs of an imported PMX model in Blender:
material morphs No.
UV morphs No.
bone pose morphs No.
group morphs No.

The data of these morphs is preserved and will be re-exported when a previously imported PMX model is exported from Blender:
material morphs - Yes.
UV morphs - Yes (dev_test by powroupi), No (master.zip).
bone pose morphs - Yes (dev_test by powroupi), No export (master.zip).
group morphs - Yes (dev_test by powroupi), No (master.zip).

Dual/bilingual naming of shape keys is preserved and will be re-exported when a previously imported PMX or PMD model is exported from Blender Yes. (with "Morph Tools" panel)

Imported shape keys can be edited, renamed, re-ordered and the re-exported from Blender with their data intact. Yes. (with "Morph Tools" panel)

Dual/bilingual naming of PMD and PMX bones and PMX materials is preserved and will be re-exported when a previously imported PMX or PMD model is exported from Blender Yes.

Correct display of an MMD model's ambient color in Blender. No.
Correct display of an MMD model's toon textures in Blender. No.
Correct display of an MMD model's sphere textures in Blender. Yes. (except "subtract blend" type)
Ability to use .fx effects in Blender. No.

Ability to import SDEF in Blender. No, SDEF is converted to BDEF.

Ability to import .vmd morphs animation. Yes.
Ability to import .vmd bones animation. Yes.
Ability to import .vmd camera animation. Yes.
Ability to import .vmd lamp animation. Yes.

Ability to export .vmd files from Blender. No.

Ability to import and re-export physics objects correctly. Yes (at least no bugs have been found yet).
Physics animation. Yes.

My recent deviantart journal entry:
MMD models in Blender
Some links to help people get started with importing, exporting, editing, converting or animating MMD models in Blender:
http://hogarth-mmd.deviantart.com/journal/MMD-models-in-Blender-626045612

Weird Rigid Physics behavior when Main empty is move?

Hi, I just pull up the latest version and tried to play my Miku animation which has stationary skipping animation.... when I tried to move her position using the main empty the physics goes nut, here is an example of the problem : https://www.youtube.com/watch?v=gfoR3-DElyM

instead the rigid physics flows with the animation. moving her to front and back makes the physics move somewhere else, I cannot find any particular place where the problem occur please help...

adding english bone names & morph names to a model

Many MMD models have no English morph names and no English bone names. Is there yet any feature of mmd_tools or any other script which can automatically mass add English bone names and English morph names to a model? Pymeshio has a file called englishmap.py for translations. mmd_tools has a translations.py file for translating bone names. Is there any reason why these translations are an impossibility with mmd_tools?

Can't export changed model currectly

I import a pmx file change weight,then I export the model as pmx,I import it,The weight is same as origin。
Could you help me?
import file
000
make changes
001
import again
002

Using lightmap and multiple UV sets for GI

i have been trying to make an GI for MMD, but that must be compute some data from the second UV sets, because most of the model are work in the first UV sets with mirrored UV coordinates.

so is there any way you could make one that can be export multiple/second UV sets to the PMX model? so could you please fill in the blanks for me or others people, that would be great, thank you.

IK construct behaves differently in MMD/PMXE vs Blender

http://www.mediafire.com/download/wsruloxdxa3mcdj/test.pmx -- just the pmx, that should be all you need.

The "focus" bone is an IK structure intended to simplify animation of eye tracking in MMD; it is intended to be registered to another bone in MMD via the outside parent settings, at which point the model's eyes will track that bone.

  1. Load into MMD or PMXE/transform. Notice how the "focus" bone moves the eyes when moved.

  2. Import into Blender, switch to pose mode and adjust the "focus" bone. Although it is having some effect, it's behaving entirely differently than it does under MMD.

This is a complicated bone structure that I made a long time ago, and I'm not sure that all elements are necessary for its function in MMD-- it was hard to make, and so once I got it working, I haven't touched it since. Just starting to learn Blender animation and rigging and discovered this issue. It's not important to me, but could impact import/export of motions. I haven't experienced any problems with import/export related to this bone structure; your bone fixes have kept the structure entirely intact and working in MMD through import/export cycles.

Initial support for VMD export of model/camera

Initial support for VMD export of model/camera
631eb87

Hello @powroupi! Congratulations on all of your excellent efforts! Can you please clarify what you mean by "Initial support for VMD export of model/camera"? Should I announce to other people that MMD tools can now export VMD files? Or would that announcement be too soon?

translation of colors japanese to english

Big Japanese Color Translation List
https://sta.sh/0oc40p05k4s

I made a big Japanese to English translation dictionary for the names of colors for mmd_tools, both .csv and .py formats. You can download it from the link above. I tried to upload these 2 files to Github, but so far that is a major time-wasting headache and I haven't succeeded with it. But uploading them to my deviantart sta.sh took about 2 seconds, so there they are. I hope that @powroupi will add these translations to mmd_tools. If everything goes according to plan, I hope that I will be uploading more translations some time soon.

PMX import fails with some models - second issue

Again, I haven't dug into this, but hopefully you can make sense of the error log and give me some tips:

Traceback (most recent call last):
  File "/Users/myuserid/Library/Application Support/Blender/2.78/scripts/addons/mmd_tools/operators/fileio.py", line 156, in execute
    spa_blend_factor=self.spa_blend_factor,
  File "/Users/myuserid/Library/Application Support/Blender/2.78/scripts/addons/mmd_tools/core/pmx/importer.py", line 749, in execute
    self.__importBones()
  File "/Users/myuserid/Library/Application Support/Blender/2.78/scripts/addons/mmd_tools/core/pmx/importer.py", line 392, in __importBones
    self.__applyIk(i, pmx_bone, pose_bones)
  File "/Users/myuserid/Library/Application Support/Blender/2.78/scripts/addons/mmd_tools/core/pmx/importer.py", line 306, in __applyIk
    c.subtarget = ik_bone.name
AttributeError: 'NoneType' object has no attribute 'name'

This is for this model: http://gwenathan.deviantart.com/art/TDA-Pop-Raver-Miku-FINISHED-10-Model-DL-496738682

What's dummy bones for?

I used TDA Append Miku 1.00 Model. After Importing, I found that the plugin make some dummy bones. Why are dummy bones created, and do deleting these bones affect animations or something else?

Failed import/export test.

It was recommended that I try this fork. I tried a simple import/export test. I imported a model, and without even separating the materials, exported it. I think success in this test would mean getting the same model out as I put in, but I haven't found an MMD importer for which this is true yet.

In this case, the export gave me a model with all my vertices, but without any materials, bones, bodies, or joints. The older version of MMDTools that I have been using would have choked on the textures, but once those were removed, would have given me a valid .pmx. In fact, it has been, that's how I have been editing. Interestingly, deleting all textures from the model, and some materials, led to a valid export from your plugin.

Before and after files are in http://www.mediafire.com/download/y3na5z1eo52oe3g/beforeandafter.zip It's a pornographic model, so don't look if you find that offensive. I'm not attaching peripheral files like textures. I don't think you need them.

Blender 2.77. Not sure which MMDTools I'm using. Changelog suggest 0.4.5, but it looks like that's not updated with the code.

Thanks for the hard work, good luck with the fork.

What are shadow bones and dummy bones?

In an MMD model, there are no shadow bones and no dummy bones. But when an MMD model is imported by mmd_tools, shadow bones and dummy bones are added to the MMD model. Can someone please explain to me: What are these shadow bones and dummy bones and what function do they have? I am completely clueless and ignorant about this.

I was starting to think a little about how bone pose morphs can be added to MMD_tools, and this question entered into my mind.

Question - renaming of bones

As always, here's my latest video: https://www.youtube.com/watch?v=5GQkTrOy2kQ - once in a while I get questions about my workflow and I always refer people here, to this fork. Thanks again for making this addon so good @powroupi !

While I'm getting deep into Unreal Engine I have the need now to rename bones. So here are my questions:

  • in case I rename one of the MMD standard bones, and then later if I try to import motion (VMD) - will that work ? Maybe the VMD import uses a property and not a name ? Would you have any idea ?
  • one of the problems is Unreal Engine does not like "." in bones and renames it to "_". So far it works fine, but now I need a workflow that exports out of UE. Which brings me to my next question:
  • I am thinking maybe I should modify the code to rename all the mmd standard bones to english. And at the same time VMD import should still work. Which files should I look at. Any tips or suggestions would be great.

I am willing to do all the code myself, but wanted to check with you in case you know of some problems or limitations with existing code I need to be aware of.

Need help - how to add a rigid body

I've been trying and trying to add just one single rigid body with a dynamic & bone constraint and see it work. No luck :( Really need a nudge in the right direction. Here attached is a very simple blend file with a pmx and motion data loaded:

mmd-arm-test.blend.zip

I added a rigid body to the head bone (static) which is fine. Now I want to add another bone for hair and am stuck here. I don't understand how to create the joint, what is the order, is there a naming convention etc. If you are able to add a rigid body with a dynamic / damped track to this attached file, do let me know the steps to do it and I can take it from there. Thanks !

Readme.md links

The links in the readme file still point to the abandoned project.

Also, amazing project! +1

VPD pose import-export? (& BVH to VMD)

Hello @powroupi! How are you doing? I congratulate and thank you for all of your excellent work on MMD tools. Can you please add support for the import and export of .vpd (Vocaloid Pose Data) files? MMD tools already has support for import and export of .vmd files, so this should not be too difficult a task should it?

Question on Lat models

First - thanks for the awesome work on mmd_tools, I was able to cleanly export an FBX into Unreal Engine along with animation (including morphs) and here is the result: https://youtu.be/kX_KzIAYlK4

My question is on the Lat models - if you import them into Blender via mmd_tools - the face looks distorted. I don't have much idea about MMD textures and why this happens but my guess is I need to change some setting - for e.g. transparency, two-sided, unlit, no-shadow, etc. I can make out that there are 2 or 3 different textures in the face that combine to create the final result.

In case you know more about the special textures that a Lat model face uses - do give me some tips. My goal is to get a Lat model into Unreal Engine - and I am prepared to create a material from scratch. Any information that helps me understand the basics of MMD "special" materials would be appreciated. Thanks !

Material morph weirdness

Check out http://www.mediafire.com/download/8cbt1xc9j4s2i9a/sugianytoolstest.zip . toolstest.pmx is just the main model imported, separated, rejoined, and exported.

Bone and material morphs have been altered between the import and the export. Check out morph 97 in the original, rewritten to 102 in the new. The original is a bit redundant, probably from an import, doing a multiply 0 on all materials and on one material, but this is okay with MMD. After running it through sugiany devtest tools, the all-materials portion of the morph is lost.

Another example of this is morph 87 in the new pmx.

Advanced Morph Types

Presumably at some point in time, mmd_tools will have full support for advanced morph types (material morphs, UV morphs, bone pose morphs, group morphs). Drool. :-) So I thought that I would share what I have figured out about this subject so far. This data for advanced morph types is stored on an 'EMPTY' object which is parent of a character's mesh object and armature object. I loaded a model into Blender with mmd_tools which has all of these types of morphs, and here is some data that I found via the Blender scripting console:

>>> bpy.context.active_object.mmd_root.uv_morphs[0]['data'][0]['offset'].to_list()
[-0.08337914943695068, -0.11126798391342163, 0.0, 0.0]

>>> bpy.context.active_object.mmd_root.uv_morphs[0]['data'][0]['index']
4376

>>> bpy.context.active_object.mmd_root.material_morphs[0]['data'][0].to_dict()
{'diffuse_color': [0.0, 0.0, 0.0, 0.0], 'sphere_texture_factor': [0.0, 0.0, 0.0, 20.0], 
'specular_color': [0.0, 0.0, 0.0], 'offset_type': 1, 'related_mesh': 'ByakurenWith Straight Hair', 
'shininess': 0.0, 'material_id': 0, 'toon_texture_factor': [0.0, 0.0, 0.0, 0.0], 
'ambient_color': [0.0, 0.0, 0.0], 'texture_factor': [0.0, 0.0, 0.0, 0.0], 
'edge_weight': 0.0, 'edge_color': [0.0, 0.0, 0.0, 0.0]}


>>> bpy.context.active_object.mmd_root.bone_morphs[0].data[0].bone
'胸調整.L'

>>> bpy.context.active_object.mmd_root.bone_morphs[0].data[0].location
Vector((0.0, 0.0, 0.0))

>>> bpy.context.active_object.mmd_root.bone_morphs[0].data[0].rotation
Quaternion((0.9940563440322876, 0.1088668555021286, -2.4513144335561177e-13, 9.518605459390983e-09))

>>> bpy.context.active_object.mmd_root.group_morphs[0].data[0].keys()
['name', 'morph_type', 'factor']

Separate stage models

Hello
First I want apologize because I can't start new request in "Pull request" because its redirect to sugiany's side when I click to "New pull request" button. (I know, I am very beginner :P )

If it's ok, then I write here my request.
So my request is all stage objects/models will export separate automatically.
For example: I import the stage then in export or somewhere else I can click to a checkbox which is "Export each models separately" and then the plugin/blender will create different fbx file (if someone will export in fbx). First fbx will be a house, second chair, third table, etc...

It sounds big and difficult request, but hopefully can be created. :)

scaling confusion in mmd_tools

When an MMD model is imported into Blender using mmd_tools, by default it is scaled to 0.2 of its original size. Why is this done? The likely answer is that in MMD, each grid square is 5X5 units, while by default each Blender grid square is 1X1 unit.

Problem: Scaling confusion exists in mmd_tools.

The default scale for VMD (both import and export) and for VPD (both import and export) is 0.2. Now if someone imports a pose or animation with scale 0.2 and then exports it with scale 0.2, then by a straightforward mathematical calculation, someone should expect that the final result will be 1/25 of the size of the original size. This is a weird, confusing flaw of mmd_tools. And when an MMD model is imported, the default scale is 0.2 but when it is exported mmd_tools does not give the user even a clue of what the export scale is. More scaling confusion!

In fact, it is completely unnecessary to scale MMD models, poses or animations to 0.2 when importing them into Blender. Instead of doing that, it is possible to scale the Blender grid. I wrote this python code (below) to do exactly that. If someone runs this python script from the Blender text editor and then imports an MMD model with a scale of 1.0, it will look the same in Blender's camera view as it looks in MMD's camera view or model view when you import an MMD model into MMD.

Textures being exported in a fashion leading to PMXE errors

http://www.mediafire.com/file/8fnlakn0fkq7xmn/goldfish.zip contains fishtest.blend, the .pmx that it exports, the .tif that it exports, a .png created from that .tif, and the original .3ds file that was imported into Blender, then joined with an existing .pmx model I had laying around (just to simplify getting all the MMD data that meshes need to export).

If you load the .pmx into EosCustom3D's 1.1 English translation (available at http://eoscustom3d.deviantart.com/art/English-Pmx-Editor-v1-1-542100208) you get an error: "Failed to initialize drawing." You only get this error when textures\GOLDFISH.TIF exists and is accessible. Opening the texture in an image editing program, then exporting it, and using that texture, fixes the issue.

So, obvious workaround, but it looks like you might be exporting texture images in a less-than-ideal fashion.

PMX import fails with some models

I did not debug this, but posting the error trace, I'm sure you know what the problem is. If you give me a hint I can fix:

File "/Users/myuserid/Library/Application Support/Blender/2.78/scripts/addons/mmd_tools/operators/fileio.py", line 156, in execute
    spa_blend_factor=self.spa_blend_factor,
  File "/Users/myuserid/Library/Application Support/Blender/2.78/scripts/addons/mmd_tools/core/pmx/importer.py", line 767, in execute
    self.__importGroupMorphs()
  File "/Users/myuserid/Library/Application Support/Blender/2.78/scripts/addons/mmd_tools/core/pmx/importer.py", line 642, in __importGroupMorphs
    data.morph_type = morph_types[m.type_index()]
TypeError: bpy_struct: item.attr = val: enum "group_morphs" not found in ('material_morphs', 'uv_morphs', 'bone_morphs', 'vertex_morphs')

This is for this model (Miku. Luka is OK): http://senseitag.deviantart.com/art/DOWNLOAD-TDA-POP-IDOL-MIKU-and-LUKA-620761144

If it helps I can send the model privately.

Rotation limit of IK is not correctly imported

Here is the original X rotaion limit of right knee bone. It is 0.5~180.
mmd_leg_ik

Here is the imported X rotaion limit of right knee bone. It is 0~180.
blender_leg_ik

I think importer code is correct, but in blender, a positive value of minimum angle of IK is not allowed.

When I manually added "Limit Rotation Constraints", lots of imported motions works more properly.
fix_leg_ik

[GUIDE] I have a problem/suggestion/doubt what should I do?

I've opened this issue to guide new users who may not know about Github's workflow and came up to this repo.

Firstly, if you have any problem with the plugin or a suggestion/doubt you should check out the Wiki, especially the Known Issues section. You may find what you are looking there.

What should I do if I haven't found a solution to my problem in the Wiki?
If the solution isn't there, open a new issue explaining the problem with as much details as possible.

What should I do if I have a doubt/suggestion?
If you followed my advice and have already checked the Wiki. Then, it's time to open a new issue detailing your doubt/suggestion

Exporting uneditable PMXs

Another situation where mmd_tools is exporting a MMD readable model but not a PMXE readable model (corrupted header? I don't know.) Using PMXE from https://eoscustom3d.deviantart.com/art/English-Pmx-Editor-v1-1-542100208 . Bad .blend + .pmx are at http://www.mediafire.com/file/v31u19hsg3hexcv/badexports.zip . Apologies for the size of the file.

As to how I've created such a mess of a file: I have curve objects that I fit to my current version of a model. When I decide that some part isn't good enough, I import my current model, often just for placement and visualization, and adjust the curve, then create a mesh object from it. In these case, I don't need the entire model, my goal is really just to get a copy of my adjusted mesh out of Blender, which I can integrate into my model relatively worry free in PMXE. In the files provided, there are a few adjusted materials off to the side of the main model; those are all I care about getting out of Blender. After a bit of work, these files can accumulate several different MMD models; well, copies of the same model, really.

I'm sure that my style isn't the best for doing this, and any recommendations for ways I should be doing things differently are welcome. For example, is there some good, simple way to remove a MMD model from a scene? Deleting it from the outliner leaves a lot of debris. Eventually I managed to get my meshes exported from this file, but I'm not sure exactly how :)

However, I also think that mmd_tools probably shouldn't be exporting uneditable .pmx files.

More bone issues

I'm despairing of Blender and MMD ever actually agreeing.

http://www.mediafire.com/download/pk264oangu8343h/together2.pmx is a model with a lot of complicated bone work, including stuff demanding deformation tier. MMD, PMXE, and Blender + MMD Tools give three different interpretations of the base pose. The model isn't really working in any of these, but ideally, it ought to be wrong in the same way in all three. Although it has a -2 append ratio bone, that's not the problem in the default pose; it's something else.

For a quick pic, check out http://vasilnatalie.deviantart.com/art/One-skeleton-one-pose-three-interpretations-631274718 which has the three interpretations.

Morph translation

Hello
First of all, thank you your updates. You save my life. :)
Can you add a function which help to translate Morph japanese names to english?
"Rename bones to english" very handy so I though Morph translate also will be good.

(I wanted to add this in "Pull requests" but its appears on another developer site so I write here in Issues. I hope its appear here not there.)

A question and an idea

So this isn't an issue, so I'm not sure if there's some better way to express it. Please let me know if it's inappropriate to create an issue for this.

First of all, I'm wondering if there's a way to separate meshes into new MMD materials using mmd_tools. This is now the most important function that I need to use PMXE for.

The main reason I dislike unnecessary import/export cycles is because I lose quad structure. But...

I also have an idea. I don't know if it excites anybody, but in case it does: I've recently discovered I can use the way mmd_tools rips UV seamed vertices to restore these quads, just by marking everything as a seam and UV unwrapping. That way, when I re-import, there's only one possible quad for every original quad, and I can use tris-to-quads with 180 degree tolerances and get my original quad structure back, then remove doubles to restore mesh continuity.

But there are a number of reasons why this isn't ideal. Yet it could be managed automatically with import and export scripts. With an export option to rip quad edges on export, existing UV mapping could be maintained and there would be no need to sit through UV unwrapping, which takes far longer than an edge rip does when everything is a seam. With an import option to automatically restore quads when there was only one possible quad to generate, and possibly even merge the vertices of adjacent quads, this would be even faster and easier.

Of course, since this would quadruple your vertex count in MMD, it would need to be optional, and disabled by default. However I think it could be handy.

After VMD import with English bone names - how to do an FBX export of the animation properly

@powroupi as you said, importing a VMD is fine, the jp name on the property is being used.

I have a problem when now using the Blender "export to FBX" utility to export the animation.

When I look at the Dope Sheet / Graph Editor - I see all the japanese names for the animation data. So I think I need to convert these also.

Any suggestion where would be a good place to do it ? Maybe an option on VMD import ?

[QUESTION] What are shadow and dummy bones?

Hi, remember the person that I mentioned in #6 ? He is creating his first MMD model using this addon and is having trouble figuring out how to create a proper IK constraint to be exported. Sneaking through the code I found out that there are some special bones, those bones are not just hidden but moved to a different layer. Smart play ha ha! But, why do you hide those bones so much? What are they used for?

We really need to create an updated documentation, it will be helpful for both developers and users. And by the way, my friend is learning Japanese so he may help us to translate the updated documentation from English

toon textures?

Hey there Powroupi, How are you doing? Are you making any progress with toon textures?

It is possible to convert an MMD toon texture for Blender. Blender uses spherical gradient textures for mapping onto reflection (or normal) co-ordinates. You can convert the vertical gradient of a toon texture to a spherical gradient using the polar co-ordinates filter in GIMP or Photoshop. After importing the texture in Blender, change the X and Y sizes of the texture to 0.5. (Use the multiply blend mode.)

A toon texture could theoretically be converted to a ramp shader by Python scripting. MMD toon textures affect the coloring of shadows.

The main reason why I still prefer MMD over Blender for rendering (apart from speed and simplicity) is the lack of Blender support for toon textures.

'Convert Materials for Cycles' operator randomly crash Blender

I'm using Blender 2.78a, recent updated version of blender_mmd_tool ( b10cb8c ). When I import a model and hit Convert Materials for Cycles button, Blender randomly crash with no notification or alert. In terminal, I can see only EXCEPTION_ACCESS_VIOLATION error. How could I evade this issue?

UV morph indices lost on separate by materials

Test model for recreation at http://www.mediafire.com/file/qo3y8rakchp1bb8/UVmorphIssueDemo.pmx

To recreate: verify model has working UV morphs ("red" and "yellow", morphs 59 and 60); import to Blender; separate by materials; export. All actions accessed via buttons on toolshelf. Check exported .pmx; while the UV morphs remain, all indices are gone, so the UV morphs no longer do anything.

Note that this model is unusual in that it has UV morphs affecting vertices from multiple materials. Works in MMD, but PMXE doesn't like you doing that on UV morph creation, just something that happened along the way, basically.

Current workaround should be to preserve vertex order and save/load UV morphs from .csv in PMXE,.

Could this be related to cleaning shapekeys on separation? Don't see a dialogue for that anymore, so wasn't sure how to test further.

Vertex morph weirdness

Check out http://www.mediafire.com/download/jadx135w5pbn866/vertexmorphweirdness.zip . It contains three files: 4hoodies.pmx is the file I imported into Blender, untitled45.blend is the most recent Blender save, and untitled44.pmx is the exported file.

For several of my materials, I removed all shape keys so that I could use modifiers (I think just 'mirror' during this session). After applying modifiers, I recreate a basis shape key, mostly out of habit-- I've had trouble when failing to recreate a basis for each material and relying on joining materials to recreate the basis shape key.

Check out the vertex morphs. The first morph in the list is the blink. You'll notice that, even though the tank top somehow got all screwed up by this morph (probably Blender's fault, not mmd_tools' fault, although I'm not sure), the morph is still working on the face in Blender. However, on the exported file, the blink no longer works.

These morphs seem to have been reattached from their original materials. Deleting the vertices of a few of the hoodies in PMXE kills off all the facials.

In an attempt to work around this, I tried exporting with different materials as parent objects, or exporting as separated objects, but this happened no matter what I did.

mmd_bone.name_j is broken when using pose.paste(flipped=True)

Sometimes, mmd_bone.name_j is broken, and VMD importer fails to import a motion.
This problem is caused by pose.paste(flipped=True).

Reproducing:

  1. Select the armature
  2. Pose Mode
  3. Press A (select all bones)
  4. CTRL+C (copy pose)
  5. SHIFT+CTRL+V (paste pose(flip))
  6. Select right arm bone
  7. See Bone tab -> MMD Bone Tools -> Name(or Name eng). "右(right)" and "左(left)" are reversed.

I don't know whether this is my fault or unexpected issues.

Bone size too small

Hello
When I exported from Blender and imported to Unreal Engine then I get this message:

Warning The bone size is too small to create Physics Asset 'TestModel_PhysicsAsset' from Skeletal Mesh 'TestModel'. You will have to create physics asset manually.

Feature request: automatic generation of bones on export

As an example of the kind of file I'm looking at, consider http://www.mediafire.com/file/odxzbzvwu0wukxt/77114_Crow.zip which was released CC-BY 3.0 by BillA on www.blendswap.com (redistributed, as allowed by license, so that you don't have to register).

The model is intended for use with blender and has some vertex groups and rigging. When exporting the model to .pmx using mmd_tools (via Edit: Create Model, Edit: Attach Meshes, Model: Export), these vertex groups are lost.

My work-around for issues like this has been to use PMXE to create a model with bones using the same names as the vertex groups used by the .blend mesh, and to then import that model into the .blend file, join the .blend to the imported .pmx, and export it. This preserves the vertex groups of the original .blend file. (For anybody wanting to try this, note that mmd_tools chokes on .pmx files without any mesh data, so you'll need a perfunctory mesh, just a plane or something that you can delete afterwards.) As an example of the kind of file I would create, check out http://www.mediafire.com/file/0fgvg0k5h0k3a24/crowbones1.pmx (note that one of the bones is misnamed, which happens frequently.)

Typically, I'll also reposition the imported bones as appropriate to the original file's armature, and set appropriate parents.

This process is slow and completely brainless, with a lot of room for transcription errors. I think that makes it an ideal case for automation via mmd_tools. I also believe that one of the popular uses of mmd_tools is importing models from foreign formats into MMD (often characters ripped from games), and so automation of this would probably be useful to more people than just me.

Automatic generation of bones in order to preserve vertex groups, even in the absence of any decisions about position or heirarchy, would be useful, even without taking the extra step of positioning or creating an appropriate heirarchy. I can think of no cases where you wouldn't want vertex groups preserved into .pmx, and I think that any bone generation would make sense as a default, opt-out export option.

It may be the case that my workaround is a terrible, terrible way to do this, and some easier way to do it exists that I'm unaware of :) In that case, I'd love to hear about it.

importing .x files into Blender

The bad news is that Blender has no .x importer, but the good news is that @powroupi is going to program one for us next week? Right? Yay, @powroupi !

Okay, just joking around a little. 😄 In fact Blender does have a .x importer, but it is not good enough to come included with Blender, so you need to download it from here:

https://github.com/littleneo/directX_blender
https://github.com/littleneo/directX_blender/archive/master.zip
https://github.com/littleneo/directX_blender/issues

When I tried to import a .x file, I got this error message in the Blender system console:

    img = bel.image.new(path+'/'+filename)
  File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_directx_bel\bel\image.py", line 44, in new
    img.use_premultiply = premul
AttributeError: 'Image' object has no attribute 'use_premultiply'

Apparently .use_premultiply is not a possible image attribute in Blender 2.78, but I found a quick and simple bug fix for this issue. I just commented out these 4 lines in image.py and then this .x importer worked fine for me 😄 :

Line 44:     # img.use_premultiply = premul
Line 163:    # if type(img) != type(None) :
Line 164:         # img.use_premultiply = True
Line 238:             # img.use_premultiply = True

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.