imagination XD

realizing dream

[Tutorial] MMD 4 Unity

71 Comments

Flawless, I wish Bullet Physic comes to Unity 5. VMD Anim + FBX Anim demo.

So I found out how to Import PMD / PMX to Unity. My old trick uses Blender, PMD Importer, and FBX Exporter. It was like this below, (mine was old anyway…) *keep scrolling for a simpler way* Recipe

  1. One Teaspoon of Blender (I use 2.71)
  2. A cup of Sugiany Blender MMD Tools
  3. a PMD Model of course
  4. And 1Kg of Patients

Stereoarts’ MMD4Mecanim

And it was really long and hard and it doesn’t even have an automatic physics configuring! And then I found this good guy posts about MMD4Mecanim which only import PMD / PMX to Unity Assets folder and it’ll automatically do the magic and poof! You got PMD model on Unity.

MMD4U9

Any motions can be played with this

Why MMD4Unity ? Isn’t MMD just enough ?

  • Unity has Mecanim, it’s easier (for me) to animate especially a lazy person like me (too lazy to reanimate every locomotion for every model)
  • Unity 5 now has full access of epic post processing. Depth of Field! Bloom! Motion Blur! Edge Detection!
  • And many more…

What you’ll need for MMD4Mecanim,

  1. Unity
  2. Stereoarts’ MMD4Mecanim (download is on MMD4Mecanim_Beta_*.zip)
  3. A PMD / PMX Model.

NOTE FOR PMD Users : Since I see this only supports PMX, you have to convert your PMD to PMX first. Download PMX Editor, then open your PMD file and save it as PMX.

And here’s how to import your PMD / PMX Model to Unity

  1. Download and extract PMD / PMX Model, copy whole folder to Unity Assets folder
  2. MMD4U1
  3. Then you’ll found there’s a MMD4Mecanim assets file (It has Unity logo)
  4. MMD4U2
  5. Read the License agreement and then click process.
  6. If you have a VMD File (MMD’s Motion data), copy your VMD data to Unity Assets and put your VMD to Animation Clip field.
  7. MMD4U3
  8. Then press process
  9. MMD4U5
  10. Always remember to set Animation Type to Humanoid then press Apply. If you not, no animation can be played unless you import a VMD file.
  11. MMD4U6
  12. Remember to select your Animator controller and Check Apply Root Motion and turn on Bullet Physics
  13. Now add your processed FBX to your scene, it’s now compatible for all your Mecanim like ThirdPersonHumanoid. If you want to add VMD to your mecanim, just Create a New state then put your anim-ized VMD there, and play.
  14. MMD4U7
  15. MMD4U8
  16. Flawless isn’t it ?
Advertisements

Author: IMGVERTEX

Started making games since 13 year old. 3D CGI Weeaboo | VFX Otaku | Anime Researcher | Indie Game Dev | VR Chuunibyou

71 thoughts on “[Tutorial] MMD 4 Unity

  1. i’m still using old legacy animation XD
    need to learn basic mecanim in future.

    Soooo this will be new opportunity to create MMD game in unity eh?

    • Wew, why would you still using legacy animation ? It’s really difficult if you want to make them walk and you have many character.

      Yeah I guess so, but I’ll only use it for animation. Cause nothing I can use from MMD except the VMD. I mean all their models were copyrighted. I just use MMD to make motion then export it to VMD and convert it to FBX use it for mecanim. Most MMD models are well rigged so, it’s really easy to make animation using it.

  2. ok the scripts dont work for unity 5 and it doesn’t do the rest when i’m on the importing the pmd into unity help

  3. Pingback: Pssst! Still trying to get MMD models into Blender, Max or Maya? | MikuMikuBeat

  4. Oh my gosh, thank you! This was really helpful! :D

  5. Pingback: MEMEME Dance Cover | Anime Unity Experiment Part I | imagination XD

  6. Pingback: [C4D, Maya, Blender] Convert FBX to MMD | imagination XD

  7. So… it’s been more than half a year since the last comment, but I could use some help. This might require its own post in and of itself, or I should probably look somewhere else, but I’m trying to simply set up some static poses for a PMX file that I imported using MMD4Mecanim. I keep getting an “Animator is not playing a Playable” error. I also am clueless about how to set up an animation controller or animations (pitiful, I know). Maybe I could get help?

    • You should keyframe all bones and also make 2 keys of static poses. For instance, Frame 0 is Standing Pose, Frame 2 should be the same pose again. So MMD4Mecanim will able to read it as animation clip not as pose. Or maybe you forgot to set your pose as Humanoid ? Mecanim sometimes requires Humanoid.

      • …What do you mean by “keyframe all bones”? Do you mean edit every single one of the main bones into the Animation window? I’m sorry, I really am a complete newb when it comesto this stuff. If you want me to, I could send an email or something, we can talk about how to actually do this sort of work, as I have no clue where to begin. I feel way in over my head, but I really want to do this. So… could you help me with this?

      • …Okay, after tinkering with the Animator for a little while, I think I’m starting to understand it just a bit. Just a bit. Even still, it’s a bit challenging. One of the models I’m using has over 300 bones or so, it’s kinda daunting.

      • Aww man. I usually use select all (CTRL + A). But, you can only key for every bone you’ve rotated from base pose.

        For example, you have T-Pose on base pose, and you want to make hands down pose. You rotated L and R shoulder and give it a key on 1st frame and same key on 2nd frame. And so on. Other bone part like cape or anything else didn’t changed, so you don’t have to key it

      • All right, I’ve been tinkering with it for a little while, and the one thing that’s frustrating me to no end is that I can’t animate using the muscles. They’re all there in the “Animator” tab of the New Property menu, but it won’t allow me to add the muscle movements to the dopesheet. That would smooth out this entire process so much. But unfortunately, looks like I need to move each bone individually. Is that true, or is there a way to enable muscles?

      • Have you set your character to Humanoid ? They usually auto generate muscle, just don’t touch it, unless you’re pro on it.

      • All right, so all of my models are set to Humanoid, but I have another question: with the animation of the bones, are they animated based on the three basic axes in the editor, or are they based on the location of the joints?

      • I’m sure they’re animated based on Local Axis not World Axis

      • …Is there an easier way that we can stay in contact? Maybe over email or social media or something?

      • look at “contact me” page…

  8. Hello,

    I followed your tutorial and managed to import a model and animation without a problem.

    I am having a problem with Android build though. The animation wont play – character is stuck on first frame of animation. I tried to force the animation via scripting without success. It works in editor, works on windows, it doesnt workon Android.

    I’m using Unity 5.3.3 personal. I tried latest beta too (5.4).

    Any help appreciated. Also, thanks for this tutorial.

    • Hmm.. I never tried to Android. It could be MMD4Mecanim aren’t compatible for Android. Or maybe, you didn’t set your MMD Character as Humanoid.

      Also check your MMD Character Animator (have you assigned a start animation clip or not) or Animation Clip (Is it loop or not)

      MMD4Mecanim use Bullet Physics, but I think that shouldn’t be a problem.

      • Thanks for replying. I’ll try it again later. Maybe I misconfigurated something. I do have a default animation set in animator though.

        Could be that mmd4mecanim doesn’t support android. Haven’t tough about that.

      • Thanks for replying.

        I do have a default animation (set to converted vmd). As I said, it works flawlessly on windows and unity editor.
        I’ll try later with logcat to see if it shows any errors.

        Haven’t tought about the support on Android. Will check that out if I can get any info.

  9. I am having issues with getting the morphs to animate with the vmd files. I used to make it work in the past, but cant seem to get them to work now. Also, my cloths on my model are sticking in a weird direction. The morphs are there and are editable, it just seems that the vmd file isn’t including the facial morph portions.

    • I remember when I edit in MMD and export all keys to VMD, the facial wont work even on MMD. It seems Facial can’t be exported through MMD.

      • I downloaded it from deviantart. There was no editing by me. Is it true that none of your facial animations have worked? Have you had some success?

      • See my result GIF above. I tried to export all keys including facial VMD with MMD, when importing to Unity it got no facial motion. Happens on MMD too, my exported VMD didn’t have facial too

  10. Can someone help me with getting the cloth to hang properly to do. Does it have something to do with bullet physics

  11. https://www.youtube.com/watch?v=vAoGxvBAIBM By the way I just wanted to give a little proof of concept. The animation imports include the face morphs in this vid. Start from 1:15.

    • I got it to work:

      As shown in the video, you should drag in or use the exact prefab created from the converter. Then drag your motion data created from the program onto the prefab in the hierarchy.

      That way, you can see the default animcontroller they made for you. Then, just start the game

      • Yeah, yesterday I also tried with VMD it works with facial.

        This is how I do,
        1. Import all downloaded PMX file into Unity Assets folder
        2. There’ll be an .assets file to click, agree all of them
        3. There’ll appear VMD animation, I insert a VMD animation and press process.
        4. Wait until conversion progress done
        5. Once done, Put it on Scene. and then make New Animator Controller, make new idle state, insert your VMD
        Yeah works.

        Maybe some VMD can’t recognise some PMX facial. Like for example, Your VMD model is TDA Miku, I use VMD on Non TDA Yuzuki Yukari. No facial can be seen.

  12. Have you tried t work MMD4Mechanim LipSync? (I need it for text-to face mouth morph)

  13. Do you have any tips on fixing the hair and cloth bleeding throuDo you have any tips on fixing the hair and cloth bleeding through the model?

  14. thanks for share this

  15. Thank you for this post… Finally got Miku into Unity and into the Oculus… all in a day. Far less hassle than I thought it was going to be. Now I just have to do something with all this new found knowledge.

  16. I’ve successfully imported my model and converted it to fbx, but the problem is it has no textures applied, I read somewhere that you have to manually do this since the textures get broken cuz of original japanese names or something? I don’t really know how to fix the texture issue. My fbx has no textures applied, but I have the whole folder in unity which has all the textures, so I have the textures but they are not on the fbx model.

    • Well… Just try to put the texture in materials I guess ?

      The texture can’t be broken, it’s only material can’t find the texture.

      • just to check this should work for unity 5 right?
        I’ll look up how to apply textures to materials, I tried dragging the textures into the material folder hoping it would auto update the model but I guess it doesn’t work that way.

      • Yeah this works with Unity 5.

  17. Neroid here and with todays question.
    I got a mmd model “Jjin’s Aya Drevis” but i dont see the bone thingy you said and when the model its imported its also not textured.
    i have both a pmx and pmd but neither has that any help?

    • You sure your settings are correct or any missing files (also check your file naming is that is japanese word or english) ? And also does it work on MMD ? This MMD4Mecanim should work for all PMX file.

      • on mmd it has the textures/skins of the model and the rag for movements .but once added in blender it doesnt look like it have any animation possibilities,also there is no pose mode.
        In blender its just a normal model with her hands on
        lastly what setting are you referring to?
        Could it be also that my blender is 2.77?

      • Hmm this could be difficult, cause I never encountered problem like this.

        From what I do, I just download PMX model from site and then copy paste all to Unity Asset folder without touching with Blender.

        If you have PMX, then import to blender again, and then export to PMX, you may have some data loss.

      • I fixed it nvm . but please last help on how i can actually animate it?
        i dont have a vmd i just want to make it have like : iddle,running,walking :D

      • You can animate it with blender or any 3D Software. Just use the model and animate it. MMD also possible, animate on MMD then export to VMD and then import to Unity and then convert VMD using PMX2FBX, but this will require you to reimport your converted FBX.

        To animate with 3D software, export the animation clip as FBX and then import to unity. On Import setting, choose Standard to Humanoid. You’ll able to retarget your Imported FBX with animated FBX. Also remember to make the Animation Controller stuff, or else you’ll see nothing.

      • Do i need to convert the vmd ? with pmx2fbx cause if i remember correctly that program doesn’t work on my win 10

      • Look,
        > Don’t import to Unity first if you want to animate your PMX character with MMD.
        > You got your character in MMD
        > You animate your character in MMD
        > You export your animated character as VMD.
        > Import those VMD and all your PMX stuff like materials or somewhat like that.
        > Follow my guide correctly.
        > Remember to put your VMD in animation properties in your PMX before processing.
        > Process your PMX and VMD using PMX2FBX in Unity.
        > DONE! You got your PMX with VMD as animation clip! But it still in Generic, so you might need to change to Humanoid.

        And by the way, I use Windows 10 64-bit, and PMX2FBX works very fine. Use it on Unity, not in the .exe

  18. Hey i really love your tutorial, thank you so much for that.
    I am currently working on a project that converts VPD Data (Poses) to be used in Unity.
    If you are interested in that i can give you my Code (not completed yet).
    However i have a question: After i import my MMD to Unity i can not move the IK Bones around.
    Any Idea why that is the case?

    • Isn’t you can’t really move IK on Unity (Except you use plugin) ?

      It’ll automatically be like normal skinned mesh once you import it as Generic or Humanoid. Check your Animation import setting on your processed PMX, check if IK is on or not.

  19. Well basicly im trying to use VPD files in my unity project.
    I dont want animations, i just want the poses :)
    if (GameObject.Find(“上半身”)) GameObject.Find (“上半身”).transform.localRotation = new Quaternion (-0.281157F, 0.000000F, 0.000000F, 0.959662F);
    if (GameObject.Find(“上半身”)) GameObject.Find (“上半身”).transform.localPosition = new Vector3 (0F, 0F, -0F);
    Currently trying this, but with more or less 0 success.

    This data i get from the VPD files.

    • Firstly, you have to convert that VPD file into VMX. You see in MMD there’s Export Pose or Animation, choose animation it’ll export as VMX.

      Even it just pose you have to convert it to VMX. then you can put it on Unity

      • Yeah i did something like that. I just made an animation consisting out of 1 frame, and exported to VMD.
        Now i need to find out how these AnimationControllers work. Like how do i set the state from script in c#

  20. Il need one last time your assistance,i want the mmd4mechanim to not call at all bullet physics when game starts,its a pain since i have my own physics but i cant seem to find a solution since it keeps beeing called from script

    • Check the plugin before you convert, it probably in others or advanced tab, it says there use Bullet Physics, just uncheck that and use unity default instead

      • on another note ,cause i use character controller is there any way to not use rigidbody? or can you tell me a way to climb slopes and going down withought lavitating?

      • character controller don’t use rigidbody tho. Calculate y position by yourself. Usually I remember using CharacterController.Move can automatically apply gravity, but dunno. I kinda forgot

      • im at a bit loss here apologies for my incompetence,you see in unity i cant make my char whom is a mmd model go down stairs withought lavitating,if i apply to much gravity she isnt able to climb it up which causes a conflict mind beeing a bit more clear since i am bit confused :3

      • I kinda forgot how to apply gravity on character controller, but I guess you can google that (Sorry I couldn’t help at the moment).

        but am guessing is, put a collider whether box collider or mesh collider to stairs, then on your MMD, remove all physics, it can be turned off, that it says Bullet Physics, just uncheck that.

        If you use Character Controller, then for move I guess you can use .Move or SimpleMove, I remember they usually apply gravity. But just search on google to make sure

  21. Is it possible to import only the VMD? Or to import the VMD with the model, but separate the motion from that model and put it in the older model? I can’t really imagine myself recreating the animator tree and fixing the loops, bool and stuff just because I want to update the character with a single animation, it makes me feel so sad :'(

  22. How can I import a locked model to blender

  23. The licence on the latest version, at least the English one, has been changed to a state that you essentially can’t use the plugin to do anything. Even excluding the rights to use it to make videos or images, let alone usage in a Unity project.

    • Hmm, I checked their Readme, they didn’t state to forbid use of plugin tho, they just saying that you shouldn’t use MMD models for your game. For example, using TDA Miku model on your commercial / non commercial game without asking TDA for permission.

      • The English licence says:

        / About non standalone platform.

        Unsupported non standalone platform & I locked.
        You can’t upload build binary, movie and pictures.
        So please don’t modify or hack.

        The Japanese version is slightly clearer, and it doesn’t say anything about movies.
        There is also, in the Japanese Licence, the following (translated)

        Conversion model and use of motion

        Please do not use it except for private use in an environment not supported such as WebPlayer, WebGL, iOS, Android, UWP (HoloLens) etc.

        In addition, please do not use it except for private use in an environment with low reproducibility of material, facial expression morph, motion.
        (Please avoid using it damaging the character image.)

        So the differences between the two kinda make if vague enough that you really can’t do anything other than create an application for yourself and can’t share anything you create, movies, applications, images.

FEED ME

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s