Hi all, first time poster here and Unity newcomer.
I’ve reached a hurdle in one of my projects that is currently threatening its creation. At least, within the Unity engine. In interest of efficiency I’ll keep the synopsis of the situation short;
I’m a beginning modeller/animator who is seeking to more or less port Blender animations into a game engine to take advantage of internal VR support. At this time I’m not looking to create anything beyond this as it is simply out of my ability. This is in effort to release the animations in both video and VR formats. The latter of which I’ve been reasonably successful in tests
However, as the title suggests I’ve ran into a huge hurdle that is threatening this multimedia plan. The (current) animations are of a cartoony nature and demand for a specific type of non-spherical and non-symmetrical eyes, and of course for them to remain in this exact shape as I move the iris and pupil across them. The way I solved this in Blender is by use of a Lattice deform constraint (via the method illustrated bellow.)
But as I understand, and please do correct me if I’m wrong, Unity doesn’t support mesh constraints. Which is a problem, as the assets for these animations demand it and are all but done and final. The only thing I can modify is the character in questions actual eyeball meshes and the way they are animated.
So my question is quite simple; are there any applicable alternatives to my situation that can still be applied at this stage? I would be really, really appreciative of any hints, knowledge, references, links, and/or documents you may be willing to share, as I’m getting mighty desperate.
Thank you in advance for reading and potentially replying.
Welcome Puma.
This is a really vexing issue, but nothing that can’t be overcome.
One question that is important to consider which I don’t think was in your post is - does this need to be real-time controlled/random based on player input, or can it be real-time ‘set’ on a timeline, like an animated NPC character that has some controlled dialogue.
Whatever the answer is - there are basically three options you have available for a setup - that can address both needs.
I’ll detail the problem which you stated above and give two workable solutions, and let you work it out which is best to use for your situation.
Just so you know - I’m not a blender user, so this information will be generic to 3D and rigging, not software specific.
The problem is Unity does not capture software specific things like constraints, lattice deformers and animation controllers by default. There are workarounds, but since I’m a Max artist I only know how to manipulate things in that software.
Since Unity does not capture lattice deformers or constraints, the setup will either require morphs or bones. Morphs in blender is called something else (shape tweens or blend shapes?).
Morphs can be generated in your 3D package and captured in the export/import. Once in Unity set up the morphs as needed and animate between them at run-time.
The alternative is bones, but to get the non-spherical eyes to animate properly in the animation package the deformer will need to be a non uniform scaled bone. Unity doesn’t really like this, but with Unity 5 it is possible (untested but documented in the U5 release notes) to get Unity to accept it on import. Here is a real-time workable solution by William Vaughan that is demonstrated in Lightwave. This is a very simple setup that can be extended pretty simply, and can also be tested with little effort in Unity.
The third and final option is to look into Mega-fiers on the asset store. Personally I’d troubshoot/test the nonuniform bone setup as extensively as possible. Then if bones don’t work as desired, I’d try morphs, and lastly get Mega-fiers if no other workable solution can be obtained. I do not own Mega-fiers but it looks/sounds like a great solution that addresses many issues similar to the one you have encountered.
@theANMATOR2b
First and foremost I’d like to thank you for taking the time to write up such an extensive list of suggestions and possible solutions. I can’t express enough how much such interest and generosity is appreciated.
At this time I unfortunately can’t report success yet, but I’ll make sure to read up on the methods you’ve provided. I actually did try scaling in Unity before, but to no effect at the time. But I’ll make sure to take a look at the documentation to see where I went wrong.
In case I find a solution, I’ll make sure report back here on which it was. It should hopefully save a future person some frustration.
Alright, so a few tests in I’ve got a rudimentary test model in with all features that I needed to make this work. From here on out everything should work fine. Let me share what worked and to a degree what didn’t. For a quick reference of what those features are/were;
IK target functionality for character movement (animateable in Blender only)
Easily portable from Blender to Unity 5 for sake of efficiency and time.
The conditions to making it work;
The mesh itself can’t rely on any constraints such as Lattices. If they’re present find alternatives to them. I found, as per suggested in this thread, that non-uniform bone scaling works well in a subset of scenarios. You’ll have less deform control than with Lattices, but it’s a very good alternative.
If there are Shape Keys (more commonly known as Blend Shapes) present in your model that you wish to be exported to Unity, you have to apply the Subsurface modifier before exporting. If you don’t do this, Unity will ignore and remove the Blend Shapes upon import. And while applying Modifiers to an Object containing Shape Keys is a big pain, don’t despair there are ways of doing it. I’m currently still looking into ways of simplifying the process.
3a)
From Blender export your characters as .fbx files with the version set to ‘‘FBX 6.1 ASCII.’’ Leaving the version on the default ‘‘FBX 7.4 Binary’’ will cause some of your actions/animations to not be imported. However, with this setting leaving your export scale to ‘‘1’’ will likely scale your characters down to 1/100th of it’s original scale. So to fix this you can either set your FBX export scale to ‘‘100.00’’ in Blender, or scale up the X, Y, and Z axis scales to ‘‘100’’ each in the prefab in Unity itself. I recommend doing it Blender right away so you end up with a neat drag-and-drop ready-to-use prefab.
3b)
As to why .fbx is so important; while it’s possible to use direct .blend files in Unity, doing so with non-uniform bone scaled objects will cause it to ignore (all) bone scaling. In simple terms, it’ll reset your non-uniform objects to be uniform again. I have not been successful using any other format than .fbx.
3c)
This may not apply to everyone, but exporting with this method will also allow for bone scaled keyframed animations. So if you have animations that rely on it, it’ll work just fine.
If you’re going to have the eye bones tracked to an eye focus bone- or eye focus bones, with non-uniform eyes, don’t use the ‘‘Track To’’ constraint. Rather, use ‘‘Inverse Kinematics.’’
Awesome Puma - nice writeup.
So the Lightwave setup video was essentially the setup you went with?
Thankfully our animation knowledge can be used across softwares.
The principles of animation are the glue that keeps us in touch and able to communicate across the software divides.
Glad you found a workable solution.
Show us a video of the eyes in action when you have a chance.