Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Skinn Pro & Free - Skin & Blendshape Projection + Much More

Discussion in 'Assets and Asset Store' started by cwmanley, Feb 15, 2017.

  1. petersx

    petersx

    Joined:
    Mar 5, 2015
    Posts:
    229
    Thanks, this solve the problem :)
     
    cwmanley likes this.
  2. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    Hi @cwmanley
    Very much enjoying using your asset. I'm using the current version on itch.io in both Unity 2018.4 and 2019.3.

    I'm using the TextFilter (Shapes > Edit Names) and trying to use that to remap Mixamo blendshape names to iPhone blendshapes.

    The problem is that on certain shapes, Mixamo uses two (left/right) instead of the iPhone's one.
    e.g.
    MouthNarrow_Left = shapes.mouthFunnel
    MouthNarrow_Right = shapes.mouthFunnel

    After running the filter, what I get is only the first of the two blendshapes. So in the above example, MouthNarrow_Left does become shapes.mouthFunnel, but altering the value of shapes.mouthFunnel doesn't affect the vertices in MouthNarrow_Right.
    See:


    I also ran into a few problems as I've been using Skinn, which you can see in the full length workflow video I did. It seems that the Edit names editor window doesn't always seem to update correctly:


    And finally (sorry, so many questions!) I couldn't work out quite how to use the Text Filter.

    When i tried using the functions.
    e.g.
    replaceText(Blink_Left, shapes.eyeBlink_L)
    replaceText(Blink_Right, shapes.eyeBlink_R)
    replaceText(BrowsDown_Left, shapes.browDown_L)
    etc.
    Only the first one has any effect, the other blendshape names remain unaffected. (which is why I ended up doing everything in ****Flagged Elements**** ).

    Can you explain how it's meant to work? I couldn't find any documentation on it anywhere.
    Thanks!
     
  3. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    Hi, Thanks for your purchase.

    1. "MouthNarrow_Left does become shapes.mouthFunnel, but altering the value of shapes.mouthFunnel doesn't affect the vertices in MouthNarrow_Right"

    Due to Unity's API for blend-shapes shapes should have a unique name. The TextFilter does not combine shapes with the same name but I will look at adding that feature.

    Right now the only way to combine shapes...
    1. Install a package to paste a mesh as a blend-shape. package here
    2. Set shapes that are combined to 100%.
    3. SkinnEdit/Skin/BakeTo Mesh Renderer
    4. Use the Clipboard/Paste//Mesh As Blend-shape
    The Paste//Mesh As Blend-shape command will be updated and included in the next version.

    There will also be a new command to combine two blend-shapes into one shape.

    2. "Edit names editor window doesn't always seem to update correctly"

    The problem seems to be that Skinn is not recognizing the skinned mesh as valid because the mesh does not have bone-weights. Not fully supporting skinned meshes with-out bones is a design flaw that I am working on fixing but it looks like it will take a few updates to completely solve the issue. I will add a fix to for the TextFilter asap.

    For a workaround and to make a skinned mesh with-out bones work will all features you can use the SkinToParent Mesh Renderer Command
    1. Assign the mesh with blend-shapes to a Mesh Renderer.
    2. Place the Mesh Renderer as a child.
    3. MeshRender/Skinn: Edit/Skin/Skin To Parent
    4. Organize the new skinned mesh and bone however you see fit.
    Please let me know if your still having issues.

    Thanks,
    Chris
     
  4. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    Thanks Chris ( @cwmanley )
    That's all really helpful.

    Re. #1 Yeah, I gathered as much. I'm actually now looking at doing the process backwards, so rather than trying to alter the destination skinned mesh (and renaming its blendshapes to match the animation clip) I'm looking at doing a search and replace on the clips themselves. Turns out that because they're just text assets (in the YAML format) you can pretty much rename anything you want (i.e. re-target), as well as duplicate animation curves in order to apply them to any blendshape you want.

    Re. #2 Thanks for the heads up. Happy to wait for updates as and when.

    Great tool you've made. Thank you.
     
    cwmanley likes this.
  5. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    ps. you never mentioned about the Text Filter format. What's with the "Functions" and "Flagged Elements"? Any docs to explain how the file should be formatted and used?
     
  6. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    There are not docs yet.

    When you create a text-filter asset with the wizard the settings are applied to the text-filter.


    Example blend-shapes named FBMSkinny, FBMFat

    Functions

    There are two functions you can use. Functions are applied to all elements that are not listed under Flagged Elements.


    The replaceText function is used to rename blend-shapes.

    Code (CSharp):
    1.  
    2. ****Functions****
    3. replaceText(FBM, FullBodyMorph)
    4.  
    Resulting names; FullBodyMorphSkinny, FullBodyMorphFat.

    Code (CSharp):
    1.  
    2. ****Functions****
    3. replaceText(FBM, )
    4.  
    Resulting names; Skinny, Fat.

    The containsText function is used to exclude blend-shapes

    Code (CSharp):
    1.  
    2. ****Functions****
    3. containsText(Fat)
    4.  
    Resulting blend-shapes; Skinny

    Flagged Elements
    Similar to the functions there are two uses for flagged elements, but flagged elements work explicitly for the shape flagged.
    Code (CSharp):
    1.  
    2. ****Flagged Elements****
    3. FBMSkinny = BodySkinny
    4. FBMFat
    5.  
    Resulting blend-shapes; BodySkinny.
    FBMSkinny is named to BodySkinny, while is FBMFat is excluded.


    All Elements

    The All Elements section is generated by TextFilter wizard for your reference only.


    Thanks for the great question I will add this to the docs.
     
    wetcircuit likes this.
  7. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    @cwmanley Super helpful. Thank you.

    I'm running into a problem using Skinn in 2018.4.1 (tied to that version for a number of reasons)

    After using Skinn:Edit > SubMesh > Combine > Selection > Merge Shared
    The resulting mesh is generated without any errors and appears to be fine until I change one of the blendshapes and I then get spammed in the console with the following error: 'Thread group size must be above zero'
    There's no additional information from the console:


    The same skinnedMeshes combined in 2019.3.3 don't have that error. Is there any way to solve this?

    I tried exporting as FBX from 2019 and using that in 2018 but when I do that, although it appears to import fine:

    as soon as I use a blendshape the mesh becomes distorted:


    Any help, much appreciated :)
     
  8. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    ps. for info, combining skinned meshes with blendshapes using MeshBaker works fine (no errors), except that it doesn't combine the blendshapes, as Skinn does.
     
  9. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    Hi,

    I cannot reproduce the error with the assets I am using. Can you send me a package with only the model/mesh assets you are using when the error happens? I will try to figure out what is going on today and send you a fix right away.

    Sorry for any inconvenience.
     
    jeromeWork likes this.
  10. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    Thank you. Sent to the email in the asset ReadMe
     
  11. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    I will take a look right now. I will not share the asset with anyone and delete it once I figure out what is going on.

    Thanks
     
    jeromeWork likes this.
  12. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    For anyone interested in the outcome of the above issues... @cwmanley has been incredibly helpful. There's a new Skinn update on the way which will fix some known issues, but I'm more of the opinion that the fault lay with the 2018.4.1 version of Unity i was using. After further testing, with 2018.4.16 and 2018.4.18 LTS the problem just disappeared.
     
    cwmanley, hopeful and wetcircuit like this.
  13. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,234
    Ahhh… silly me, I forgot that LTS versions aren't actually final… :rolleyes:
    Screen Shot 2020-03-12 at 8.42.14 AM.png
     
    jeromeWork likes this.
  14. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    yeah! That hub doesn't make it massively obvious... Thankfully I'm all good now, and your models are looking as wonderful as ever :)
     
    cwmanley and wetcircuit like this.
  15. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    I love the Unity Hub! I try to develop features in the newest version of Unity available on the Hub, then work backwards when I do a update. Hopefully when you import Skinn you are not spammed with update warnings, but sometimes those bastards can sneak by me. o_O
     
    wetcircuit likes this.
  16. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    Skinn 0.7 Released on UAS and itch.io

    Known Issues
    • The VM does not support boneless skinned meshes as a source. Use the SkinToParent Mesh Renderer Command to create a valid skinned mesh.
    Bug Fixes & Improvements.
    • Vertex Mapper Shape-filter not being update by the inspector. The VM Shape-filter should work as intended.
    • Most commands support boneless skinned mesh renders. Use the SkinToParent Mesh Renderer Command for full support.
    • Blend-shape Normals and Tangents not copied correctly when combining skinned meshes.
    • Bend-shape Normals being lost when baking meshes.
    • SKINN Script Defining Symbol being defined twice.
    • Blend-shape baking supports negative and un-clamped shapes.
    • 32bit index format for meshes over the 16bit index format vertex limit.
    New Components
    • TexturePacker.cs a component based texture atlas tool.
    • BlendshapeController.cs a blend-shape inspector for multiple skinned meshes.
    New Commands
    • Renderer/Clipboard/Paste/Blend-shapes : Pastes blend-shapes from one skinned mesh renderer to another, existing blend-shapes will be skipped
    • Renderer/Clipboard/Paste/Mesh As Blend-shape : Pastes mesh as a blend-shape.
    • Renderer/Clipboard/Paste/VertexData/Vertices : Pastes vertex data from one renderer to another.
    • Renderer/Clipboard/Paste/VertexData/Normals&Tangents : Pastes vertex data from one renderer to another.
    • Renderer/Clipboard/Paste/VertexData/Colors : Pastes vertex data from one renderer to another.
    • Renderer/Clipboard/Paste/VertexData/Colors32 : Pastes vertex data from one renderer to another.
    • Renderer/Clipboard/Paste/VertexData/UVs : Pastes vertex data from one renderer to another.
    • SkinnedMeshRenderer/Bones/Combine Bones : Combine one bone's weights into another bone's weights.
    • SkinnedMeshRenderer/Shapes/Sort : sorts blend-shapes by name
    • SkinnedMeshRenderer/Shapes/Log : Logs the index and name of each blend-shape in a mesh.
    • SkinnedMeshRenderer/Shapes/Extract/Shape : Extracts Blend-shape value at 100% as a mesh
    • SkinnedMeshRenderer/Shapes/Extract/All : Extracts all blend-shapes.
    • SkinnedMeshRenderer/Shapes/Invert : creates a new inverted blend-shape.
    • Renderer/Shapes/Remove/Shape : Removes a blend-shapes from a mesh.
    • Renderer/Shapes/Remove/Data/Vertices/Shape : Removes a blend-shapes vertices from a mesh.
    • Renderer/Shapes/Remove/Data/Vertices/All : Removes all blend-shapes vertices from a mesh.
    • Renderer/Shapes/Remove/Data/Normals/Shape : Removes a blend-shapes normals from a mesh.
    • Renderer/Shapes/Remove/Data/Normals/All : Removes all blend-shapes normals from a mesh.
    • Renderer/Shapes/Remove/Data/Tangents/Shape : Removes a blend-shapes tangents from a mesh.
    • Renderer/Shapes/Remove/Data/Tangents/All : Removes all blend-shapes tangents from a mesh.
    • Renderer/Shapes/Remove/Unused : Remove all unused blend-shapes from a mesh.
    The new atlas tool the Texture Packer has built in instructions, tips, and tool-tips. You can use the standard transform tools, commands and even other assets to manipulate uv islands. Tiled textures are not fully supported yet, and the tool has only been tested with a limited number of models.

    Capture.PNG
    To use the BlendShapeContoller simply add the component to the root of the model and you can edit all the blend-shapes of it's children at once.The component is designed for the editor, however you can use the api at run-time if you wish. The BlendShapeContoller looks for blend-shape changes automatically and has undo support.

    Capture.PNG

    There should be another update very soon. Please let me know if you have any issues.

    Chris
     
    matteumayo, hopeful, AGregori and 2 others like this.
  17. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    407
    Awesome update.
    Just a tip: a more 'conventional' pdf (or html) manual would probably be an attractive plus for newcomers.
     
    JoeStrout, one_one and cwmanley like this.
  18. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    Hello,

    After 2019.3.1 there is a bug on Mac with Skinn's compute shaders. I am going to make the compute functions fallback to C# on platforms that don't support compute shaders and add a option to disable compute shaders all together.

    I will try to get a update out asap and update the free version as well.

    @wetcircuit thanks for all your help with the Mac issue.

    Thanks
     
    JoeStrout and wetcircuit like this.
  19. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    Hi,

    Skinn 0.71 Released on UAS and itch.io

    //Known Issues
    • After 2019.3.1 there is a bug on some Macs with Skinn's compute shaders.
    • The VM does not support boneless skinned meshes as a source. Use the SkinToParent Mesh Renderer Command to create a valid skinned mesh.

    //Fixes
    • !!!Combining Skinned Meshes with blend-shapes created a extra blend-shape frame.
    • VM a bug introduced in 0.7 where you could not Append To New or Apply Addition Smoothing etc.
    • TexturePackerInspector missing a default texture.
    • Nested Context Command System: Built in Material Commands not showing up when the internal asset was not loaded.
    • Made asset easier to use with Assembly Definitions.
    //New Commands
    • Transform/Sort
    • SkinnedMeshRenderer/Shapes/Extract/Current Shape
    • SkinnedMeshRenderer/Shapes/Extract/All

    //New Features
    • The Context Command System can be accessed from hierarchy context menu under Skinn:Edit.

    This is the last update for the 2017.4 LTS the minimum version going forward will be the 2018.4 LTS.

     
    XCO likes this.
  20. rusty_kuntz

    rusty_kuntz

    Joined:
    May 21, 2018
    Posts:
    9
    Hi @cwmanley , Love the Skinn pro and using it all the time.
    I am now trying to run the Vertex Mapper from the API (SkinnEx) but its not creating the new skin mesh, no errors, not sure why.
    Can you guide me how to do it? very broadly of course.
    Thank you
     
    cwmanley likes this.
  21. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    Hi, I am glad your are finding the asset useful.

    Are you using the VertexMap function? The VertexMap function outputs the vertex information only it does not create a renderer. Here is a example of using the VM function to create a skinned mesh renderer.

    Code (CSharp):
    1. private SkinnedMeshRenderer ProjectBlendshapesExample(SkinnedMeshRenderer source, SkinnedMeshRenderer target)
    2. {
    3.     int[] mapping;
    4.     float[] distance;
    5.     Vector3[] vertices;
    6.     Vector3[] normals;
    7.     Vector4[] tangents;
    8.     BoneWeight[] boneWeights;
    9.     Blendshape[] blendshapes;
    10.  
    11.     var shapeOptions = new ShapeProjection();
    12.     var weightOptions = new WeightProjection();
    13.  
    14.     //Change the default radial count from 16 to one for faster projection
    15.     shapeOptions.radialCount = 1;
    16.  
    17.     //Disable weight projection.
    18.     weightOptions.enabled = false;
    19.  
    20.     if (!source.VertexMap(target,
    21.         out mapping,
    22.         out distance,
    23.         out vertices,
    24.         out normals,
    25.         out tangents,
    26.         out boneWeights,
    27.         out blendshapes,
    28.         null,//Source Baking how the source is transformed before mapping
    29.         null,//Target Baking how the target is transformed before mapping
    30.         null,//Search Options the distance to look for vertices.
    31.         weightOptions,
    32.         shapeOptions
    33.         ))
    34.     {
    35.         //Can not compute. or meshes null.
    36.         return null;
    37.     }
    38.  
    39.     //Clone() will Instantiate a new renderer and a new mesh or optionally leave the mesh null.
    40.     var newRenderer = target.CloneAsSkinnedMeshRenderer(false) as SkinnedMeshRenderer;
    41.     var newMesh = newRenderer.sharedMesh;
    42.  
    43.     //Clear all blendshapes or handle existing blend-shapes.
    44.     //Unity's API for adding blends-shapes will throw a error if there is a existing shape with the same name.
    45.     //var existingBlendshapes = newMesh.GetBlendshapes();
    46.     newMesh.ClearBlendShapes();
    47.  
    48.     foreach (var shape in blendshapes)
    49.     {
    50.         for (int i = 0; i < shape.frames.Count; i++)
    51.         {
    52.             newMesh.AddBlendShapeFrame(
    53.                 shape.name,
    54.                 shape.frames[i].frameWeight,
    55.                 shape.frames[i].shapeDeltas,
    56.                     shape.frames[i].shapeNormals,
    57.                     shape.frames[i].shapeTangents
    58.                     );
    59.         }
    60.     }
    61.  
    62.     return newRenderer;
    63. }
    You can take a look at the Vertex Mapper component for a more advanced example of using the VertexMap function.

    Another option is to create a VM component and use one of it's public functions.

    Code (CSharp):
    1. var vm = new GameObject("Temp VM").AddComponent<VertexMapper>();
    2. vm.root = animator.gameObject;
    3. SkinnedMeshRenderer smr;
    4. vm.Create(sourcePrefab, targetPrefab, out smr);
    Please let me know if you need anything else.

    Thanks
     
  22. rusty_kuntz

    rusty_kuntz

    Joined:
    May 21, 2018
    Posts:
    9
    Hi
    Doing it using VertexMap works perfectly and fast,
    Thanks for that and your fast reply! :)
     
    cwmanley likes this.
  23. rusty_kuntz

    rusty_kuntz

    Joined:
    May 21, 2018
    Posts:
    9
    Hi Chris
    I hope everything is good and you are working on some cool asset for us to purchase.
    I am trying out the Texture pucker and it generate a very dark / wrong textures, both for normal and albedo

    Here are couple of images to show you what I mean:
    https://drive.google.com/drive/folders/1gIk_rOihjzOfp1t-aRfsE7JaK9yBBWlI?usp=sharing

    I am sure that I am missing something,
    Project is URP,

    What do you think?
    Thnaks :)
    Or
     
  24. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    Hello,

    Thank you, sorry I have been so quiet lately.

    The shaders I use to render textures should work in any rendering pipeline but maybe it is not picking up the right textures. I will make sure the Texture Packer is working correctly with the URP/HDRP and look into the issue.

    I recommend saving the mesh with the new uvs and using Gimp/Photoshop to create the atlas textures or use the Texture Packer with the Standard Pipeline.


    0.72 will be out soon.
    • Drag and Drop Merging skinned meshes will be less intrusive with a new contextual drop area.
    • VM will bind-pose existing blend-shapes.
    Generic UMA support.
    • Drag and Drop Merge to Adjust Bones(Transform(s) with the suffix "Adjust").
    • Create Adjust Bone Context Command..

    0.8 is in the works.
    • New mapping algorithms with higher quality weight and shape projection.
    • Mac and Mobile support.
    • Major API and changes .
    • API Documentation.
    • Extensive User Documentation.
    • Many small improvements and new features.

    Thanks
     
    pigglet, Jaimi, AGregori and 2 others like this.
  25. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    407
    Will you be testing 0.8 on 2020.1 before release?
     
  26. pigglet

    pigglet

    Joined:
    Aug 13, 2014
    Posts:
    111
    Sorry, noob question: can skinn pro works at runtime from code? I mean, can I for example write a C# script that will delete certain blendshape from skinned mesh?
     
  27. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    0.72+ will supports the LTS releases and 2020 releases.

    Most the editor commands use a runtime api that you can use in your own scripts.

    Code (CSharp):
    1. public static void SkinnEx.RemoveBlendshape(this Mesh mesh, int index)
    2. public static void SkinnEx.RemoveBlendshape(this Mesh mesh, string name)
    3.  
    4. public static void SkinnEx.RemoveBlendshapeData(this Mesh mesh, int index, bool removeVertices, bool removeNormals, bool removeTangents)
    5. public static void SkinnEx.RemoveBlendshapeData(this Mesh mesh, string name, bool removeVertices, bool removeNormals, bool removeTangents)
    Just make sure you clone the mesh before using the functions that work on a mesh directly. Please let me know if you need anything else.
     
    pigglet and AGregori like this.
  28. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,836
    Hey all, I've got a seemingly simple problem, and someone pointed me to Skinn as possibly having a solution:

    I have an already-rigged mesh, to which I want to add a handful of extra bones (e.g. so that I can animate the hair or bouncier parts of the anatomy, so they don't appear to be made out of hard plastic when the character moves). I do not want to repaint or reset all the vertex weights for the rest of the bones; I only want to affect limited parts of the mesh where the new bones have been added.

    In my modeling tool (Cheetah3d), much to my surprise, this is impossible. If I add a couple of new bones, I have to rebind the entire mesh (losing the professionally done vertex weights) or it all goes to heck.

    I've skimmed very quickly through this thread, and I see that Skinn has a ton of tools related to meshes and bones, and started out originally as a weight painting tool. So I'm hopeful.

    Can I use Skinn to add a couple of new bones to an existing rig, and paint the weights for just those parts? And if so, how would I do that?
     
  29. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    HI, Thanks for your interest.

    Skinn is mainly for transferring weights and blend-shapes from on mesh to another. I have not included a weight-painting tool yet; although I hope to have excellent one a some point. :(

    I think Vertexmotion would do the trick, I have used it in a few projects.
    https://assetstore.unity.com/packages/tools/animation/vertexmotion-23930

    Sorry I can't help with that right now.
     
    JoeStrout likes this.
  30. pigglet

    pigglet

    Joined:
    Aug 13, 2014
    Posts:
    111
    Thanks for your response! I'm sorry, but I don't clearly understand what do you mean by "clone the mesh before"?
     
  31. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    193
    That is my bad.

    Unity's Instantiate.
    Code (CSharp):
    1.  var clone = Mesh.Instantiate(Mesh source);
    Skinn has Clone functions you can use to Instantiate as well if you like.

    Code (CSharp):
    1.  
    2.  
    3. /// work with a Mesh Render or a SkinnedMeshRenderer
    4.  var renderer = GetComponent<Renderer>();
    5.  var newMesh = renderer.CloneSharedMesh();
    6.  
    7. //edit Mesh Here
    8. //newMesh.ClearBlendShapes();
    9.  
    10. renderer.SetSharedMesh(newMesh);
    11.  
    12.  
    Instantiating a mesh assigns a new InstanceID which will force the SkinnedMeshRenderer to update it's data when the new mesh is assigned.
     
  32. pigglet

    pigglet

    Joined:
    Aug 13, 2014
    Posts:
    111
    Great! Thanks for the detailed explanation!
     
unityunity