imagination XD

realizing dream


26 Comments

[C4D, Maya, Blender] Convert FBX to MMD

This is not game dev related, but you can also import your MMD’ed FBX model to Unity, and it gives you better physics simulation using stereoarts’ MMD4Mecanim, read tutorial here.

Anyway, I maybe will stop posting about tutorial, cause I think I post too much that my blog almost become educational site. Beside, I think there’s enough tutorial on Unity. I’ll maybe post a research about porting 2D traditional anime to Unity 3D Cel shaded Anime or Unity tips, not tutorial anymore.

On my previous post about MMD, I only tell you how to import PMD or PMX to Unity, but now, I’ll tell about how to make your own MMD model using Maya, Blender, or Cinema4D. You can also import PMD model to Cinema 4D by using MMDTools.

If you already made model with Blender, you could simply jump to step 3, and export it as PMX by using Blender2Pmx.

In this post, I’ll use Cinema 4D.

What you need is

  1. c4dmmd0Prepare your 3D character and get it MMD compatible. Everything must have skin, don’t attach head mesh to head joint. Blendshape is supported on latest version of FBX (2014 or 2015).
  2. c4dmmd1Export to FBX
  3. c4dmmd2Now, open your blender. I use blender 2.76, yep it’s totally fine just use 2.72
  4. c4dmmd3If you had problem with built-in FBX importer, try use Experimental FBX as in 2.72, else, you have to copy experimental FBX from 2.72 to your blender addon folder, along with blender2pmx
  5. c4dmmd4from blender 2.72 folder, copy io_scene_fbx_experimental to your blender addon folder. Do the same with your blender2pmx.
  6. c4dmmd5After you installed both PMX and FBX plugin and turned it on, import your FBX by using Experimental FBX import. Also check automatic bone and manual orientation if you had problem with your model.
  7. c4dmmd6Select all by pressing CTRL + A and export to PMX
  8. c4dmmd7open your PMX Editor and open your PMX file
  9. c4dmmd8Well, now you got your own 3D Model on MMD. I don’t really know how to set up physics on PMX.


Leave a comment

MEMEME Dance Cover | Anime Unity Experiment Part I

itsudatte

MEMEME Dance cover animated with 12FPS convert to 24FPS via virtualDub.

Ah where i’ve been ?! Just came out from cave and decided to write an article on my blog. (^・ω・^ )

I want to test out / render my anime technique on Unity. Let’s get MEMEME by Teddyloid feat. Daoko dance motion as example. I still need to fix its shader toon effect cause it looks breaking. Maybe I need to make modifications on stereoarts.jp shader just like how I modify Unity-Chan shader. I’ve seen how Guilty Gear builds their 3D Anime style but I think it’s very very very long and complex (as always, my brain starts say “Ain’t nobody got time for that!”). So this is my own 3D Anime method.

Shader

On my earlier animation, I used modified Unity-chan shader. Since Stereoarts’ shader was compiled to cginc, it’s kinda difficult to modify it. I need to add Normal map and fix its toon ramp. You maybe say, Normal map is stupid to Anime, but you can make fake cloth fold by using normal map, I’m not going to make detail with Normal map, just fake cloth fold cause Anime without cloth fold is weird…

Unity Personal (64bit) - newshader.unity - New Unity Project - PC, Mac & Linux Standalone DX11
Unity-chan shader

  • Pros
    • Runs SSAO nicely (modified only)
    • Sometimes can give you really nice result
  • Cons
    • Not Support DX11
    • Can cause overbright sometimes
    • No outline color controller
    • Normal map has no function at all
    • No DoF / SSAO support (original one)
    • Many things to be set
    • Specular ?! Do you really think anime has Specular reflection ?

Unity Personal (64bit) - itsudatte.unity - New Unity Project - PC, Mac & Linux Standalone DX11_4

Stereoarts.jp shader

  • Pros
    • Support DX11 / Global Illumination
    • Full control
  • Cons
    • No normal map for fake cloth folds
    • SSAO makes it looks darker and unrealistic

Scene

So about 2 Cameras, I have to use Forward rendering cause deffered can’t render depth camera.
Why do you need Depth Camera ? Cause, if you want to have SSAO / Motion Blur / any other Post effect only on environment, then you have to split / make 2 cameras. 1 for environment and 1 for character. The minus is, Character won’t cast shadow. Your character / actor must have their own layer, for example “Actor” so in your Actor Camera, set culling mask to Actor only, depth = 1, and set clear flag to depth only. Remember to put Actor camera as a children of Environment camera. So you only need to animate environment camera.

For environment post processing, you can use effect like Depth of Field (but it wont affect actor), motion blur, SSAO, and even paint effect. Leave actor camera no effect.

Also, if you want to make games instead of animation, you can use deffered or just single camera and use baked AO instead of SSAO. There’s no such SSAO on anime character.

I’ve been made modified Unity’s SSAO that cull actors layer, but it doesn’t work and it only shows environment no actors.

Motion

Background motion blur

Background motion blur

Anime usually has framerate of 12FPS and doubled / repeat it to 24FPS cause most film has framerate of 23.976 / 24FPS. I much prefer full 24 FPS than doubled 12FPS. To convert 12FPS to 24FPS, I use virtualDub. First, I render 12FPS on Unity then import on VirtualDub (Source 12FPS and convert to 24FPS) and done, it seems like the frame was doubled to become 24FPS.

As on Guilty Gear, they draw every motion on every frame and use step interpolation. Although it looks very anime style, but it’s very complex and took very long time. Simply decreasing framerate will do the same even you use Spline interpolation animation like mine. “Wait! The game should run in 60FPS! You can’t simply decreasing framerate to 12FPS to have anime looks!” Man! Think, readers! Think! Decreasing frame rate is possible via FBX (on Unity it should be named “samples”). I’ve tried compressing keyframe / frame rate through FBX.

Anyway more research are coming soon!

Read more about MMD on Unity
https://laboratoriesx86.wordpress.com/2015/04/26/tutorial-mmd-4-unity/


80 Comments

[Tutorial] MMD 4 Unity

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 ?


12 Comments

Joint-based Hair / Cloth Physics for Unity

I was doing the MMD4Unity research. I do this because, on Google, if you want a Hair Physics, you have to wrote a script, or key frame it naturally in your model. Ain’t nobody got time for that keyframing! So, this might be very useful for easy Joint-based hair / cloth physics, even wrote a script was useful too.

Okay, so it’ll be like this. It could be very awesomely epic if you are not lazy to set the character joint setting.

“It’s long and complicated, i better use keyframe method.” Yeah true, but what to do when the hair colliding object because of your keyframing method ?

Let’s get Neru Akita as example (Model from MMD, some motion from Unity-chan).

Unity 2014-07-27 14-07-06-60_2

1. Now Select cloth / hair bones and then add Capsule Collider like the picture below.
1(bones)

2. After that, adjust the size of the colliders and then add Character Joint.
2(bones)

3. If your character has a Character Controller on it / Playable, Open Tags & Layer, add 2 layers. Set ‘Player’ layer to object that has Character Controller on it. Else, set the object that you want to have a hair / cloth physics like Hair Bones1, Hair Bones2, and so on, or Hair/Cloth physics collider like MidSpine (That has Collider, so hair / cloth wont clip like hell). Basically, Just set Cloth Layer to Skinned Mesh Renderer, and set it to all children.
3b (Bones)

4. Go to your character controller script. Whatever script is OK as long as its located on Object that has Character Controller on it. Don’t make a new script. Just add this line to function Start() or void Start(). Works on both C# and JS. 8 is Cloth layer, 9 is Player layer. it’s all up to you on what layer you set the Cloth or Player layer. If you set cloth layer to 10, then write 10.

Physics.IgnoreLayerCollision(8,9);

3c (bones)
5. Alright now let’s add Rigidbody on cloth’s / hair’s root bone. For the root of the cloth (like this below), turn on isKinematic and turn off useGravity. Root doesn’t need a Character Joint, Collider is optional.

4 (bones)
6. Now set the Character Joint’s connected body. For instance, 1 (Cloth Root), 2 (1’s child), 3 (2’s child). 3’s connected body is 2, 2’s connected body is 1, and 1 doesn’t have a Character Joint. Like the picture below.
5 (bones)
7. Set bone’s swing limit, spring, high twist limit, low twist limit that suits to your model.
6 (bones)
8. Now add some collider to body that Hair or cloth will collide. Remember to set the body layer to CLOTH, so your character controller wont collide it. I add the colliders on Body, Hands, and Head.
7 (bones)

Because if you don’t add colliders, it’ll look like this:
Unity 2014-07-27 14-07-06-60

Now look! A cloths dynamic! It much better than the method I use on Wild West Showdown (Skinned Cloth). Look at her front hair and tie.
Unity 2014-07-27 14-07-06-60_1

 

As I said, I leave making games because I need to level up my CG level. I said I was give up right ? No, and never. I just need to learn to make a better CG Artwork. I’m currently making a mascot model for Imagination, named Imajine-chan. but, I don’t have an inspiration for her character design.

EDIT : “My Character raycast’s script is broken because of this.” Well, you could replace Cloth to IgnoreRaycast layer.