Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

FPS Mesh Tool

Discussion in 'Assets and Asset Store' started by CodeBison, Jan 11, 2015.

  1. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832
    this sucks....



    Okay so..I located the issue... it says as you see in the image "!; Select a bone that is a child of CC_Base_Pelvis"! .. well okay, my HEAD, LEFT ARM & RIGHT ARM is located on CC_Base_Waist... So if i assign the right bones NO create preview button appears.. But if I go to CC_Base_Pelvis and assign some random bones like left & right tigh and spine or whatever the "Create Preview button appear"... sooo.... what to do ? .. Can someone please help me ?


    I tried to change names.... but the program too smart... this is so S***ty!!! Im using Character Creator v2.0 .. iClone characters..
     
    Last edited: Aug 2, 2017
  2. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    It sounds like FPS Mesh Tool has incorrectly guessed your root bone. It's possible that the skinned mesh renderers are weirdly set up and don't all share a common root. It would be very helpful to know the hierarchy and correct root bone for your character. For example, on this soldier I have the root bone is Pelvis:
    upload_2017-8-2_23-40-9.png

    And the hierarchy shows this to be correct:
    upload_2017-8-2_23-41-25.png

    If you can send me similar shots of your character, that would be very helpful. You can get the lower shot by selecting the fbx for your model in the project view, and clicking Configure... on the Rigging tab.

    If you have problems doing this, another option would be to send me a copy of your character at support@codebison.ca. You can do this by right clicking your prefab in project view and selecting Export Package. If you opt for this route, make sure you leave the option to include dependencies checked - I'll need them to properly assess the character and determine what's causing trouble.

    Cheers!
     
  3. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832
    Okay thank you! I will post a picture same as you in a few hours. Thanks for replying :)
     
  4. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832
    Btw, is it possible for me to just change the root bone in the skinned mesh renderer to waist?
     
  5. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832
    Theres jthe pictures... something is weird... FPS mesh tool says pelvis the root if I understand this right... but this picture saus CC_Base_Waist is... like it should be... why is FPS mesh tool fetching the wrong root ?
     

    Attached Files:

  6. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    That's definitely an odd arrangement. It looks like if you change the root bone on the skinned mesh renderer to CC_Base_Hip (the root of the hierarchy according to the avatar) everything should work fine.

    You can change it back after you've split the mesh up if you want, though I wouldn't unless it actually causes problems.

    If that doesn't work, please feel free to send me a copy of your character as mentioned before and I'll figure out how to make it play nice.

    Cheers!
     
    JBR-games likes this.
  7. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832
    Okay.. I havent change anything but its probably this iClone software that is a bit complicated... Well my character is useless with FPS mesh tool as is.. so.. do you have gmail? I can send it there with drive.. pm me
     
  8. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    Thanks for sending me your character. I've fixed the issue and pushed an update that makes root bone detection more robust. With the update, your character worked great out of the box. If you don't want to wait for the update to become available on the asset store, you can email your invoice number to support@codebison.ca and I'll send you the updated version directly.

    Cheers!
     
    mattis89 likes this.
  9. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832
    Thank you so much! :)
     
  10. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832

    Did not find the m_Renderer ..Has it been moved from the vp_FPBodyAnimator?
     
  11. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    I haven't been in their source code lately. It's possible they've changed things around. Have you tried their support forums?
     
  12. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832
    Yes, but I bet this is something about me iClone chacter again...the materials is named "head" & arm as it have to be ... i think my characters mesh have to be all in one .. I dont know what to do ...
     
  13. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    UFPS is flexible enough to handle multiple character model configurations with a bit of modification. I'd recommend looking for help re: what modifications to make on the Opsive forums.

    Cheers!
     
  14. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    39
    I managed to get CodeBison's suggestion of introducing material switching on multiple renderers to work with the latest version of UFPS v1.7.1.

    I hope this diff of vp_FPBodyAnimator.cs helps someone else or at least give you an idea of how to implement it. It isn't a difficult change but this should save you time.

    Code (CSharp):
    1. --- "vp_FPBodyAnimator.cs"    2017-04-01 07:50:35.000000000 -0500
    2. +++ vp_FPBodyAnimator.cs    2017-12-11 22:55:12.854084000 -0600
    3. @@ -57,10 +57,10 @@
    4.      public bool ShowUnarmedArms = true;                            // when active, this will display the body model's arms if no weapon is wielded. NOTE: currently does not work if the UFPS input manager is set to 'Joystick'
    5.  
    6.      public Material InvisibleMaterial = null;                    // this should be set to an invisible, shadow casting material. see the included 'InvisibleShadowCaster' shader & material
    7. -    protected Material[] m_FirstPersonMaterials;
    8. -    protected Material[] m_FirstPersonWithArmsMaterials;
    9. -    protected Material[] m_ThirdPersonMaterials;
    10. -    protected Material[] m_InvisiblePersonMaterials;
    11. +    protected Dictionary<Renderer, Material[]> m_FirstPersonMaterials = new Dictionary<Renderer, Material[]>();
    12. +    protected Dictionary<Renderer, Material[]> m_FirstPersonWithArmsMaterials = new Dictionary<Renderer, Material[]>();
    13. +    protected Dictionary<Renderer, Material[]> m_ThirdPersonMaterials = new Dictionary<Renderer, Material[]>();
    14. +    protected Dictionary<Renderer, Material[]> m_InvisiblePersonMaterials = new Dictionary<Renderer, Material[]>();
    15.  
    16.  
    17.      // --- properties ---
    18. @@ -214,8 +214,14 @@
    19.  
    20.          if (!Player.IsFirstPerson.Get())
    21.          {
    22. -            if (m_ThirdPersonMaterials != null)
    23. -                Renderer.materials = m_ThirdPersonMaterials;    // all body parts visible
    24. +            if (m_ThirdPersonMaterials != null)
    25. +            {
    26. +                foreach (var renderer in Renderers)
    27. +                {
    28. +                    renderer.materials = m_ThirdPersonMaterials[renderer];   // all body parts visible
    29. +                }
    30. +
    31. +            }
    32.          }
    33.          else
    34.          {
    35. @@ -228,20 +234,35 @@
    36.                      && !Player.Climb.Active)
    37.                      && ((vp_Input.Instance.ControlType != 1))) // 'unarmed arms' don't currently animate well using joystick at low speeds
    38.                  {
    39. -                    if (m_FirstPersonWithArmsMaterials != null)
    40. -                        Renderer.materials = m_FirstPersonWithArmsMaterials;    // only head is invisible
    41. +                    if (m_FirstPersonWithArmsMaterials != null)
    42. +                    {
    43. +                        foreach (var renderer in Renderers)
    44. +                        {
    45. +                            renderer.materials = m_FirstPersonWithArmsMaterials[renderer];   // only head is invisible
    46. +                        }
    47. +                    }
    48.                  }
    49.                  // player is armed, climbing, or prohibited to show naked arms :)
    50.                  else
    51.                  {
    52. -                    if (m_FirstPersonMaterials != null)
    53. -                        Renderer.materials = m_FirstPersonMaterials;    // head & arms are invisible
    54. +                    if (m_FirstPersonMaterials != null)
    55. +                    {
    56. +                        foreach (var renderer in Renderers)
    57. +                        {
    58. +                            renderer.materials = m_FirstPersonMaterials[renderer];   // head & arms are invisible
    59. +                        }
    60. +                    }
    61.                  }
    62.              }
    63.              else                        // player is dead ...
    64.              {
    65. -                if (m_InvisiblePersonMaterials != null)
    66. -                    Renderer.materials = m_InvisiblePersonMaterials;    // all bodyparts invisible in order not to clip camera on ragdoll
    67. +                if (m_InvisiblePersonMaterials != null)
    68. +                {
    69. +                    foreach (var renderer in Renderers)
    70. +                    {
    71. +                        renderer.materials = m_InvisiblePersonMaterials[renderer];   // all bodyparts invisible in order not to clip camera on ragdoll
    72. +                    }
    73. +                }
    74.              }
    75.          }
    76.  
    77. @@ -429,39 +450,46 @@
    78.              return;
    79.          }
    80.  
    81. -        m_FirstPersonMaterials = new Material[Renderer.materials.Length];
    82. -        m_FirstPersonWithArmsMaterials = new Material[Renderer.materials.Length];
    83. -        m_ThirdPersonMaterials = new Material[Renderer.materials.Length];
    84. -        m_InvisiblePersonMaterials = new Material[Renderer.materials.Length];
    85. -
    86. -        for (int v = 0; v < Renderer.materials.Length; v++)
    87. -        {
    88. -
    89. -            // create 4 material arrays from the provided one ...
    90. -
    91. -            // ... one with visible materials on all body parts (for 3rd person)
    92. -            m_ThirdPersonMaterials[v] = Renderer.materials[v];
    93. +        if (Renderers.Length <= 0)
    94. +        {
    95. +            Debug.LogWarning("Warning (" + ") No renderers are available.");
    96. +            return;
    97. +        }
    98. +
    99. +        foreach (var renderer in Renderers)
    100. +        {
    101. +            m_FirstPersonMaterials[renderer] = new Material[renderer.materials.Length];
    102. +            m_FirstPersonWithArmsMaterials[renderer] = new Material[renderer.materials.Length];
    103. +            m_ThirdPersonMaterials[renderer] = new Material[renderer.materials.Length];
    104. +            m_InvisiblePersonMaterials[renderer] = new Material[renderer.materials.Length];
    105. +
    106. +            for (int v = 0; v < renderer.materials.Length; v++)
    107. +            {
    108. +                // create 4 material arrays from the provided one ...
    109. +
    110. +                // ... one with visible materials on all body parts (for 3rd person)
    111. +                m_ThirdPersonMaterials[renderer][v] = renderer.materials[v];
    112. +
    113. +                // ... one with invisible head and arm materials (for classic 1st person)
    114. +                if (renderer.materials[v].name.ToLower().Contains("head") ||
    115. +                    renderer.materials[v].name.ToLower().Contains("arm"))
    116. +                    m_FirstPersonMaterials[renderer][v] = InvisibleMaterial;
    117. +                else
    118. +                    m_FirstPersonMaterials[renderer][v] = renderer.materials[v];
    119. +
    120. +                // ... one with an invisible head but visible arms (for unarmed 1st person and VR mods)
    121. +                if (renderer.materials[v].name.ToLower().Contains("head"))
    122. +                    m_FirstPersonWithArmsMaterials[renderer][v] = InvisibleMaterial;
    123. +                else
    124. +                    m_FirstPersonWithArmsMaterials[renderer][v] = renderer.materials[v];
    125.  
    126. -            // ... one with invisible head and arm materials (for classic 1st person)
    127. -            if (Renderer.materials[v].name.ToLower().Contains("head") ||
    128. -                Renderer.materials[v].name.ToLower().Contains("arm"))
    129. -                m_FirstPersonMaterials[v] = InvisibleMaterial;
    130. -            else
    131. -                m_FirstPersonMaterials[v] = Renderer.materials[v];
    132. -
    133. -            // ... one with an invisible head but visible arms (for unarmed 1st person and VR mods)
    134. -            if (Renderer.materials[v].name.ToLower().Contains("head"))
    135. -                m_FirstPersonWithArmsMaterials[v] = InvisibleMaterial;
    136. -            else
    137. -                m_FirstPersonWithArmsMaterials[v] = Renderer.materials[v];
    138. +                // ... and one array with all-invisible materials (for ragdolled 1st person)
    139. +                m_InvisiblePersonMaterials[renderer][v] = InvisibleMaterial;
    140.  
    141. -            // ... and one array with all-invisible materials (for ragdolled 1st person)
    142. -            m_InvisiblePersonMaterials[v] = InvisibleMaterial;
    143. -
    144. -        }
    145. +            }
    146. +        }
    147.  
    148.          RefreshMaterials();
    149. -      
    150.      }
    151.  
    152.  
    153.  
    The results of the above with my iClone character are in the image below, which is similar to a Fuse or Daz3d character. This same code change will work for those as well. Note that the FPS arms are still from the default character. I am planning on changing those next with the help of this useful FPS Mesh Tool.

    screencap1.jpg

    Enjoy!! :)

    Thank you so much for this tool it will save me so much time.

    Edit: My first attempt at a weapon. Needs a bit of work on the springs and pivot positions.
     
    Last edited: Dec 12, 2017
    JBR-games and mattis89 like this.
  15. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832
    Really? You got it to work???

    Did you experience the weird thing at first where the default character from the character creator worked with the fps tool, but if you changed it just the slightest (change shoes etxc)it didnt work anymore?
     
  16. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    39
    I had a lot of trouble getting a character to work by doing it from scratch, which I had tried first. Then, I ended up watching Opsive's youtube channel, who is now the owner of the UFPS asset. His recommendation in the video showed him taking the existing WeaponsHD character and replacing the existing prefab body with a free example character from the unity asset store. I followed that video but instead used my iClone character. Specifically, in the video he even shows you how to use CodeBison's FPS Mesh Tool.

    The video is here:



    Edit: I also figured out through trial and error the correct bones to use for an iClone character when setting up ragdoll:

    iclone ragdoll.jpg

    iclone body.jpg

    ragdoll1.jpg
    ragdoll2.jpg

    Edit: I think I just understood your question. The answer is, since the boots for example in iClone are skinned you can't just remove them at runtime and say replace them with a couple of cubes even if you parent the cubes to each of the foot bones and have it work correctly. They will float in the general area of the feet but not quite in the right spot as you move.

    You have to attach the object you want in iClone and export it with character so it inherits the correct weights. You can do this with lots of feet, boots, armor pieces, clothing, etc. and then separate them out afterwards inside Unity to make a kit of clothing items you could apply at runtime. To test what I just wrote here I just ripped the boots off, placed cubes and verified they don't work even when parented, and then confirmed putting the boots back again still works.

    While attaching a sword that wasn't exported with the character to the hand bone does follow the hand properly.
     
    Last edited: Dec 12, 2017
    99thmonkey likes this.
  17. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832

    Thanks alot for the detailed explanation :) what if I want 3 different kind of pants or boots when you can only wear 1 pair at a time when you create your character in CC? (Character Creator)

    What I really ment with my previous question was : I got the iClone character to work with the standard script without any modification.. BUT it only worked with a default iClone character meaning you couldnt change anyting... If I changed anything at all the fps mesh tool didnt make it invisible arms or anything.. did not work.. so I tried just take any character that was a default one and import it to Unity and that worked, but it sucks because I couldt change hair colornor clothes or anything so..

    But its awesome that you found a solution for us to ise iClone with ufps and fps mesh tool :)

    But how to get that shirt sleeves invisible too?
     
  18. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    39
    You definitely need to use the script patch I provided a few comments ago so that it can inject the invisible material for all the renderers provided by the iClone character, e.g. hair, shirt, pants, boots, eyelashes, head, body, eyes, teeth, etc. It is working and I haven't had that trouble. I just made his pants blue to test, and also just got the third person sword set up:

    bluepants.jpg

    Yes, I've been desperately wanting to use iClone for this purpose it produces such beautiful characters. I have the crazytalk tool and the lipsync addon too so it will be fun to make unique heads that can have conversations. For fun I made a scene where my character drunkenly stumbles around singing the song bards sing in the taverns in skyrim. o_O

    Edit: You mean make the holes invisible in the pants for example? Quick and dirty you can cheat by setting the standard shader rendering mode to Cutout. However, if you look closely inside the a hole in the pants near the knee you would notice the back of the pants are invisible. To fix this you have to use a double sided shader, there is one free from Ciconia Studio called "Double Sided Shaders" available at:

    https://www.assetstore.unity3d.com/en/#!/content/23087

    Edit: Forgot to answer your other question. I'm not an expert on this, a lot of this is just guessing on my part. But, I believe because the pants/shirts/etc are separate objects inside the main character, you can swap them out. My plan is to create variations of my character with different outfits on, then bring them into Unity and detach the shirts, pants, armor, boots, hair, etc. and place them into outfit folders as prefabs. Then, I'll attach them on the fly with a runtime script based on either player customization and/or acquisition by finding something on the ground. At that point I will just reparent the object to the character. I can't confirm this will work, but I don't see why not. Not sure if there will be caveats to that.

    Edit: Ok, just tried it and the attachment goes invisible when I parent it to another model and change its parent bone. So, that doesn't seem to work.

    This might be why people use UMA or Morph3D. There is also ootii's mount point asset.

    Edit: After some research it looks like UMA pulls off what it does via a SkinMeshCombiner which was invented on the Unity forums in 2012. They've probably heavily modified it since then. But, basically it properly combines the two unrelated skin meshes under a single hierarchy by transferring materials, UV, bones, bone weights, local transforms and bind poses. Create a new skinned mesh renderer to hold them, asks it to combine their meshes, recalculates the bounds, and deletes the originals.

    In other words, no small task.

    There is a discussion about it here:
    https://answers.unity.com/questions/625243/combining-skinned-meshes-1.html
    UMA's own implementation is here:
    https://github.com/huika/UMA/blob/master/UMAProject/Assets/Standard Assets/UMA/Core/Scripts/SkinnedMeshCombiner.cs

    Some guy came up with a version for Mixamo Fuse characters that is under the MIT license (free for commercial or non-commercial use) that could probably be reworked to work for iClone:
    https://gist.github.com/radiatoryang/3707b42341f6f7b3aa67b8387e1f8e68
     
    Last edited: Dec 12, 2017
    mattis89 likes this.
  19. Mikekan13

    Mikekan13

    Joined:
    May 30, 2015
    Posts:
    40
    Can this plugin work for legs too? Also could you make the division happen at the elbows? I am interested for use with dismemberment.
     
  20. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832
    I wouldnt use this asset for anything else than what its ment for ..but thats me.. you can change where it gets cut off yes... with a bit of tweaking and scripting, sure :)
     
  21. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832
    I will read and reply for real later.. im driving atm..
     
  22. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    39
    Turns out all I had to do to to fix the hair sticking through the helmet is:
    Code (CSharp):
    1. mountPoints.ConnectMountPoints("Head", "Prefabs/Armor/Helmets/Helmet", "Head");
    2.  
    3. var hair = GameObject.Find("Part_HairMesh_0");
    4. hair.gameObject.GetComponent<Renderer>().enabled = false;
    Yay! Finally. Using Ootii's Mount Points I was able to add mount a shirt rigged in iClone onto my character at runtime from a prefab!

    Here is a screenshot followed by how I did it.
    addedshirt.JPG

    Here's how it works:

    1) Make your character in iClone Character Creator.

    2) Buy export versions of clothing, have your artist make it, or make your own with i.e. Marvelous Designer.

    3) Attach your clothing inside iClone onto your character and style it as needed.

    4) Export the naked character with 3dxchange as a FBX targeting Unity.

    5) Import the FBX and set the rig to Humanoid under Rig.

    6) Export the clothed character with 3dxchange as a FBX targeting Unity.

    7) Import the FBX and set the rig to Humanoid under Rig.

    8) Pick under Avatar Definition "Copy From Other Avatar" For Source choose the main Avatar you imported

    9) Delete all other child objects, e.g. boots, body, head, hair, pants, etc. except for the shirt that you are targeting for its own prefab. Don't delete the armature bones, e.g. CC_Base_BoneRoot. He will now just look like a floating shirt. Rename this 2nd imported character from MyGuy to MyGuyShirt1. It will now look like:
    example1.JPG
    Make it into a prefab inside a Resources\Prefabs\Clothing\Shirts folder.

    11) Now make a copy of the body's main skin texture, rename the copy MyGuy_Shirt1_Mask, and edit it in Photoshop or Gimp, etc. Draw black over the areas of the skin you don't want visible and white over the areas you do. Mine looks like:
    Shirt04_mask.jpg

    12) Use FPS Mesh Tool and slice up your original character and set him up for UFPS. You can follow the official video on how to do this with FPS Mesh Tools here:


    13) Import the Mount Points asset.

    14) And, add a Mount Point List component to your main character. Then, set Body Skin Renderer to CC_Base_Body of the main character. Check Use Body Masks. And, Material Index 0. This is the body material index.

    15) Click + to add a skinned item under Skinned Items in the mount list. Name it Shirt1.

    16) Click the ... to pick the path of the resource and mask to that you made under Resources. Leave the checkboxes alone but uncheck "Instantiate On Start" and don't bother to add an instance since we'll do it from a script.

    17) Create a C# script called AttachShirt, attach the script to something in the scene. Declare at the top:
    MountPoints mountPoints;

    And, in the Awake method do (Where your player's body is named PlayerHDBody for example):

    mountPoints = GameObject.Find("PlayerHDBody").GetComponent<MountPoints>();

    18) Then, in the Start method (These will be retrieved from your Resources directory):

    mountPoints.AddSkinnedItem("Prefabs/Clothing/Shirts/MyGuyShirt1", "Prefabs/Clothing/Shirts/MyGuy_Shirt1_Mask");

    19) Set the materials on the CC_Base_Body to CutOut or a transparent material.

    20) Now hit Play and your character will be wearing a properly fitted shirt he didn't originally have on.
    ded.jpg

    You could then tie that into an inventory system for picking up objects and wearing them or a player customization.

    Phew! Sorry for the long explanation. But, I'm betting this will save someone else a massive amount of time.
    :rolleyes:

    Now I just have to figure out how to solve this issue:
    fpissue.jpg
     
    Last edited: Dec 13, 2017
    mattis89 likes this.
  23. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    39
    I fixed the shirt sleeves showing up in first person view. Here is my solution.

    Use FPS Mesh Tool on your MyGuyShirt1 to produce a MyGuyShirt1_Fixed, put this as a prefab in your resources folder next to where you had your MyGuyShirt1.

    fixed3.JPG

    Change your attach script Start method to:

    Code (CSharp):
    1. var shirt1 = mountPoints.AddSkinnedItem("Prefabs/Clothing/Shirts/MyGuyShirt1_Fixed", "Prefabs/Clothing/Shirts/MyGuy_Shirt1_Mask");
    2. GameObject.Find("PlayerHDBody").GetComponent<vp_FPBodyAnimator>().ReInitMaterials(shirt1.GameObject);
    Then add this function to vp_FPBodyAnimator.cs at the bottom:

    Code (CSharp):
    1. public void ReInitMaterials(GameObject attachment)
    2. {
    3.     if (m_Renderers == null) return;
    4.  
    5.     var renderers = attachment.GetComponentsInChildren<SkinnedMeshRenderer>();
    6.  
    7.     var contained = from currentRenderers in m_Renderers
    8.     join newRenderer in renderers on currentRenderers.name equals newRenderer.name
    9.     select currentRenderers;
    10.  
    11.     if (!contained.Any())
    12.     {
    13.         System.Array.Resize(ref m_Renderers, m_Renderers.Length + renderers.Length);
    14.  
    15.         int r = m_Renderers.Length;
    16.         foreach (var renderer in renderers)
    17.         {
    18.             m_Renderers[--r] = renderer;
    19.         }
    20.  
    21.         InitMaterials();
    22.     }
    23. }
    Note: I rewrote the code not to add another skinned mesh if it was already in the renderer array. Put using System.Linq at the top of .cs file.

    What this does is add the skinned mesh renderer of the shirt to the vp_FPBodyAnimator's Renderer array. Then it asks for the materials to be reapplied.

    You can use my changes listed above under the public domain or MIT license if you prefer a license.

    The results:

    fixed1.JPG

    View attachment 258446

    Hope this helps anyone out there who has been struggling with this as I have!!!

    And again, thanks to CodeBison for this great FPS Mesh Tool. It is a life saver.

    :p
     
    Last edited: Dec 13, 2017
    mattis89 and JBR-games like this.
  24. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    39
    Sorry about that missing image, unity forums is claiming it was spam. Here's the image:

    fixed4.JPG
     
    mattis89 likes this.
  25. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832

    Amazing! I just need to write an attach script first :) thanks for all this great information for iClone characters :)
     
  26. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832
  27. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
  28. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    39
    Hehe, thanks for the encouragement guys. I'm a pretty fast coder.
    I just fixed the Horse Animset Pro for UFPS too yesterday.
    I'm like a bull in a china shop here.

    Definitely enjoying Unity development. Such a convenient framework. :D

    Now if I only had a team to finish my insane make-my-own-skyrim myself idea. :confused:
    All the assets exist now to make this happen. Almost seems like an insurmountable task sometimes, though.
     
    99thmonkey likes this.
  29. wigglypuffs

    wigglypuffs

    Joined:
    Aug 10, 2015
    Posts:
    39
    Last edited: Dec 17, 2017
    JBR-games likes this.
  30. francescobr

    francescobr

    Joined:
    Apr 2, 2017
    Posts:
    45
  31. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    I don't think you'd have much luck using FPS Mesh Tool for this purpose. While it would work in theory, depending on the vertex weighting on the models you might get jagged edges for different body parts, which would look terrible. You'd also see gaps in the mesh if geo for the currently selected body parts don't match each other exactly. If you were to manually edit the mesh components after splitting them up you might get something serviceable, but it would be a lot of work.

    Hopefully this gives you the information you need. Please let me know if you have any other questions.

    Cheers!
     
  32. francescobr

    francescobr

    Joined:
    Apr 2, 2017
    Posts:
    45
    Thank you so much, I'm not that adept at mesh editing so I think I won't embark on this journey :)
     
  33. Weendie-Games

    Weendie-Games

    Joined:
    Feb 17, 2015
    Posts:
    47
    Hi @CodeBison , i'm experiencing some weird behavior using your tool.

    I can generate my DAZ Studio cloth model with all the blendshapes,but after i close the editor and open again all the blendshapes are just missing.

    One thing that you should know is that, i changed the prefab hierarchy from the original model, here's the model before i use it on your tool:
    PrefabHierarchy.JPG

    Then i use my prefab on the FPS Mesh generator.

    Anyway, still a weird behavior because before i close the editor all the blendshapes still there.

    EDIT: After a more deep analysis i found out that this problem is happening even with the original model from DAZ


    Thank you in advance.
    Dênis Fernandes
     
    Last edited: Feb 10, 2018
  34. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    Hi Dênis,

    I'm sorry for the delay in responding to you. For some reason my forum alerts seem to not be working.

    Unfortunately, I don't know what the cause of your issue would be. If you can send me a copy of your model to support@codebison.ca I can take a look at it.

    Cheers,

    Cameron
     
    Weendie-Games likes this.
  35. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    I've just submitted version 1.1.4 to the Asset Store, which resolves issues with blendshapes in processed versions of some meshes not persisting through closing and reopening Unity. If you need this and don't want to wait for the Asset Store team to update, please send your invoice number to support@codebison.ca and I'll gladly send you a copy of the latest version.

    Thanks to @Weendie-Games for helping me find this issue.

    Cheers!

    Cameron
     
    Weendie-Games likes this.
  36. cjake2299

    cjake2299

    Joined:
    Jun 26, 2017
    Posts:
    5
    @CodeBison Purchased your plugin today and it doesn't show me a preview like in your videos (just replicates my character) My character was originally created in iClone. When I try and build FPS Mesh it just sits at "Processing blend shapes for CC_Base_Body". Any idea?

    [edit] Console spits out an error when trying to generate a preview:

    IndexOutOfRangeException: Array index is out of range.
    CBG.FPSMeshTool.FPSMeshToolWindow.Belongs (CBG.FPSMeshTool.Triangle tri, UnityEngine.Mesh mesh, System.Collections.Generic.Dictionary`2 boneDict, UnityEngine.BoneWeight[] boneWeights) (at Assets/CBG/FPSMeshTool/Editor/FPSMeshToolWindow.cs:828)
    CBG.FPSMeshTool.FPSMeshToolWindow.ConvertToFPSMesh (UnityEngine.SkinnedMeshRenderer sourceRenderer, UnityEngine.SkinnedMeshRenderer targetRenderer, UnityEngine.Transform head, UnityEngine.Transform leftArm, UnityEngine.Transform rightArm, Boolean processLegs, UnityEngine.Transform leftLeg, UnityEngine.Transform rightLeg) (at Assets/CBG/FPSMeshTool/Editor/FPSMeshToolWindow.cs:717)
    CBG.FPSMeshTool.FPSMeshToolWindow.BuildPreviewMeshes () (at Assets/CBG/FPSMeshTool/Editor/FPSMeshToolWindow.cs:631)
    CBG.FPSMeshTool.FPSMeshToolWindow.UpdatePreview () (at Assets/CBG/FPSMeshTool/Editor/FPSMeshToolWindow.cs:952)
    CBG.FPSMeshTool.FPSMeshToolWindow.CreatePreview () (at Assets/CBG/FPSMeshTool/Editor/FPSMeshToolWindow.cs:956)
    CBG.FPSMeshTool.FPSMeshToolWindow.OnGUI () (at Assets/CBG/FPSMeshTool/Editor/FPSMeshToolWindow.cs:361)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
    UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:255)

    [edit #2]
    I corrected the issue by re-exporting my mesh without fiddling with anything in 3ds Max. For some reason my previous character it only saw the body and tongue, but when I reexported it in native iClone format it worked just fine.
     
    Last edited: Mar 13, 2018
  37. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    Glad to hear you got it sorted out!
     
  38. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832
    Hello!

    I try with a mixamo character and get this >>>


    'Assets/FPSMeshTool/Meshes/FPSMesh - theboss - boss:Arms_Geo.asset' is not a valid asset file name.
    UnityEditor.AssetDatabase:CreateAsset(Object, String)
    CBG.FPSMeshTool.FPSMeshToolWindow:BuildFPSMesh() (at Assets/CBG/FPSMeshTool/Editor/FPSMeshToolWindow.cs:578)
    CBG.FPSMeshTool.FPSMeshToolWindow:OnGUI() (at Assets/CBG/FPSMeshTool/Editor/FPSMeshToolWindow.cs:368)
    UnityEditor.DockArea:OnGUI()


    UnityException: Creating asset at path Assets/FPSMeshTool/Meshes/FPSMesh - theboss - boss:Arms_Geo.asset failed.
    CBG.FPSMeshTool.FPSMeshToolWindow.BuildFPSMesh () (at Assets/CBG/FPSMeshTool/Editor/FPSMeshToolWindow.cs:578)
    CBG.FPSMeshTool.FPSMeshToolWindow.OnGUI () (at Assets/CBG/FPSMeshTool/Editor/FPSMeshToolWindow.cs:368)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
     
  39. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    Hi,

    It looks like your issue is that the prefab you're using has a character in its name that Unity doesn't like. If you rename it to something simpler (the problem is probably the colon :)) in the name) it should work fine.

    Cheers,

    Cameron
     
    mattis89 likes this.
  40. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    832

    what if I dont use a attachment script? I just imported a guy with shirt sleeves and I want the sleeves to be invisible with the arms? How would I do that? @wigglypuffs
     
  41. catcancode

    catcancode

    Joined:
    Jan 11, 2017
    Posts:
    13
    I would like to render only two arms of an animated (with animator) humanoid model with all the other body parts (head, chest, legs, ...) hidden from users. I also would like the two arms will still be moving the same way they did when all the body parts were shown. Would your library solve the problem? Thank you very much. Best regards, Han.
     
  42. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    Yes, FPS Mesh Tool can do what you're looking for. It's designed for exactly this sort of use case. Please let me know if you have any other questions.

    Cheers,

    Cameron
     
  43. somosky

    somosky

    Joined:
    Feb 15, 2014
    Posts:
    93
    Has this been tried with Synty low poly characters?
     
  44. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    I'm not aware of anyone using it with the Synty characters, but I have no reason to believe it wouldn't work just fine. If you do end up purchasing FPS Mesh Tool and find it unsuited to your needs, I'd be happy to issue you a refund.

    Cheers,

    Cameron
     
  45. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    2,914
    @CodeBison This looks great, but there's one thing I haven't been able to see done from any of the videos or posts here. How does one replace the existing FPS arms in UFPS with the separated arms from this tool? Or is that not possible?
     
  46. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    393
    Yes it can be done I have done it and I want to say there's even some YouTube videos about how to do it from the ufps Developers. But like anything else in unity it's going to take a fair amount of time to get them set up properly to look good and match your animations and weapon
     
    magique likes this.
  47. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    159
    Hi!

    Yes this is definitely possible. As @JBR-games says, it will take a bit of fiddling to get looking good. Basically what you do is export an arms-only version of your character with FPS Mesh Tool and put it together with your preferred weapon into a weapon prefab. This series here covers the procedure:


    That video in particular doesn't use FPS Mesh Tool, but the same technique applies. You would just use FPS Mesh Tool instead of the modeling software used in the video.

    Cheers,

    Cameron
     
  48. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    2,914
    Thanks for the help. I'll consider getting FPS Mesh Tool then if all project plans proceed as planned.