Search Unity

Poly Few | Mesh Simplifier and Automatic LOD Generator

Discussion in 'Assets and Asset Store' started by Brain-_-Fail, Jan 18, 2020.

  1. arie1994

    arie1994

    Joined:
    Jun 30, 2016
    Posts:
    86
    did the "smart linking" change to "use edge sort"? are they the same? I get hole in my buildings if I don't use "use edge sort" and "regard curvature" but its still leave some holes.
     
  2. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    The "enable smart linking" option has been removed and it is always set to true in the new versions. The "use edge sort" and "regard curvature" are new settings that were added far back. To cater holes you should either adjust your "Reduction Strength" accordingly or use preservation spheres near the areas of holes to preserve the polygons of that area during mesh simplification so that holes don't occur.
     
  3. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    Still getting "The type or namespace name 'ScriptedImporter' could not be found" error.

    Unity 2020.2.f1
    PolyFew 5.8
     
  4. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    This seems very strange. As I'm sure I fixed the namespace issue and the problem doesn't occur anymore in Unity 2020.2+. Follow these steps:

    ► Please go to PolyFew > Scripts > NonEditor-Scripts
    ► Open "AttributesImage.cs" script.
    ► Look for the top ten lines of code and see if they match the ones in the image attached below. (Or send me the screenshot of them).
     

    Attached Files:

    nobluff67 likes this.
  5. OdoohGames

    OdoohGames

    Joined:
    Mar 11, 2019
    Posts:
    1
    Wasn't the one who reported it but thank you, it fixed the problem!
     
  6. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    I have one request, can you make the colors easier to read on the dark skin ? or take out the many colors so I can read the text better, the red, blue and the green are not easy to read. thanks!

    Screenshot 2021-01-03 at 13.05.59.png
    Here is how I would change it

    Screenshot 2021-01-03 at 13.38.20.png
     
    Last edited: Jan 3, 2021
  7. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    It seems like the Unity update system bug hit you guys. There is an old bug that if you make any changes manually to an asset then the update system might not show you any newer updates for the same asset. Or sometimes it updates partially with unknown reasons. When I download and import the asset from the asset store at my end I do see the 10 lines of "AttributesImage.cs" to match the ones in the image attached and hence I don't see any errors.
     

    Attached Files:

  8. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120

    Hi Lars, Thank you for the suggestion. Will add this feature in the next update soon. Also I'm grateful to you for providing the new color scheme for dark mode.

    EDIT: Please update to v5.9 which allows you to switch between the default/colorful skin and a new simple plain skin for Unity's dark mode.
     
    Last edited: Jan 6, 2021
    Lars-Steenhoff likes this.
  9. Victoralm

    Victoralm

    Joined:
    Dec 31, 2015
    Posts:
    30
    Hi all!
    With Unity 2019.4.17 I'm having an error on the
    ObjImportWindow.cs
    :
    Code (CSharp):
    1. Assets\PolyFew\ThirdParty\AsImpL\Scripts\Editor\ObjImportWindow.cs(35,17): error CS0246: The type or namespace name 'ObjectImporter' could not be found (are you missing a using directive or an assembly reference?)
    Had someone got it too? Help needed.
     
  10. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hi, seems like you're using an older version of PolyFew. As the script that was causing you this error was removed in the newer versions. Please update to the latest version from the asset store to fix this.
     
    Victoralm likes this.
  11. Victoralm

    Victoralm

    Joined:
    Dec 31, 2015
    Posts:
    30
    Thanks, I deleted the folder on the project, reinstall it and its working like a charm!!
     
  12. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    Thanks for the quick response, since it seemed that no one else was having this issue I assumed it was on my side. I had Polyfew in a large project with a lot of other assets and other mesh simplification assets.
    I Tested it finally in a clean project with just the models and it worked as expected. FYI this asset does the best job at keeping the characters as low poly as possible while keeping them looking decent. (No holes, missing limbs, or odd deformations).
    averaging 80% reduction, Great job
     
  13. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    I'm glad that you sorted out the issue. Thanks for the compliments as well. I'm happy that you like the tool and it works out for you. Happy development and fun while building your game :)
     
  14. RegisB

    RegisB

    Joined:
    May 14, 2013
    Posts:
    41
    Hi Brain-_-Fail,
    Is there some update on your plans on making your plugin support URP materials ?
    It seems very important as URP is out of beta I think, and becoming the new standard in Unity, isn't it ?
    Or maybe a way to personnalize your texture array system ? Or any trick or recommendation on how we could bypass this limitation ?
    Thanks.
     
    Last edited: Jan 6, 2021
  15. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hi, URP and the other scriptable pipelines are still not mature. Unity is continuously altering the shader code for fixing stuff, adding new features and a lot of other things. BatchFew combines materials based on Texture Arrays which requires rewrite of Unity shaders for each Render pipeline. Thus the current instability/Shader modification of URP and HDRP doesn't make it feasible for me to add support for it. This is also the reason why long term projects are still sticking with the older render pipeline.
     
  16. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    161
    I have five meshes to combine. When I combine them all of their colliders are offset. What's going on?
     
  17. m_sigepon

    m_sigepon

    Joined:
    Feb 13, 2017
    Posts:
    4
    There is a feature I would like you to add to the PolyFew options.
    Option to maintain symmetry
    The ability to maintain polygon symmetry affects the appearance.
    Craving for the implementation of this feature.

    Consider Thank you.
     
  18. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    It's quite non-trivial in the way unity handles polygons and triangles and because of the limitations of the unity mesh APIs. Even if I were to make this from scratch it would be either very limited in functionality or super slow.

    So can't say that this feature would come any time soon :(
     
  19. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    647
    @Brain-_-Fail Hello Is there any option to exclude some objects of hierarchy when making LOD, I mean when using deep reduction, Cause I have like 10 mesh renderers here but I would like to exclude few of them,
     
  20. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hi Jakub,

    Just disable a gameobject in the hierarchy or disable its renderer and that won't be included in the LOD generation process.
     
    Jakub_Machowski likes this.
  21. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    Having a lot of problems with Polyfew not auto-attaching to mesh objects even with Auto-Attach enabled. polyfew disappears when I click away, so I have to go to them menu and choose Attach Polyfew to Object.
    upload_2021-3-24_18-24-28.png

    I'm also having trouble with Polyfew referring to out-of-date meshes when performing reductions. I'm editing the base mesh in unity and saving it to disk, but polyfew doesn't pick up the changes unless I save an entirely new filename. Is it possible to reset polyfew on an object?
     
  22. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hi, Sorry for the inconvenience caused. Can you please confirm which version of PolyFew you have ?. The version number should be mentioned in the subscript where the title "Poly Few" shows up in the inspector.

    I am not sure if I quite understand the second problem you mentioned but, If you assigned some new meshes to an object, make sure that before doing so you have the reduction slider set to 0. After assigning the new meshes you should select another object (non-meshless) in the hierarchy and then reselect the previous one again (The one you changed the meshes on). This is how you can reset PolyFew for an object
     
    Last edited: Mar 24, 2021
  23. ScorphiusMultiplayer

    ScorphiusMultiplayer

    Joined:
    Nov 10, 2018
    Posts:
    66
    Hi,
    I have a similar issue.
    After attaching The Poly few Component in editor mode, it disappears/gets deleted from the Gameobject in Editor mode if I click on some other Gamobject.

    using version Polyfew v6.6
    with unity 2020.1 (LTS)
     
  24. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    That's normal behavior. This is expected. Unlike other assets, Polyfew doesn't work on the component serialization model. In simple terms, PolyFewHost component that you see is just used to display the PolyFew UI and do nothing else. It doesn't store the data that is used to perform multiple operations on objects. The data is stored somewhere else and in order to make Polyfew as efficient as possible it uses a custom storage mechanism to store the complex data. This is the reason that as soon as you select another object the PolyFewHost component gets deleted from the old one you attached it to. I could make it so that it doesn't detach in case if you manually attach it but it would cause users confusion and they might think that the data associated with the previous object is also intact (Which won't be the case).
    btw PolyFew is not meant to be used to manually attach the PolyFewHost component. It should be left on Auto attaching. This auto attaching doesn't mean that it attaches itself to everything in the scene. It simply attaches to the current feasible selection and then gets automatically deleted from the same object when it loses focus. So, I know it might be strange to accept this fact but keep trust and enable the auto UI attaching and let PolyFew do its job :)
     
    ScorphiusMultiplayer likes this.
  25. ScorphiusMultiplayer

    ScorphiusMultiplayer

    Joined:
    Nov 10, 2018
    Posts:
    66
    Thanks for your response.
    Its an amazing asset. No need for for 3rd party tools.
     
  26. LootlabGames

    LootlabGames

    Joined:
    Nov 21, 2014
    Posts:
    343
    Hello I am interested in PolyFew but I had a couple questions.

    -Is there a way to combine skinned meshes at runtime programmatically(if the objects use the same material)?

    -Does BatchFew use it's own shader(after combining) instead of using the original shader for the object?
     
  27. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hi,

    ►You can combine meshes at runtime whether they are skinned or static.
    ► Yes, BatchFew uses its own shader after combining materials that is a modification of the unity standard shader to support texture arrays. Also please note that BatchFew can only combine materials that use the unity standard shader.
     
  28. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    @Brain-_-Fail - hi there, already own this asset and use it for lots of things. However, I was wondering if there was (or if it was in the roadmap) any way to do blendshapes simplification (ie. so that blendshapes only contain data for vertices that change). Blender shape keys do this. I was just wondering. It would greatly reduce the size of complex or combined or reduced models in memory, is what I was thinking.
     
  29. Artini

    Artini

    Joined:
    Jan 29, 2016
    Posts:
    181
    I just wonder, if this asset could be used for NPR art?
     
  30. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hey, great idea!. I'll see if unity would allow certain operations on BlendShapes. If so, then I'll add this feature in the next update.

    A quick question. In what way would you like this feature?. Should it be allowed as a separate operation that can just simplify blendshapes? or should there be a checkbox sort of thing that when tick marked will simplify blendshapes only when Polygon reduction operation is performed?
     
    Duffer123 likes this.
  31. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Well, you can use it with anything mesh. PolyFew doesn't care about what you give it as long as it is something that unity can understand as a mesh associated with a MeshRenderer or SkinnedMeshRenderer component. However, PolyFew is not intelligent to understand the theme behind a model. Regardless of the mesh topology, it would treat all meshes exactly the same. So, It can't be said what would happen if you use it on a cubic stylized mesh for example. It might not retain the original cubic essence?. No sure answers for this :(
     
  32. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    @Brain-_-Fail ,

    Mesh methods would allow you to store, alter, clear, add blendshapes but beyond that I am outclassed on coding it...

    Honestly, both sets of functionality would be very useful indeed.

    Both a feature (separate operation) rationalising and compacting /compressing blendshapes just on its own AND a feature that does that when Polygon etc reducing would be amazing..

    For me the first option more attractive than the second because I, like many, have complex models with lots of blendshapes in the hierarchy...
     
    Last edited: Apr 30, 2021
  33. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    @Brain-_-Fail ... really hope the standalone (hierarchy) 'BlendShapes Compression' functionality can be implemented. It would be a total godsend for me and I suspect many others having complex models with very many blendshapes...
     
  34. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    276
    I've just started using this and I have to say it works really well and I'm impressed with the way it intelligently reduces meshes but I've had a few small issues.

    I'm using 2020.3.3f1 and after initially installing and doing some reductions, it's suddenly stopped adding the polyfew script to objects when I select them. I can manually add the script through the menu option but clicking off the object removes the script and I have to add it again. I've tried the menu options to enable/disable automatic attaching but they have no effect. If I select the option to automatically add the script, it will add it to the current game object but then no longer add it automatically.

    I've also noticed that when unselecting "Use Edge Sort", it seems that the preview gets disabled.
     
  35. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hi, I believe that you have disabled the gizmos or you might not be in the scene view. See the image below and follow the steps indicated.

    new.PNG


    Are you sure the preview gets disabled when using Edge sort?. I believe It's not possible. You might be missing something. Maybe the model isn't getting reduced further when you select "Use Edge Sort" and it might look like that the preview is disabled. Can you please elaborate a little bit on this?.
     
  36. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    It's on the way pal. The next update is due. Just trying to spare some hours to finish the work and push it.

    EDIT: Project Failed :( I built the code to do that and everything but in the end, I came to know that unity doesn't support doing that. Even though it can be implied from the docs that such a thing is possible but it's not. The problem is that when you remove delta normals or delta tangents from a blend shape frame, unity recalculates them automatically. In simple terms, you just can't remove normals or tangents data from blendshapes in because unity recalculates and adds them again. I'll still keep the functionality with the hope that this might be possible in future updates of Unity.
    PS: I tested this on Unity 2021.1.5f1 (64-bit)
     
    Last edited: May 5, 2021
    Duffer123 likes this.
  37. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    @Brain-_-Fail ,

    Oh no!

    Isn't it possible to store all the blendshapes and frames in a database class, then clear them down to nothing on the skinned mesh, then optimise the blendshapes in the database class then add them back in to the skinned mesh?
     
  38. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    Hi, when I reduce meshes that have narrow tubes or cylinders and similar like cables and pipes, this happens. It becomes completely flat. Using spheres is not an options since that would mean dozens of them, and if I reduce the strength it's not much of a reduction. Is it possible to make it at least save three polygons in
    circumference so you at all times have some volume left?
    {4123AB9B-84BC-46B5-9763-0A3ECFDE898E}.png
     
  39. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    No matter how you do it. The end result is the same. Unity doesn't like empty blendshapes normals and tangents data. So if you provide empty data it calculates them and assigns it to the mesh.
     
    Duffer123 likes this.
  40. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    There's not much that can be done in this regard. Mesh simplification algorithms are totally non-deterministic and they can change results based on the input mesh. Even if you have meshes that look exactly the same, the results can differ due to the layout of Polygons. The only way you can control reduction deep down to the polygons level is by using tolerance spheres but that you said is difficult to use in this case. Btw did you try using different preservation options?. What do the "Regards Curvature" and the "Use Edge Sort" do in this case?. Do they help?
     
  41. knas01

    knas01

    Joined:
    Feb 24, 2018
    Posts:
    236
    @Brain-_-Fail Ah, that's too bad. I thought I'd ask anyway since if your mesh is complex you might miss a few cases like this until you used the mesh in many places. Also, you sometimes have to do less reduction than possible due to not being able to avoid this.
    Yes, I use those options. I have to, else the mesh loses its shapes completely and cables and similar loses way too many polygons and becomes stretched or warped. It was a while ago so I forgot which ones I used, but it's necessary.
     
  42. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    Damn... such a shame..
     
  43. ScottJak

    ScottJak

    Joined:
    Jul 23, 2020
    Posts:
    7
    Had an issue today where our editor (2020.3.6f1) was crashing when shift selecting items in the editor. Eventually tracked down the issue to PolyFew through trial and error. No idea why and the crash logs weren't helpful:


    Dereferencing NULL PPtr!

    Stacktrace:


    =================================================================
    Got a SIGSEGV while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

    Anywho, just wanted to mention it in case someone else runs into this issue. For now we're just going to pull PolyFew down when we need it and leave it out of version control. Should also mention that it's a hefty project, so might not be PolyFew's fault as much as PolyFew and one of our other scripts/assets not getting along.
     
    Duffer123 likes this.
  44. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    @Brain-_-Fail I forgot to say please do keep the functionality in the next release as I can probably/maybe live with changes to tangents and normals but not vertices in (rationalised/compressed) blendshape frames..
     
  45. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    @Brain-_-Fail , another (hopefully good) thought I had is would it make a difference if, using this functionality in PolyFew, the user first set Vertex Compression under Player under Project Settings in Unity to 'None'? I think that may arrest automatic changes to normals and tangents when your asset is crunching down blendshapes?



     
    Last edited: May 7, 2021
  46. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    This has nothing to do with it. It's a limitation with the Unity APIs. Internally they are recalculating the changing normals and tangents if you don't explicitly specify them. That's what is happening. You either remove everything that is clear out blendshapes completely or otherwise live with what unity does.
     
    Duffer123 likes this.
  47. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    Damn. Well thought I would ask...! Thanks though for looking so carefully at this and do leave in the functionality if you can (with an InfoBox warning about tangents and normals!).
     
  48. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Yeah, I'm leaving the functionality but with a disclaimer note in the tooltips.
     
    Duffer123 likes this.
  49. BenoitT8

    BenoitT8

    Joined:
    Apr 12, 2020
    Posts:
    1
    Great tool that save us a lot of time !

    Is there a way, when you batch together several prefabs into only one mesh, to keep their colliders?
     
  50. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    You can use the colliders with the uncombined objects as placeholders for the new combined mesh. Collision works that way. You can also use mesh colliders from the old/uncombined objects.
    If you combine several meshes into one then you have a new mesh that looks like a combination of the previous meshes. You can add a mesh collider component and generate a mesh collider for the new combined mesh object as well.

    The old mesh colliders or any colliders for that matter are not lost you still have them with the newly combined gameobject and the collision works fine. You might be missing something. Can you please provide a little bit more information about what you're doing and what exactly is the problem that you're facing, so that I can provide more help?.