Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Our response to Improbable’s blog post (and why you can keep working on your SpatialOS game). Read more here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

RELEASED: CP Morphing Lab - Morphing / Blend Shapes in Unity!

Discussion in 'Assets and Asset Store' started by remix, May 19, 2011.

  1. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61


    Because I can't really rename my previous thread, I just create a new one.

    Our tool for doing morphing has been released, and already updated!
    You can now visualize the morphing directly in your editor view!



    You can view our live example here.
    We have also tested this demo on mobile platforms, see the video here.

    This extension is available in the Unity's Asset Store for 70$.
     
    Last edited: Jul 20, 2011
  2. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    I have just created a GetSatisfaction page here. For those who have bought our extension, or others, you can post your questions, ideas or issue.
     
  3. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,251
    Will the physics only morph from a ball to a cube and back?
    Or can i morph other physics form into another like capsule and mesh colider?
     
  4. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    Hello.
    The physic morphing isn't limited to cube and ball. In fact, I morph the mesh from a mesh colider (and not physics form), so you can change it to any form you like.
     
  5. Jamdalu

    Jamdalu

    Joined:
    Mar 20, 2011
    Posts:
    2
    I am looking for a solution to export blendshape data from 3DSMax skin to simulate muscles - will your tool help do this???
     
  6. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,578
    Very impressive, I am just wondering what's the difference between this and Mega-Fier's morph?
     
    Last edited: Jun 14, 2011
  7. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    @ Jamdalu: Yes, you can use this tool for simulating muscles. Export your blendshapes as different meshes, set up the whole thing in Unity with the tool, and for example, link the rotation of the bones with the blendshapes.

    @ "I am da Bawss": I haven't tested Mega-Fier's, I have only seen the video demonstration of how it works. I don't know if they use the same way for doing morphing. The main difference I see for know is that you can use multiples blendshapes in one layer in Mega-Fier's, that will act like a sort of animation. I already had a suggestion for integrating something like that ^^.
     
  8. Fufurata1234

    Fufurata1234

    Joined:
    Jun 6, 2009
    Posts:
    45
    Hi,
    It is possible to use this tool for multi part models? Suppose I have some model with different parts and I want only the head to have morphs, is it possible? No offence, but morphing the whole model is a stupid idea. In most cases only some parts of model is supposed to have morphs applied. Is CP Morphing Lab able to deal above matter, or it is another useless toy?
     
  9. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    @ Makumba666: Yes it is possible, simply have your head in a separated mesh (so separated object) and apply the morpher operator only on this part. In our live example, for the second character customisation (where you can switch between boy and girl), the head is a separated object.
     
  10. Zyxil

    Zyxil

    Joined:
    Nov 23, 2009
    Posts:
    111
    @ReMix: Can your tool find the embedded BlendShapes that are inside a produced model. I'm thinking of the Evolver characters that can be exported from Evolver with facial animation BlendShapes.

    link: http://www.evolver.com

    (Evolver was bought by AutoDesk and is FREE right now to create characters for export!!! The prices show on the site, but are not charged. Just use the tools to transport then export.)

    Could I see an example screenshot of an Evolver character BlendShapes in the tool? If this works, I will definitely purchase.
     
    Last edited: Aug 22, 2011
  11. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Any change you will release a c# version of this tool?
     
  12. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    867
    Im definitely interested in this tool. It seems that you have multiple meshes for clothing as well. Did you create morph targets for the jacket and shirt as well?

    What I'd like to do is develop a character customization system in which you can change the character mesh, and select different clothing/accessories and they'll scale appropriately. Thoughts on the best way to set this up?

    Thanks!
     
  13. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    @Zyxil : I've juste tested Evolver and imported a character to Unity. The blend shapes are contained in the fbx information, not as separated meshes like the tools requires it. So you have to import the fbx (or any other format provided by Evolver) in your 3D modeling app and separate the blend shapes in multiple meshes.
    I've tried to do it with the Evolver example character, but for a reason I don't understand, importing the fbx in Softimage 2012 causes the app to crash ...
    But if you can do like I said, it will work. I'll try again later to make you a screenshot. (I'll find time to do this, I should be on holiday right now :) )

    @Seon : I wrote the extension in Unity Javascript because I'm more comfortable with it, but if you could tell me the advantages of a c# version, maybe I'll change it.

    @adamzeliasz : For the man/werewolf example, head and body are a single mesh, but for the second character customization, there are two meshes.
    For your need, your'll probably have to create blend shapes (fat, thin, muscular ...) for each different clothing mesh (but you can apply multiple textures on one single mesh). Same for accessories like bracelet I think. Maybe for bags and others like this it would be easier to have an empty game object linked to the character that act like a target for placing the accessories ?
    The difficulty will depend on how deep you want to be able to customize your characters, but for everything that need to change shape, this tool will help you!
     
  14. Zyxil

    Zyxil

    Joined:
    Nov 23, 2009
    Posts:
    111
    @ReMix: Thanks for checking, especially on holiday!! ;)

    There are 77 blendshapes in the each Evolver model and I have a bunch of models I'd like to animate. So manually creating meshes is way too much work. If you ever get around to supporting Evolver models, please let me know. (I'll stay subscribed to this thread.)
     
  15. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,136
    Yeah. I'm interested in supporting evolver models also.
     
  16. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    @Zyxil: Yes, indeed, extracting such many blendshapes to create single meshes would be painful. Maybe you could use a script in your modeling app that does this automatically ? And exports the model on the way ?
    For the moment, Unity's fbx importer doesn't support blendshapes, to read blendshapes directly from the fbx would probably require to rewrite the importer, via a plugin I think. This is out of my knowledge for the moment, sorry :).
     
  17. Zyxil

    Zyxil

    Joined:
    Nov 23, 2009
    Posts:
    111
    @ReMix: I bet that would be tough, especially since Unity manhandles the vertex info on import.
     
  18. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    867
    I just purchased your tool, fantastic job!

    I'm new to scripting and I'm building a character generator. I was wondering if you have a very simple way of exporting the slider choices in "play" mode to a file that I can load later, setting all the sliders to the previous saved position?

    Also, any thoughts on having a "random" button, allowing you to click it and all the sliders will be moved to various positions?

    Thanks! (I also emailed you these questions as well...)
     
  19. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    @adamzeliasz : Thanks guy !

    You've got a tough question. For saving the parameters to a file while in play mode, I think you will have to deal with something like a xml parser, or at least read/write a simple text file. Look around on the forums for xml parsing.
    You can also make a custom script that contains an array of values for your character's settings, apply this on an object, set the values and save this as a prefab, in the Resources folder for example, so you can access it from script easily.

    For the random button, you can simply loop on each morphtarget an apply Random.value on the weight. It should do the work.
    I haven't the extension on my computer at home, I'll try to get it and post some example code.
     
  20. Zyxil

    Zyxil

    Joined:
    Nov 23, 2009
    Posts:
    111
    Here are my file save/retrieve functions.

    With these you can save and retrieve any serializable object.

    These require the use of DotNetZip set up as described in my Unity Answers post: http://answers.unity3d.com/questions/17870/whats-the-best-way-to-implement-file-compression.html

    Code (csharp):
    1.  
    2. using System;
    3. using System.Collections.Generic;
    4. using System.Text;
    5. using Ionic.Zip;
    6. using System.IO;
    7. using System.Runtime.Serialization;
    8. using System.Runtime.Serialization.Formatters.Binary;
    9.  
    10. namespace Demeter
    11. {
    12.     public static class FileOperations
    13.     {
    14.         private const string __X = "CHANGETHISTEXTTOSOMETHINGELSE";
    15.  
    16.         public static void SaveFile<T>(string filePath, T item)
    17.         {
    18.             using (ZipFile zipFile = new ZipFile())
    19.             {
    20.                 zipFile.UseUnicodeAsNecessary = true;
    21.  
    22.                 //serialize item to memorystream
    23.                 using (MemoryStream m = new MemoryStream())
    24.                 {
    25.                     IFormatter formatter = new BinaryFormatter();
    26.                     formatter.Serialize(m, item);
    27.                     m.Position = 0;
    28.  
    29.                     ZipEntry zipEntry = zipFile.AddEntry("entry", m);
    30.                     zipEntry.UseUnicodeAsNecessary = true;
    31.                     zipEntry.Password = __X;
    32.  
    33.                     zipFile.Save(filePath);
    34.                 }
    35.             }
    36.         }
    37.  
    38.         public static T RetrieveFile<T>(string filePath)
    39.         {
    40.             // UnityEngine.Debug.Log("FO.RetieveFile<>() filePath: " + filePath);
    41.  
    42.             // *** DotNetZip
    43.             //get the stream from the archive
    44.             using (MemoryStream m = new MemoryStream())
    45.             {
    46.                 using (ZipFile zipFile = new ZipFile(filePath))
    47.                 {
    48.                     zipFile.UseUnicodeAsNecessary = true;
    49.  
    50.                     ZipEntry e = zipFile["entry"];
    51.                     e.UseUnicodeAsNecessary = true;
    52.                     e.Password = __X;
    53.                     e.Extract(m);
    54.                     m.Position = 0;
    55.  
    56.                     //now serialize it back to the correct type
    57.                     IFormatter formatter = new BinaryFormatter();
    58.                     T item = (T)formatter.Deserialize(m);
    59.  
    60.                     return item;
    61.                 }
    62.             }
    63.         }
    64.     }
    65. }
    66.  
     
  21. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    867
    An example would be awesome, thanks! You should also add that to the tool since I'm sure I won't be the only one who'd like that feature. :)
     
  22. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    867
    @Zyxil

    Thanks! I'm new to scripting, so do you have an example project with it working that I could pick apart and see how you set it up? :)
     
  23. Zyxil

    Zyxil

    Joined:
    Nov 23, 2009
    Posts:
    111
    @adamzeliasz

    I don't have an example project set up for these functions. They are designed as generic static functions to make them easy to use. Their implementation relies on a few of the more advanced capabilities of C#. I know that sounds silly, but each of them only uses one line of code in operation.

    I would recommend spending some time with Microsoft's training pages for C# (or JavaScript, if you prefer). You can download the free version of Visual Studio Express and learn using WinForms apps.

    http://www.google.com/search?q=learn+c#

    Once you have your sea legs with your language of choice, you can then dig into understanding how Unity scripting works.

    http://www.google.com/search?q=site:unity3d.com+scripting
     
  24. Zyxil

    Zyxil

    Joined:
    Nov 23, 2009
    Posts:
    111
    I should point out that those file operations functions are probably PC only. Most mobile devices will set restrictions what you can and cannot save to the file system and may prohibit it altogether.
     
  25. tonytage

    tonytage

    Joined:
    May 26, 2010
    Posts:
    28
    why my tranforem model's verts change 1435 to 1452

    I want to make nose blandshpe like pinokkio(long nose ) but my tranforem model' verts (tranforem from base model) is 1452(base model is 1435)

    I make it in maya 2011
    thank you for help

    like this picture




     
  26. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    @tonytage : Hello, thanks for using our product !

    When modifying the shape of the nose, I think maya has re-interpreted the normal smoothing and has probably added hard edges automatically.
    Try setting the fbx import settings of this model as followed : calculate normals and smoothing angle to maximum. Or simply use the menu button : " CreativePatterns / Model Import Settings / Set Max Normals "
    I think it should fix your issue.
     
  27. tonytage

    tonytage

    Joined:
    May 26, 2010
    Posts:
    28
  28. brzozowsky

    brzozowsky

    Joined:
    Sep 12, 2011
    Posts:
    39
    Is here a way to use the morphing lab with playmaker? I will control the morphing values with the playmaker gui. Is it possible?
     
  29. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    @tonytage : I've imported your models in Unity and effectively, it wasn't the same number of vertices. Like I said, use the button "Set Max Normals" in the menu "CreativePatterns / Model Import Settings" after selecting the concerned fbx in the project window (head.fbx and head2.fbx), it should remove any hard edge and result in the same number of vertices in each model.
    I've tried it here and the morpher applies correctly.

    @brzozowsky : Because I don't earn playmaker, I can't be certain it will work, but after a quick look at their documentation, I think it should be possible with not to much hard work. Because I store the values of each blendshape in a custom array, I think it would not be directly accessible to playmaker. But with a simple script that stores each blendshape's weight in separated variables (in our case, floats), this would be accessible with something like the EaseFloat action of playmaker.
     
  30. bumd198

    bumd198

    Joined:
    Nov 11, 2010
    Posts:
    37
    what about morphing meshes with hard edges? I tried morphing a FLAT plane which includes segments of shaped a box at the center of the plane(with the border for side faces of extrude), and other mesh for "after the extrude". It fails about vertex count when I import the meshes into unity and if I use max normals, its losing hard edges of the extruded model... AFAIK availability of this is not possible in unity at this point?
     
    Last edited: Sep 26, 2011
  31. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    @bumd198: What you're asking is possible but requires a bit of mesh tweaking. After I made the tool, I tried to morph from a sphere to a torus, by "opening" the sphere from the poles, it was a similar issue than yours.
    Here's a way to achieve what you want :
    - Edit your plane in your 3D app by forcing hard edges at the segments of the future box. If needed, you can even "break" the vertices.
    - Re-do the extruded state from this mesh. (I prefer to re-do it, because I think that simply breaking vertices in the old end-state would result in bad vertex index order)
    - refresh the morpher operator.

    I'll try something similar and check if i'ts ok, but I think this solution will work.
     
  32. bumd198

    bumd198

    Joined:
    Nov 11, 2010
    Posts:
    37
    Maybe I just don't get understand your workaround except the breaking vertexes part, well I tried breaking some vertexes and some FBX exporter options, no luck... Once unity imports normal data from the file for the extruded cube mesh, vertex count is true BUT for the flat plane, it removes vertexes.


     
    Last edited: Sep 26, 2011
  33. tonytage

    tonytage

    Joined:
    May 26, 2010
    Posts:
    28
    now I can make it thank for help
     
  34. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    827
    @bumd198 Did you get your example working?
     
  35. bumd198

    bumd198

    Joined:
    Nov 11, 2010
    Posts:
    37
    I found a closest solution about this, not good enough because it requires editing with HANDS.

    The problem was unity's optimization about normals, so it's calculates vertexes over normals (but 3d edit apps calculates normals over vertexes), so if you have identical angle normal at some point, it removes vertex so it can render faster... Solution is the change normal angle about at least 5 degree where you loose your vertex points. Sadly this solution may requires massive amount of normal face editing...

    Here is the screenshot after I rotate normals about 5 degree, lesser than 5 degree may not pass unity's optimization threshold.



    And this is the what you get in unity :



    So you can see visible normals over the flat plane, so another editing for moving vertexes so they will be identical in 3d space. After that this is the result :

     
    Last edited: Sep 27, 2011
  36. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    @bumd198: I found another workaround :

    After a few tests, I deducted that Unity or the fbx exporter is making some mesh optimisations that I don't want.
    When vertices with same normals are overlapping, they are merged. When overlapping vertices "hide" a face, the whole face is removed.

    To avoid those issues I got the idea to use the UVs : On the original plane, I break the UV seams of the cube faces, so even if vertices positions and normals are identical, the UVs will make the difference and the vertices will not be merged.
    The extruded version was easy to do, no explanations here.
    But for the non extruded plane, you must care attention to NOT overlap vertices, or the "future" side faces and vertices of the cube will be deleted.

    Look at those images :

     
  37. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    It gives this result :

     
  38. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    I've just tried to manually set the normals on the "future" sides of the cube to avoid the strange normals transition that appears while blending the shapes. It works fine but causes some graphic bugs at the pixels where those small faces are (bad lighting due to the different normal).
    I don't think that it could be possible to resolve this.

    An other solution would be to have a total flat plane and a cube that is hidden under the plane in the base shape, and above in the target, so it looks like an extrusion.
     
  39. remix

    remix

    Joined:
    Dec 11, 2009
    Posts:
    61
    It would give this :


    Of course, this solution could also be done with a skinned mesh and 2 deformers.
     
  40. bumd198

    bumd198

    Joined:
    Nov 11, 2010
    Posts:
    37
    Thanks for the solution, how I missed that UV thing can may solve this,

    It's just simply worked, Unwrapped the UV on extruded mesh, duplicated the mesh and edited the face for other morph target.

    Even now if the Unity calculates normals tangents on import options, Vertex count is the same.
     
    Last edited: Sep 27, 2011
  41. bumd198

    bumd198

    Joined:
    Nov 11, 2010
    Posts:
    37
    however, I have another problem now here is the screen shot :



    Looks like vertex order is changed. After the morphing it comes with this.
     
  42. bumd198

    bumd198

    Joined:
    Nov 11, 2010
    Posts:
    37
    Ok, it was my mistake to check triangulate option in FBX exporter, now all working. Thank you .
     
  43. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    1,834
    I'm getting a ton of compiler errors from CP Morphing Lab after switching my project's platform to iOS. (This is in Unity 4.0b7.) Examples:

    Assets/09 Asset Store packages/CPMorphingLab/Examples/Example1/Scripts/CameraController.js(64,28): BCE0019: 'transform' is not a member of 'Object'.
    Assets/09 Asset Store packages/CPMorphingLab/Examples/Example3/CharacterGUI2.js(246,144): BCE0019: 'maxApply' is not a member of 'Object'.
    Assets/09 Asset Store packages/CPMorphingLab/Examples/Example3/CharacterGUI2.js(359,118): BCE0019: 'maxApply' is not a member of 'Object'.

    We're looking at the scripts to see if we can figure out how to get rid of the errors, but have you got any suggestions or fixes?

    thanks
    Dave
     
  44. ReMix3D

    ReMix3D

    Joined:
    Sep 9, 2012
    Posts:
    6
    Hello Dave.
    I have also read your post on GetSatisfaction ( I will double post there also ).
    First, I must explain that Creative Patterns has ceased to exist since last October. I'm maintaining the plugin on my free time ( even though I have some projects for it). I can't afford a Unity license for now and don't have a beta access to Unity 4, so it will be really hard for me to debug your errors. Also, I'm on pc and I don't have any iOS devices to test on other platforms.

    Anyway, I will help you as mush as I can, with "blind" corrections ;).

    As far as I understand the errors you've pasted, it's mainly objects types errors.

    In CPMorphingLab/Examples/Example1/Scripts/CameraController.js :
    try to change line 2 from
    Code (csharp):
    1. private var mainCamera;
    to
    Code (csharp):
    1. private var mainCamera : Camera;
    But for the two others, I don't think and can correct them without more heavier modifications.

    If you want, try to delete the folder CPMorphingLab/Examples. As you may have guessed, it only contains examples for the tool, so you will at least get rid of the compiler errors from these scripts.
     
  45. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    1,834
    Thanks for the reply. Unfortunately, I still get compiler errors after deleting the Examples folder. If you're not supporting the tool anymore, it might be appropriate to note that on the Asset Store page.
     
  46. ReMix3D

    ReMix3D

    Joined:
    Sep 9, 2012
    Posts:
    6
    I don't say the plugin will not be supported anymore. It just that I can't correct issues for the upcoming Unity4 for now since I haven't access to the beta.
    I just hope that the final version will be released soon so I can grab the indie version and correct all the bugs you're talking about.
     
  47. Jonn Doo

    Jonn Doo

    Joined:
    Dec 2, 2012
    Posts:
    7
    Hello Dave
    Cp morphing lab does not work anymore since unity version 4.0
    The example scenes can not be morphed anymore.



    this is the original example. wolf and fat morpher are 1

    can you fix this?

    thx
     
  48. q542075534

    q542075534

    Joined:
    Apr 13, 2015
    Posts:
    1
    And now? have someone solved this problem?
     
  49. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    827
    If you check the authors profile it says he has not been on the forum since 2012 so I suspect you wont get a reply, if you need a morphing solution then use the basic built in option in Unity or get the more advanced morphing solution in assets such as MegaFiers.