You're blocking ads, which pay for BlenderNation. Read about other ways to support us.

MetaMorph - Blender Shapekeys for Unity Game Engine

16

Foolish Frost is working on a toolkit which allows mesh animations in the Unity game engine being created with Blender’s shapekeys.

Foolish Frost writes:

I've been working with Unity since the first day it was released for windows, and have always been interested in how it works with Blender.
The ease of taking an animated character from Blender into unity and just having it work without a ton of tweaking amazed me.

...But shapekeys, the mesh morph system for Blender, didn't work.

I came to the conclusion the current methods did not work for importing shapes, for the following reasons:

  • Importing the shapes generally took reimporting the mesh for every shape, and hoping the mesh data all read the same in regards to the number and order of verts. (They never did)
  • They tended to be slow, updating the whole mesh every frame, dropping frame rates on complex meshes regardless of what was morphed.
  • Most didn't have any API built in to easilly get started using it, and were no more than concept proofs.

After a month of examining the possible options, I came to the conclusion I couldn't find anything that would work in a production environment.
I'm not saying that none of them worked, Just that they did not seem to be solutions I would have paid for and used. That got me thinking about what I WOULD pay for in a tool

  • It would need to use a standard file format for storing morph shapes that can easilly be applied to a mesh regardless of how the importer organized it.
  • It would need to be fast, and only do as much work as needed to change the morphing areas of hte mesh.
  • It would need to be able to stick the UV seams of the mesh back together after all morphs are applied to the mesh. (to stop tearing from float errors on xyz position)
  • It would need to be able to export/import full animation made up of possibly dozens of shapekeys, and play them back perfectly in synch with bone animation.
  • A full API for other coders to make use of it without having to rewrite the MetaMorph script.

Based on that laundry list of features, I started coding MetaMorph. It includes a Diff Map exporter for Blender, The MetaMorph code in UnityScript for Unity, and all needed files to test it out. The project contains the full scene, but the only file you need for your own projects is MetaMorph.py.

Charon MoonyMetaMorph is a Unity3d and Blender3d toolkit that allows mesh animation in Unity games using Blender shapekeys. It includes an export script for Blender that converts shapekeys into Diff maps and saves the animation data as text files. The MetaMorph script for Unity can read the Diff maps and animation data in order to play back the morph animations in real time.

Project Link:
http://rezzable.com/blogs/foolish-frost/presenting-metamorph-toolkit-blender-and-unity

16 Comments

  1. Genuinely awesome!

    I tinkered with Unity a while back, and this was one of the biggest features lacking in it's Blender compatibility. I'll be on keeping an eye on this, well done.

  2. Wirklich genial! Ich mit Unity eine Weile zurück, gebastelt und das war einer der größten Features fehlen in seiner Blender-Kompatibilität. Ich werde ein Auge auf dieses, gut gemacht werden.

  3. I have been using Unity recently and have been amazed by the latest update that reads the new 2.56 blender files directly i.e. no FBX import/export required. It even works with all the modifiers that I regularly use in my models. Just BRILLIANT!

    I have not used much in the way of animation yet but I can see MetaMorph will be a welcome addition to the toolset.

    Thank you.

  4. Blenderificus on

    THIS IS AWESOME!!!!!! I've needed shapkeys in Unity for a LONG TIME NOW. Considering that other modern engines handle shapekeys(blendshapes, vertex keys, etc), but Unity doesn't; this brings unity into the modern era of game engines.

    Thank you Foolish frost, You've just opened up MANY doors in Unity working with Blender.

  5. I followed the unity3d development some time ago.

    Excerpt from the development thread:

    Linux isn't a market.
    We don't develop for Linux.

    At this moment unity3d was completely useless for me.

  6. i hope this is up on unity sites too. imagine being able to easily target facial animations (or whatever is shapekeyed) within the unity kit. while i would want to produce a CG movie in blender for a game project, a lot of those information/exposition cutscenes use in-game models. i only glanced at unity real quickly and kinda wrote it off as a game builder app for iphones (i know it does other stuff, but honestly from the chatter that goes on over at the main site's forums idevice is the target) now if only i had a better understanding of shapekeys... regular bone-driven is hardly known to me.

    to the internets!

  7. @HumanBlade

    Nope. Unity 3d is actually a full game development platform for windows, osx, and even usable inside web viewers for those two platforms. It has enough features to actually run a aaa game, IF the team releasing it has the skill to produce on that level.

    It's probably the highest end engine on the market per dollar today, and that does not even count the free indy version.

  8. If it is a repost, I didn't see it so thanks for posting this! I can't wait to try it out as i'm designing a Unity game now and I was planning to do all animations via bones but now I won't have to. :)

  9. Metamorph for Android?

    Thanks for sharing the script. It worked for me wonderfully standalone on Mac, but when I tried to build my game for Android, I encountered the BCE0019 error. The compiler complained that 'sharedMesh' and 'mesh' are not members of 'UnityEngine.Component' (MetaMorph.js, lines 146 and 148). I am new to unity and have no clue what's going on. Please help!

Leave A Reply

To add a profile picture to your message, register your email address with Gravatar.com. To protect your email address, create an account on BlenderNation and log in when posting a message.