Search Unity

Poly Few | Mesh Simplifier and Automatic LOD Generator

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

  1. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hello,

    Sorry for the inconvenience caused. This is likely due to some other package in your project that declares a class named "Tuple" in the default assembly without a sperate namespace. The Tuple class is present in the System namespace as well. You have to either declare that other Tuple class in it's own namespace or you simply remove it from your project.
    You can verify this by creating a new empty project and importing PolyFew inside you'll see that you don't get an such errors.

    Let me know if you need further assistance.
     
  2. alexis78963_unity

    alexis78963_unity

    Joined:
    May 9, 2019
    Posts:
    14
    Hello,

    I would like to change the render queue of some of the combined materials to avoid overdraw. It seems that the material render queue gets automatically set to 2000 even if I save the material. Is there a way to change this value?

    Thanks,
    Alexis
     
  3. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hi Alex for certain reasons to tackle for rare cases the render queue in opaque mode is set to 2000 you can force it to 5000 by doing a small change in the BatchFewShaderGUI.cs (Search in the Polyfew folder). Go to line 322 and change -1 to 5000 and save the file. This should do the trick. Whenever opaque mode is selected you will have the Renderqueue as 5000. Look at the image below.

    upload_2022-8-30_15-21-13.png
     
    alexis78963_unity likes this.
  4. alexis78963_unity

    alexis78963_unity

    Joined:
    May 9, 2019
    Posts:
    14
    Hello,
    Thanks a lot for the quick answer.
    So if I want two different materials with opaque mode to have different render queue it's not possible right now right?
     
  5. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Yes, unfortunately since the BatchFewStandard shader is a modified version of the UnityStandardShader to support texture arrays and the UnityStandardShader doesn't allow you to change render queue settings
     
    alexis78963_unity likes this.
  6. MorpheusXI

    MorpheusXI

    Joined:
    Jan 18, 2018
    Posts:
    74
    U2019.4.36f1 - Not sure if this is a bug or issue with my download, I have deleted & re-imported. Variable 'e' is declared but never used.
    upload_2022-9-22_19-29-26.png
     
  7. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hi,

    This is not a bug and won't cause any harm whatsoever. It's just a sloppy mistake that I had made. I'll get the warning removed in a future update. At the moment you should be fine with it. It's not a bug!
     
  8. Abbrew

    Abbrew

    Joined:
    Jan 1, 2018
    Posts:
    417
    Hello, I'm on Unity 2022.2.0b10, and am getting the following compilation errors

    Code (CSharp):
    1. Assets/PolyFew/Scripts/NonEditor/EditorCoroutines.cs(87,11): error CS1069: The type name 'WWW' could not be found in the namespace 'UnityEngine'. This type has been forwarded to assembly 'UnityEngine.UnityWebRequestWWWModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' Enable the built in package 'Unity Web Request WWW' in the Package Manager window to fix this error.
    Code (CSharp):
    1. Assets/PolyFew/ThirdParty/AsImpL/Scripts/Loaders/Loader.cs(1460,41): error CS1069: The type name 'WWW' could not be found in the namespace 'UnityEngine'. This type has been forwarded to assembly 'UnityEngine.UnityWebRequestWWWModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' Enable the built in package 'Unity Web Request WWW' in the Package Manager window to fix this error.
    Is this an issue with Unity 2022?
     
  9. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hello Abrew, Apologies for the inconvenience caused. Looks like unity decided to move some of their code to a different assembly in the latest version. Don't know why they often do that, but it breaks people code. I'll issue a quick fix to this and let you know so that you can update.

    EDIT: Please update to v7.66 to resolve this
     
    Last edited: Oct 29, 2022
  10. Abbrew

    Abbrew

    Joined:
    Jan 1, 2018
    Posts:
    417
    Thank you for your support. Your update seems to have removed the deprecated www reference, which is good, but there are a few more compilation errors due to Unity not being able to recognize some class names. They are at

    Code (CSharp):
    1. #if UNITY_2017_1_OR_NEWER
    2.             ScreenCapture.CaptureScreenshot(fileName);
    3. #else
    4.             Application.CaptureScreenshot(fileName);
    5. #endif
    and
    Code (CSharp):
    1. #if UNITY_2018_3_OR_NEWER
    2.                 tex = DownloadHandlerTexture.GetContent(loader);
    3. #else
    4.                 tex = loader.texture;
    5. #endif
    Not sure if ScreenCapture and DownloadHandlerTexture are deprecated, or belong to different namespaces
     
  11. Abbrew

    Abbrew

    Joined:
    Jan 1, 2018
    Posts:
    417
    Nevermind, I had previously deleted
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    and
    "com.unity.modules.screencapture": "1.0.0",
    in order to save space, but their absence caused those compilation errors. I put them back. @Brain-_-Fail your fix worked, and now Poly Few works in 2022.2. Thank you!
     
  12. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Very cool Asset, does this work for URP?
     
  13. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    It works for all render pipelines (SRP, URP, HDRP or a custom one). The only thing to note here is that the material combiner cannot combine any other materials than the UnityStandardShader based ones. In simple terms the materials combiner cannot combine your URP, HDRP materials. Other than the material combiner every single functionality of the tool works for all render pipelines.
     
  14. dan_soqqle

    dan_soqqle

    Joined:
    Feb 2, 2022
    Posts:
    114
    Hi anyone has issue with geometry? Frequently after i combined a mesh and applied a reduction, i hit this error

    "[PathTracer] Failed to add geometry for mesh 'xxx_combined_static'; mesh contains non-finite values." Then the baking cannot complete.

    It is a bit random and happens on both LOD level as well as on the main mesh.

    how do i investigate this further?
     
  15. orville_redenbacher

    orville_redenbacher

    Joined:
    Sep 9, 2018
    Posts:
    34
    Does this allow importing an OBJ on mobile platforms?
     
  16. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Yes, it does.
     
    orville_redenbacher likes this.
  17. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    Hi, OP Brain-_-Fail

    Can I use this plugin to merge a clump of meshes AND remove the hidden/internal vertices of the resulting batched polygons?
     
  18. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hi,

    You can only combine/merge meshes. PolyFew is not able to remove internal shared vertices.
     
  19. Jackrabbit82

    Jackrabbit82

    Joined:
    Mar 13, 2013
    Posts:
    16
    Hello really amazing package that I've used for years, but I've got a bit of a noob question. I'm trying to speed up my process by wrapping the settings via an editor script with a shortcut. I'm a bit lost on how to do this and interface with the polyfew monobehaviour settings. Any example you could provide to interact with the
    "BrainFailProductions.PolyFewRuntime.PolyfewRuntime.SimplificationOptions" ?

    I'm adding the component without issues, but I'm missing some coding basics to be able to fully use the API and apply some default setting then call the "Reduce" button.
     
  20. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    Hi, you can play around with the demo scene included. There is a script that drives the demo scene and uses the runtime API. It might be a good starting point.
     
  21. Cheo6

    Cheo6

    Joined:
    Nov 20, 2017
    Posts:
    28
    Hello, I used this asset with no issues about a year ago, but now am unable to simply have the Poly Few Host appear. According to the documentation and tutorial it is necessary to have the Transform gizmo enabled, but I can't find in the gizmos list, and it is enabled anyway. I've tried with an empty project in Unity 2021.3.21, 2022.1.23 and 2022.2.12, but with no differences. Am I the only one with this problem ? Thanks in advance for your help.

    Edit : So I just realized that the Poly Few component can manually be added to any object so that allows me to resume my work, but that issue should still be solved nonetheless if I'm not the only one experiencing it. I should also add that I updated Poly Few before importing it, I don't know if there's something wrong with the latest version.
     
    Last edited: Mar 31, 2023
  22. Brain-_-Fail

    Brain-_-Fail

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

    I'm sorry for the frustration caused to you. In the older versions of Polyfew you didn't have to do anything in order to start working with it. It would just pop up for feasible gameobjects. Upon the requests of many users, in the newer versions I have removed the feature and you have to manually add the Polyfew component inorder to work with it.

    upload_2023-4-2_15-15-49.png
     
    Cheo6 likes this.
  23. Cheo6

    Cheo6

    Joined:
    Nov 20, 2017
    Posts:
    28
    Oh ok thanks, come to think I too think it's best to leave devs add this component when they need to instead of automatically adding it to every object. You might want to update the youtube tutorial and read me file about this.
     
  24. ak2001

    ak2001

    Joined:
    May 7, 2022
    Posts:
    6
    Hi! How do I save the Poly Few generated mesh, so that I can attach it to a prefab?
     
  25. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    After adjusting the reduction slider and other settings to your taste, click the "Reduce" button towards the right hand corner of the Polyfew inspector window and follow the prompts and save the meshes and your scene afterwards. This will allow the changes to be persistent and be used in prefas.
     
  26. cmo

    cmo

    Joined:
    Aug 10, 2012
    Posts:
    13
    Hi, I just started trying to use PolyFew. I'm on version 7.72 in Unity 2022.2.12f1.

    First of all, please consider updating your documentation and store description (not the video, I know that's too time consuming) for newer versions. For newer versions (of Unity or PolyFew) the location to choose .NET framework has changed and has totally different options, the Transform Gizmo and view are renamed / different, the button in the PolyFew component to reach the FAQs page leads to a nonexistent website, the PolyFew component does not appear automatically, and multiple other inconsistencies. I believe updating docs would be fast for you and save buyers significant time. Thanks for considering.

    That said, I have the PolyFew component on my test objects. Everything is working great, except when I use Automatic LOD. In that case I get these errors. First error:

    Code (CSharp):
    1.  
    2. ObjectDisposedException: SerializedProperty m_LODs.Array.data[2].renderers has disappeared!
    3. UnityEditor.SerializedProperty.get_minArraySize () (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    4. UnityEditorInternal.ReorderableList.get_count () (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    5. UnityEditor.LODGroupEditor+<>c.<UpdateRendererMeshListCounts>b__29_0 (UnityEditorInternal.ReorderableList i) (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    6. System.Linq.Enumerable+SelectArrayIterator`2[TSource,TResult].ToArray () (at <40b481cb584843bbbf4c840095ac6811>:0)
    7. System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <40b481cb584843bbbf4c840095ac6811>:0)
    8. UnityEditor.LODGroupEditor.UpdateRendererMeshListCounts () (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    9. UnityEditor.LODGroupEditor.DrawLODRendererMeshListItems (UnityEngine.Rect rect, System.Int32 index, System.Boolean isActive, System.Boolean isFocused) (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    10. UnityEditorInternal.ReorderableList.DoListElements (UnityEngine.Rect listRect, UnityEngine.Rect visibleRect) (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    11. UnityEditorInternal.ReorderableList.DoLayoutList () (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    12. UnityEditor.LODGroupEditor.DrawLODGroupFoldout (UnityEngine.Camera camera, System.Int32 lodGroupIndex, UnityEditor.SavedBool& foldoutState) (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    13. UnityEditor.LODGroupEditor.DrawLODGroupFoldouts () (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    14. UnityEditor.LODGroupEditor.OnInspectorGUI () (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    15. UnityEditor.UIElements.InspectorElement+<>c__DisplayClass71_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    16. UnityEditor.SceneManagement.EditorSceneManager:SaveCurrentModifiedScenesIfUserWantsTo()
    17. BrainFailProductions.PolyFew.InspectorDrawer:OnInspectorGUI() (at Assets/PolyFew/Scripts/Editor/InspectorDrawer.cs:2859)
    18. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    19.  
    Second error:
    Code (CSharp):
    1. IndexOutOfRangeException: Index was outside the bounds of the array.
    2. UnityEditor.LODGroupEditor.DrawLODGroupFoldout (UnityEngine.Camera camera, System.Int32 lodGroupIndex, UnityEditor.SavedBool& foldoutState) (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    3. UnityEditor.LODGroupEditor.DrawLODGroupFoldouts () (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    4. UnityEditor.LODGroupEditor.OnInspectorGUI () (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    5. UnityEditor.UIElements.InspectorElement+<>c__DisplayClass71_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    6. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    The second error will spam constantly if I interact with the PolyFew component in any way. In case I delete the component, the LOD groups will work without any issue, so this isn't completely stopping me from using PolyFew. I am guessing these are related to PolyFew code rather than my mesh, but in case you need more repro details let me know.

    Finally, there is one other error that appears when I use Reduce:
    Code (CSharp):
    1. EndLayoutGroup: BeginLayoutGroup must be called first.
    2. UnityEditor.EditorGUILayout:EndVertical ()
    3. BrainFailProductions.PolyFew.InspectorDrawer:OnInspectorGUI () (at Assets/PolyFew/Scripts/Editor/InspectorDrawer.cs:3675)
    4. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
     
  27. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    My apologies for the inconvenience caused. I'll get the documentation updated.

    The first two errors quoted shouldn't happen normally. You can try generating LODs once again maybe on a different model, it should work fine. I have tested it on my end, and it works flawlessly. Haven't even got a complaint from any customer for a while about any errors. Maybe some inconsistency with the model at your end may have caused it? but I need more details, the exact steps needed in order to reproduce these errors at my end and fix them.

    The last error about the layoutgroup is a bug in the internal unity API and can't be fixed in my code. It doesn't happen in older versions of Unity though but, it's a harmless bug so can be ignored.

    If you don't mind, can you kindly contact me @kbawar555@gmail.com to discuss this issue in more detail and possibly get this resolved?
     
  28. roundyyy

    roundyyy

    Joined:
    Dec 23, 2019
    Posts:
    112
    Hello. I imported polyfew to project and it doesn't appear as component on gameobjects and cannot find the way to add it or even use it. Unity 2022.3.5, urp
     
  29. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    You must manually add the polyfew component on a GameObject to use it. Just as you would normally add any other component in unity.
     
  30. SAMYTHEBIGJUICY

    SAMYTHEBIGJUICY

    Joined:
    Jul 12, 2023
    Posts:
    45
    After the auto LODs are set and polyfew has done its thing should we be removing the component?
     
  31. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    As with most of the components in Unity there is some data that the polyfew component has of you gameobject. If you remove the polyfew component, you will lose the ability to remove LODs and delete the associated mesh files with a click of a button "DestroyLODs". In case that you simplify meshes only and do not generate LODs you will lose the ability to undo the operations and reset the mesh(es) to previous states (Before simplification).

    There is very less to no overhead with Poly few on and you can remove it if you don't need any of the above.
     
  32. SAMYTHEBIGJUICY

    SAMYTHEBIGJUICY

    Joined:
    Jul 12, 2023
    Posts:
    45
    Is there a batching process? Where multiple GOs can be polyfewed/LODed?
     
  33. SAMYTHEBIGJUICY

    SAMYTHEBIGJUICY

    Joined:
    Jul 12, 2023
    Posts:
    45
    dude, this might be the greatest asset of all time. With preserve borders and edge sort and regard curvature I can literally just bin 40% of my tris of ANY mesh wtf. If you could develop a feature where I can apply the same settings for multiple prefabs and just iterate through them I would pay you a billion dollars
     
  34. Brain-_-Fail

    Brain-_-Fail

    Joined:
    Jan 21, 2017
    Posts:
    120
    You can add Polyfew component to all the objects that you want to generate LOD for. Then select them all and change the settings for LODs and generate. This would generate LODs for all of the selected objects with the settings you specified. Polyfew also supports Unity presets so you can store common settings in a file and use them throughout you project.
     
    SAMYTHEBIGJUICY likes this.
  35. Zynek

    Zynek

    Joined:
    Jun 28, 2015
    Posts:
    4
    Hello, I just started using the Polyfew and I am very pleased with the results. I do have one issue with it - When using "Consider Children" on complex hierarchy the tool does not take into account mesh instances and creates new mesh/file per renderer instead of per mesh. So it can get pretty messy.
    If that could be improved, I´m sure it would be appreciated!

    Thank you and have a nice day
     
  36. Zynek

    Zynek

    Joined:
    Jun 28, 2015
    Posts:
    4
    Also heads up - Polyfew version 7.76 is not compatible with Unity 2023.3.0b9 due to API changes in GUI
     
  37. URGr8

    URGr8

    Joined:
    Sep 10, 2012
    Posts:
    24
    So I dont know if its a bug in PolyFew or something else. But my scene file went from 20Meg to 1.5 Gig. I combined stuff and then combined materials. I was also doing some poly reduction on objects, I did some undos inbetween. I looked at the combined meshes and textures and reduced poly meshs and they are all fine. But the scene file size is still 1.5 gig. When I remove the combined assets in the file, then it starts going back down. Can you help me figure this out. Seems like it's keeping links to something around. Also I can't see or destroy the objects it creates. I can undo stuff, but the files are still in the directory. One last thing. when you combine materials, it seems that normal, spec and other things besides diffuse are not getting set to the properties, they were full res. I am using Unity 2019.4.40f1.