Search Unity

FPS Mesh Tool

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

  1. pickle_rick1

    pickle_rick1

    Joined:
    Jan 7, 2018
    Posts:
    9
    i having problem with using fps mesh tool with infinity pbr characters,
    ArgumentException: Blend shape frame weight must be greather than previous frame weight
     
  2. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    I've used it with some of Infinity PBR's characters before without issue. Would you be able to give a bit more detail? IE which pack/model, and exactly what you're doing when this happens? Line number for the error would also be helpful.

    Thanks!
     
  3. Catttdaddy

    Catttdaddy

    Joined:
    Mar 17, 2015
    Posts:
    55
    Hey first I love the asset and it is very helpful. I have a problem with a model though. It looks like a large part of the model is missing or corrupted from the exported copy in the Meshes folder after I create the FPSMeshTool version of my model. My Character mesh is fairly high poly. Is it a limit? It doesnt look like it is a 1 to 1 copy of my original mesh. Is it a way I can fix this?
     
  4. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    I haven't run into this before, but if you send a copy of the character you're having trouble with to support [at] codebison.ca along with a screenshot of the problems you're seeing, I can take a look and see if FPS Mesh Tool is somehow running into some sort of issue related to the old Unity 65k mesh vertex limit or something.
     
  5. shahroziub

    shahroziub

    Joined:
    Sep 8, 2019
    Posts:
    21
    How to Fix this error?
    I'm using in UCC
    upload_2022-1-26_18-36-33.png
     
  6. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    I'll take a look and see if there are recent changes to UCC that would cause this. In the meantime, are you using Opsive's Third Person Controller? Or full-blown UCC? If you're using Third Person Controller, then you don't need to import the FPS Mesh Tool/UCC integration component - it's only for runtime changes between first and third person.
     
    shahroziub likes this.
  7. shahroziub

    shahroziub

    Joined:
    Sep 8, 2019
    Posts:
    21
    I'm Using Full-blown UCC and also i want to change FPS to TPS in runtime.
     
  8. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    I've just checked the latest UCC and there aren't any changes to the MaterialSwapper component, which is what would cause that. What version of UCC are you using? If it's an older one, we'll have to either get you on a newer version of UCC, or an older version of FPS Mesh Tool.
     
  9. shahroziub

    shahroziub

    Joined:
    Sep 8, 2019
    Posts:
    21
    i'm using latest version UCC 2.4.4
     
  10. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Thanks for the update. This is definitely a weird one.

    My UCC shows as version 2.4.5, but that's probably fine. Can you confirm that lines 67 and 68 if your MaterialSwapper.cs look like this?

    Code (CSharp):
    1.         public Action OnEnableFirstPersonMaterials { get { return m_OnEnableFirstPersonMaterials; } set { m_OnEnableFirstPersonMaterials = value; } }
    2.         public Action OnEnableThirdPersonMaterials { get { return m_OnEnableThirdPersonMaterials; } set { m_OnEnableThirdPersonMaterials = value; } }
    You'll find it here:
    upload_2022-2-6_23-32-13.png
    It would also be good to confirm there's not somehow another class named MaterialSwapper in your project. You can verify this by searching for it by name in your project folder - you should only see one entry:
    upload_2022-2-6_23-36-32.png
    It might also be worth deleting the MaterialSwapper and UCCFPSMaterialController and reimporting them both from their original sources. (Always make sure you have a backup first)
    If that doesn't help, I'd also recommend starting a new project with just UCC and FPSMeshTool (and appropriate integrations) just to make sure everything's okay in a standalone project.
    Out of curiosity, what version of Unity are you on?
     
    shahroziub likes this.
  11. Catttdaddy

    Catttdaddy

    Joined:
    Mar 17, 2015
    Posts:
    55
    I'm having problems with the FPS Mesh tool. I run the tool and the preview looks fine. When I build and use the mesh multiple parts of the mesh set as "Body" are masked off when I only want the head and arms to not appear. Im not sure how to fix this. Please help
     
  12. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Can you explain a bit more about what you mean by the body being masked off? Do you mean it's completely missing from the resulting mesh? If so, it could be that the Final Mesh Contents settings weren't set quite right. It's worth checking the Choose What To Include In Final Mesh section of the FPS Mesh Tool documentation to make sure you've set everything properly to get what you're looking for. There are also videos in case you find those more helpful.

    If you've already seen/followed these, or if you still have questions/issues after seeing them, it'd be great if you could include a screenshot of the results you're seeing so I can help you get everything sorted out.

    Cheers!
     
  13. attspeis

    attspeis

    Joined:
    May 4, 2018
    Posts:
    2
    Hello, I am trying to use Opsive First Person Controller (no third person) and have followed tutorials from both the Opsive YouTube channel and the YouTube channel for the FPS Mesh Tool. However, whenever I try to get the arms and head to disappear from my model when I push play they both remain. I can use the FPSMaterialController but when I try to use the UCCFPSMaterialController it comes up with the attached image. I read through some of the posts here about it but was unable to find a solution that worked for me. I had read in the documentation for the FPS Mesh Tool to use the UCC for any of the Opsive controllers but perhaps I misunderstood. I am using a model from a Synty package. I am trying to make a multiplayer game so I want to be able to turn the arms and head back on for other players to see. Any help would be appreciated, thanks!

    Edit: The way the character is made is the is a parent with all the Opsive controller scripts and then a child of the parent holds the Skinned Mesh Renderer and is next to the Root and other Opsive objects such as the Colliders and Items. I am not sure if this is helpful information or not. (Attached image. SciFiCop has Opsive scripts, Character_Cop_01 has Skinned Mesh Renderer)
     

    Attached Files:

    Last edited: Apr 16, 2022
  14. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Hi,

    Thanks for including the details of your use case. As it stands, UCCFPSMaterialController will only work with UCC, since live material swaps are only needed when first/third person perspective swaps are involved. As you've noted, this doesn't work out for multiplayer. With older versions of the Opsive controllers, there was no clean way to support perspective swaps unless UCC was used - clean perspective swaps required functionality that just wasn't in the single-perspective controllers. This has changed in more recent versions, though, and I can update UCCFPSMaterialController to work cleanly with all the Opsive controllers.

    In the short term, you can get something up and working with FPSMaterialController by calling its OnPerspectiveChanged(bool firstPerson) method on spawn, (with true for local player and false for remote players). I don't know enough about the Opsive multiplayer packages to know exactly where you'd call that, but they should be able to help you out with that bit on the Opsive forums.

    I'll update here once I've adjusted the UCCFPSMaterialController to work cleanly with all the single-perspective Opsive controllers. That should be in the next couple of days. If you want to get up and running before then, you can use FPSMaterialController as described above.
     
  15. attspeis

    attspeis

    Joined:
    May 4, 2018
    Posts:
    2
    I appreciate your hasty response and look forward to the update! For now I will either just look into doing it the way you described or use the invisible mesh while I wait. Thanks!
     
    CodeBison likes this.
  16. Supergrubman

    Supergrubman

    Joined:
    Jan 2, 2014
    Posts:
    20
    Can you add support for separating hands. This would be great for creating VR hands from character or arm.
     
  17. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    You can actually do this already. You can specify any bones you want for Left Arm/Right Arm. If you set the wrists or elbows as the left/right arms, you can separate things out at any joint you want.
    For example:
    upload_2022-4-16_23-16-8.png
     
  18. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    I've just submitted a new version that should make UCCFPSMaterialController handle your multiplayer use case cleanly. It should be approved in the next few days. If you want it before then, you can email support [at] codebison.ca with your invoice number and I'll be happy to send it to you directly.

    Cheers!
     
  19. Supergrubman

    Supergrubman

    Joined:
    Jan 2, 2014
    Posts:
    20
    What happens when you look at the hands at the cut part(wrist joint). Does it look like the hand model doesn't exist? I think this is what happens when you look there & this is also undesirable, especially when you're looking from that angle alot which is common with VR hands. I guess in FPS you don't look towards the cut joint since the camera doesn't view in that direction, but for VR hands this might be troublesome.
     
  20. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Hi,

    Hands cut off like this would have holes where the wrists would be, so you'd need to cap those with something. Your best bet for VR hands will generally be to use a model that's designed for that use case, but depending on your art style you could get a serviceable result from a set of FPS Mesh Tool-separated hands and do a bit of modeling work afterwards to seal up the wrist.
     
  21. buttmunch67

    buttmunch67

    Joined:
    Apr 18, 2018
    Posts:
    2
    I have an interesting problem where the FPS mesh tool is working perfectly in editor but not during runtime. In editor, I can replace the materials with the InvisibleMaterial by hand to hide the body parts I want (in this character, the head is a separate GO, so only focus on the body mesh).
    picture

    During runtime, the same materials get replaced by the InvisibleMaterial (as expected) however the entire mesh is still visible as if the FPS mesh tool material "forgot" the data from when it was created (see image).
    picture

    I am using UCC 2.2 and yes I am using the UCCFPSMaterialController.

    Also, some of my character models do work properly as in this next image. I didn't do anything differently when using the FPS Mesh Tool to create them.
    picture
     
  22. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    It sounds like UCCFPSMaterialController might not be properly configured on some of your characters. Most of the time it properly detects what to show/hide automatically, but some characters might require manual configuration.
    If you look at the UCC FPS Material Controller section of the FPS Mesh Tool documentation you'll see how to tell it which body parts to hide, and which meshes/submeshes belong to which body parts.

    If that section doesn't give you the info you need to get everything working, please let me know so we can get everything working properly for you.

    Cheers!
     
  23. buttmunch67

    buttmunch67

    Joined:
    Apr 18, 2018
    Posts:
    2
    Thanks for getting back to me! I don't think I explained my problem well enough, I had already thoroughly read the docs so I understand how to tell which body parts to hide and how things work. The body parts to be hidden are correctly identified and the invisible materials are applied to the SkinnedMeshRenderer correctly. However, the entire mesh is still visible as if the material was never separated into separate body parts. And again, this only happens in play mode. Everything looks perfectly normal when I am editing the prefab and testing the same material that is causing the problem in my picture.

    This is true for all materials generated for this character, so when they are all active at once, the character catches the lights in my scene 4 times (for each material) and looks pretty horrible in third person.
     
  24. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Oh wow, no kidding - that looks crazy!

    Are there maybe multiple copies of the character mesh in place at runtime or something? The actual material management is pretty standard, and I can't think of anything off hand that would cause this.

    If you want to send an export of your character prefab to support [at] codebison.ca, I can take a look at it and maybe get a better idea why it's being so uncooperative.
     
  25. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    236
  26. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Yes, arms created with FPS Mesh tool will work fine with this. The only possible hurdle you'd have here is that you need humanoid rigged animations for them. The first-person animations for most UCC actions are generic rigged and only work with the models that come with UCC. You can use UCC's third-person climbing animations, which will be humanoid rigged, and they should work just fine.
     
  27. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    276
    Hi, first off, great tool! I'm converting an old project to URP and the invisible material shaders can't be converted to URP. Do you have any URP versions of these?
     
  28. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Hi!
    The invisible material included in FPS Mesh Tool worked fine with URP, but testing it just now it looks like that's no longer the case with more recent versions. Here's a new version of InvisibleMaterial that should work (just tested in Unity 2022.2.0f1 with URP version 14.0.4).

    Cheers!

    -Cameron
     

    Attached Files:

    DrMeatball and reggie_sgs like this.
  29. fendercodes

    fendercodes

    Joined:
    Feb 4, 2019
    Posts:
    192
    Great asset! Couple of questions:
    1. Do the 4 debug materials have to be in a Resources folder? They get included into builds.
    2. Is it possible to process a mesh via a script? Or do I need to do some digging myself to copy code from your window?
     
  30. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Hi!

    As implemented, the preview materials do need to be in a Resources folder. I should do something about that though - thanks for bringing it to my attention!

    I'll submit an update with a proper fix for this, but in the meantime you can work around this by editing
    FMSMeshToolWindow.cs
    as follows:

    Change lines 661-664 to read:

    Code (CSharp):
    1.             Material headMat = GetMaterialWithName("HeadMat");
    2.             Material bodyMat = GetMaterialWithName("BodyMat");
    3.             Material armsMat = GetMaterialWithName("ArmsMat");
    4.             Material legsMat = GetMaterialWithName("LegsMat");
    5.  
    And add the following function (copied from
    FPSMaterialController
    ) anywhere in the class:

    Code (CSharp):
    1.         protected Material GetMaterialWithName(string matName) {
    2.             var guids = AssetDatabase.FindAssets(matName + " t:material");
    3.             return guids.Length > 0
    4.                 ? (Material) AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guids[0]), typeof(Material))
    5.                 : null;
    6.         }
    7.        
    8.  
    As for processing a mesh via script, that's a bit more involved. Runtime functionality would require a complete rewrite, but if you're just looking for automated edit time functionality (IE cranking out a bunch of FPS meshes from a list or something), that would be more straightforward. It's not written to be done in batches, so there are a lot of assumptions about correct values being set directly in editor window properties and whatnot. If you can give me some idea of your use case, I can probably give better info there.

    Cheers,

    Cameron
     
  31. fendercodes

    fendercodes

    Joined:
    Feb 4, 2019
    Posts:
    192
    Thanks for the quick reply. I'll make that change! I did try renaming the Resources folder to EditorResources as I thought that'd do the trick but no cigar.

    For the script usage, we actually have our own editor window that does a bunch of LODing and setup of our characters. I wanna incorporate it into that so it's just 1 click to do everything when we setup new characters. From your asset, we convert only half of the renderers to be split into Head/Body/Arms and their materials. I guess I'll just need to copy and paste some of your code across or is there public APIs?
     
  32. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    The current version on the asset store isn't in a state that would be convenient to use in an automated workflow, but I started a refactor last night with enabling that in mind. I should have something worth trying in the next day or so if you're interested in testing.

    Just to clarify your intended workflow:
    • Specify a GameObject to prep [API call]
    • Toggle processing for some renderers [edit data struct]
    • ???
    • Profit! [Finalize via API call]
    Is that about right? If so, the refactor I started would get us most of the way there - I just need to stub in a dummy automation flow to iron out the kinks.
     
  33. fendercodes

    fendercodes

    Joined:
    Feb 4, 2019
    Posts:
    192
    Would definitely be happy to test that. So that finalization would create the Mesh asset files in the project right? What are you planning to return to the caller of the API? We don't need you to make a new prefab with everything inside but instead we want to add the new mesh renderers as children to the existing GameObject.
     
  34. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Rev1 would have the same functionality it has currently - creating a prefab with the same structure as the original. Once that's solid, I'm happy to explore adding other options. Perhaps allowing specification of a transform to act as the top level on the created assets would get you what you're looking for? Maybe with an option for auto-determination (crawl up from animator root bone and mesh renderers until first common parent is found, or something like that).

    If send your invoice number to support@codebison.ca, I'll send v1 out as soon as it's ready for testing and we can go from there.
     
  35. too_old

    too_old

    Joined:
    Apr 7, 2023
    Posts:
    2
    Afternoon,
    I'm having issues with the create prefab. taking a huge amount of time (think it basically gets stuck tbh as I've waited an hour to no joy). It detects everything perfectly and the preview instantly, I then click Build FPS mesh and it opens the loading screen on creating directories does this for ~5mins before it then moves to importing asset which then just runs forever. I'm on Unity 2021.3.20f1 just wondered if their is something I can do to fix this ?
     
  36. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    I'm not sure what would be causing that. If you send a copy of the character prefab you're trying to convert to support[at]codebison[dot]ca I can take a look and see what's up with it.
     
  37. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Hi,
    the InvisibleMaterial included in FPS Mesh Tool doesn`t seem to work in Unity 2022.3.5f1 LTS anymore (HDRP) .
    InvisibleMaterialNoShadow works fine.
     
  38. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Thanks for the heads-up! I'll take a look.
     
  39. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    @unicat Here's an HDRP material that will work with Unity 2022.3.5f1.
     

    Attached Files:

  40. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Great, thank you. :)
     
  41. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    425
    Sorry, me again. The body, arms, legs and head materials aren`t working too in Unity 2022.3.5f1 HDRP. They all showing white materials. I have used the HDRP wizard, but it doesn`t work.
    Thank you.
     
  42. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    If you mean the preview materials, it looks like the HDRP wizard doesn't know how to preserve their colors when converting them. Here's a package with converted versions of those materials that should do the trick.
     

    Attached Files:

  43. Nostromos

    Nostromos

    Joined:
    Nov 30, 2019
    Posts:
    22
    Do you have instructions on how to convert the Invisible Material and InvisibleMaterialNoShadow to URP? I converted everything else and your tool is awesome so far (integration with Opsive UCC). I have a working character in my scene separated out perfectly. But when i jump the hands show pink (which means i setup everything great and your tool is working as designed). However, the inivisible material shows pink. Do you have instructions in how to fix this in URP. The Unity built in renderer converter process didn't work. Have you seen this before? Did i miss a step somewhere?
     
  44. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Hi!

    The material I linked in this post should do the trick. Please let me know if not! :)
     
  45. Nostromos

    Nostromos

    Joined:
    Nov 30, 2019
    Posts:
    22
    Thanks that did the trick!
     
  46. NullQubit

    NullQubit

    Joined:
    Jun 1, 2015
    Posts:
    11
    Hey,

    I recently purchased this asset from the store and while it works great I am wondering if it's possible to keep only the hands, or hands + forearm, as opposed to the whole arm.

    Thanks!
     
  47. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Yup!

    You can select any transforms on your model as cut points. Just change the fields in the window from the autoselected shoulders/neck/head to the transforms you want to separate your mesh at. You can do elbows, wrists, fingers, knees, eyes, whatever - you can even use it on nonhuman models (you just have to manually select your cut points). The preview will update in real time so you can see what you're going to get.
     
  48. ciathyza

    ciathyza

    Joined:
    Aug 16, 2015
    Posts:
    112
    I'm trying to use this tool in a HDRP project but the shaders seem incompatible and produce magenta material. Any workaround available?
     
  49. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Hi!

    Yup, depending on which materials aren't working properly for you (some versions of the HDRP pipeline don't know how to convert the preview materials, while others do it just fine), the attached packages should sort you out (completely safe to just import them both).

    Preview materials: The materials that indicate how your mesh will be separated
    Invisible Shadowcaster: The material that will be used at runtime
     

    Attached Files:

  50. albabiwalid

    albabiwalid

    Joined:
    Nov 4, 2017
    Posts:
    3
    Hello, I am using HDRP, is there a way to make the invisible material Work on HDRP?