Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Maya To Unity importing decimated mesh with Blend Shapes

Discussion in 'Asset Importing & Exporting' started by metaphysician, Sep 13, 2016.

  1. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    hey folks! i've got a tricky situation here. i'm dealing with a Blender -> Maya -> Unity workflow, using character models from Daz3d. this is purely for personal research. i'm not distributing a game, so i'm not violating licensing. what i want to do is using ONE slider, smoothly morph from one shape to another in Unity. since Daz exports every single morph, i decided to instead export the objects as OBJ files to Blender and then join them as a shape key.

    this gets me a mesh that is too large to import into Unity, so it loses Blend Shapes. so then i Decimated the models in Blender using Unsubdivide and joined them as Shape Keys. this works perfectly but screws up the UV texture placement. Any other type of Decimation results in slightly different vertex counts between the meshes so after Decimation they can't be joined again.

    rats. so i decide to use Maya LT to create a Blend Shape from my original meshes (which DO have equal verts and are the same geometry). that works fine, and Mesh->Reduce works fine as well. but then exporting to Unity results in 'vertex count does not match the base object' and thus no exporting of the Blend Shape.

    now in this case the order was: Import both shapes->Blend Shape->Reduce. so i suppose that what i should do again is to Reduce first then Blend Shape. but that will mean that Reduce has to result in an absolutely equal reduction both in terms of vert count and order as well between the two shapes. i'm aware that you can set a vert count limit but the results as compared to a percentage reduction are significantly worse. plus there seems to be a case of vert order as well as count.

    anyone encountered this issue in Maya-> Unity workflows? how did you get around it? any advice appreciated! and yes Daz Decimator would probably solve my issues but i don't want to pay $100 for a tool i'm just using for personal reasons. alternately if you have a decimation strategy in Blender that would be fine too. i'll keep plugging away at it in the meantime.
     
    sanmn19 likes this.
  2. sanmn19

    sanmn19

    Joined:
    Jun 30, 2013
    Posts:
    56
    Did you ever find a solution to this? Please let me know
     
  3. vidi

    vidi

    Joined:
    Oct 14, 2012
    Posts:
    175
    Not really, It depends on your workflow

    For export from DAZ and keep the Morphtargets you need, set every single Morph (100%) as a key in the timeline, and export the Figure with FBX Menue (animation and morph must be selected )
    Unity will list all Keys from these animation as Morphtarget. (aka shape keys aka Blend Shape ... )
     
    Last edited: Jun 4, 2017
  4. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    hey folks - sorry for the very long wait. here's a very long and hopefully informative reply on what i've found out trough a lot of trial and error.

    to start with, i did not get a great solution on decimation for this situation. Maya definitely did not work out. i did find a reasonably useful method in Blender using a setting on the Decimate modifier called Unsubdivide but it messes up the UVs so unless you remap or fix textures afterwards, or use the node based materials in Cycles or Blender Render and then bake, it's not a solution.

    so, oddly enough, i found direct export of FBX from Daz3D seems to work best, at least in 4.9 anyway. i thought i had remembered that exporting of FBXs from Daz3D was troublesome, but that seems to be smoothed over at this point. you can export a rigged figure that just works fine. you can even export the morphs, though you do have to deal with setting up the morph export rules. this can be useful if you just want to bake certain morphs into the shape, while keeping others dynamic.

    overall my biggest issue on the morphing front in Unity was just having to export and keep track of the dozens of blend shapes/shape keys/morphs i used to customize the model. this also was one of the reasons i didn't use the Morph3D characters when they became available. then i found out you can create your own custom groupings of morphs in Daz3D. this discovery was a huge timesaver, as the morph data was copied to the one setting and the one setting did all the work instead of having to remember all the individual settings you had to use to recreate the same shape. furthermore on export it seems that it didn't require all of the subgroup morphs to do its work, so less blend shapes to look at - that's a win! here's the post on that:https://www.daz3d.com/forums/discussion/106266/saving-a-character-morph-as-a-dial-preset

    the vertex/poly limit on import is still an issue, but what will likely trigger it is clothing and hair, not the model, and if you export the model as different parts and don't join them up you have a good chance to stay under it. All the Genesis 1,2,3, (stay away from Genesis 8 if you want to animate. it's broken right now) figures use less than 20K verts each by themselves, but if your character has a bodysuit with a lot of detail (like the GSuit for example)or detailed hair, that drives it up in a hurry. and to clarify, the vert limit in Unity is also a triangle/quad limit. which means that my G1 figure comes in at 38K just by itself. G2 is a bit more i believe but but G3 and G8 both use less than G1. if you export from Daz you can keep the objects separate so you don't hit the limit.

    so, my end advice - just go from Daz3D to Unity. keeping objects both separate and rigged properly can be an issue, but potentially there are workarounds. you can copy a skeleton via script and apply that to any object. you could also simply export several skeletons, one for each part, and as long as the node hierarchy is kept you'd be fine, and things like hair can often be exported statically without rigging and parented later to the bone.

    one last caveat here - full body morphs, especially ones that are scaling bones, create special issues. in my example i wanted the character to 'hulk out', but that ends up creating vertex moves that are not in alignment with the bone in the skeleton. this means your animations will be deformed on the morphed character outside of T-Pose. in my case, very long fingers happened. solution in that case is either be able to scale and re-position the bones dynamically, independent of the mesh (i have no idea how that's done but possibly tools like Skele could help?). my solution was since it only affected the hands, i just removed all the hand bones in the rig and set the shape manually when exporting in Daz. my advice is if you have a morph sequence that is this extreme, you use a separate model positioned just for that and replace the mesh with your playable once the sequence ends.

    anyway sorry for the post length but as shape morphing is not as common of a need in Unity, i thought my findings may helpful to someone. for more information on Daz3D and Unity workflows go to this Youtube Channel:https://www.youtube.com/user/cgarossi
     
    Last edited: Jun 28, 2017
    sanmn19 likes this.