Search Unity

SimpleLOD user support thread

Discussion in 'Assets and Asset Store' started by Orbcreation, Nov 25, 2014.

  1. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Just bought it now too. I have another tool that apparently does combine skinned meshes but I just can't get it to work. Hopefully this will be easier to use. All I really need is the skinned mesh combining functionality ... the LOD generation is just a bonus for me.
     
  2. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    I tried to use it and I'm having trouble. When I select a skinned mesh character, what I find is that one of two things happens:

    1 - Either the combined skinned mesh is created but any normal meshes that were attached to the bones are in the wrong place and the animations are completely warped when playing. This is with a skinned mesh using legacy animation.

    2 - The skinned mesh is combined but the bounds are set to 0 values and the combined mesh is not visible. The normal meshes attached to bones also don't appear to have been combined into the new combined skinned mesh.

    I went through the documentation but it's very sparse and it's not clear what I'm doing wrong. It says I should "clean up the original mesh" as step 1. Can you please explain what this means? Should I disable / delete meshes that I don't want in the combined mesh? I did do that by both deleting and also tried just disabling them in the inspector but I get the same results. Anything else I should be doing?
     
  3. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    Yes, I use it in Unity 5 myself.
    I discovered one little disappointment though. The build target of my own project is WebGL and it turns out WebGL performs great when it comes to your regular gameplay and graphics stuff. Until you start doing heavy calculations (like SimpleLOD does), then it suddenly gets sloooooooow. Creating LOD's still works (not in the background, because WebGL doesnt support threads) but it is a few times slower than normal.
    The other build targets work fast.
     
  4. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    You should put a link to the asset store page for your product in your original post at the top of the thread. I was looking for it to write a review. It will help sales because people can click directly from the top post.

    Oh, nevermind. I found it! Maybe make it more visible for people like me? LOL
     
  5. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @Rajmahal
    You have normal meshes attached to bones themselves? Those can not be combined together with the skinned mesh. So you should leave those as they are and give them their own LOD levels.
    We may also need to recalculate the bounds

    Can you mail me your mesh? richard (thingy) orbcreation (dot) com
    Then I can have a look at the problems and come up with a solution for you.
     
  6. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Sure .. will do. Seems to be happening to all the models I've tried ... in most cases, the original combined mesh disappears and only those objects attached to the bones remain. Also, almost all of my models have meshes attached to bones ... so I hope there's an easy solution.
     
  7. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Email sent .. let me know if you didn't get it.
     
  8. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    That's really unfortunate because this is precisely why I purchased your product lol but.. I planned to use it with Sectr Complete which streams parts of your world on demand without lag. WebGL may be working in 64 Bit soon since it's JS.. Google Chrome released an new browser "Canary" https://www.google.com/chrome/browser/canary.html which is 64 Bit and has helped out with some JS processing/parsing speed. Apparently Multi-threading is currently being developed for WebGL, there are some that state they use multi-threading through web workers and web sockets


    Hopefully the Unity team is aware of this and are working on it.
     
  9. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @Rajmahal A new version is in beta now. I have send you a copy. This will remap skinned meshes when the bindposes are not identical. It will also append non-skinned meshes (like weapons) to the merged skinned mesh.
     
    Rajmahal likes this.
  10. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Thanks .... will check it out tonight.
     
  11. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Checked it out and tested on a few of my really complex models. It works brilliantly! Models that were 35 draw calls earlier are now just 4 or 5 max. Absolutely love it.
     
  12. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    Version 1.2 is now available in the Asset Store. It contains a lot of small and big improvements. Here's an overview:
    - When merging meshes of child objects results in a mesh with more than Unity's limit of 64K vertices, it will automatically be split into multiple parts
    - Compression algorithm improved for even better results
    - Editor panel now has sliders to set the compression levels
    - Removal of tiny parts in LOD meshes can now be controlled with a slider
    - Support for vertex colors
    - Support for uv3 and uv4
    - Blendshapes of main mesh now remain intact after merging
    - Skinned meshes with (slightly) different bones can now be merged
    - Skinned meshes with different bindposes will be remapped and merged
    - Non-skinned meshes (like weapons) that are attached to the bones directly can now be merged together in a skinned mesh. The original transforms will become new bones.
    You can find the full release notes here

    Below is an image that shows the difference between the triangle reduction in version 1.1 and version 1.2 (middle) Only difference between the orginal and the reduced mesh of version 1.2, that I can see, is the chin and her left eye socket. But hey, this is for distant viewing!
    ImprovedAlgorithm1.2.jpg
     
    Rajmahal, hopeful and red2blue like this.
  13. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Can this asset reduce polygons for skinned and animated characters (for example Mixamo Fuse characters that have already been rigged and animated).

    How is the reduction quality if you take a character with ~15k tris and try to reduce it down to ~1k tris? Do you have an example of such a massive poly reduction on a skinned character?

    Thanks so much!
     
  14. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @eridani
    Yes rigged characters stay functional.
    The 1st advantage of SimpleLOD when using Mixamo characters is that it merges the meshes. Instead of 5 skinned meshes you will have only one. See this manual page: http://docs.unity3d.com/Manual/MecanimPeformanceandOptimization.html where is says: "Combine skinned meshes whenever possible. Splitting a character into two Skinned Mesh Renderers is a bad idea with regard to performance."

    But the meshes themselves are already very optimized. Using SimpleLOD on a non-optimized mesh will save you a lot of vertices with no or almost no visible changes. But when the mesh is already optimized the reduction in vertices is not as big.

    You are talking about a reduction to about 1/15th of the original on a mesh that is already optimized. That will not be possible without making the character look like he has been attacked by a group of zombies.

    Here's how SimpleLOD works:
    Imagine a cube mesh. 6 x 4 = 24 vertices. Super efficent, you cant make it any smaller.
    If you run this through SimpleLOD nothing will change, because the algorithm refuses the change the shape. Only maybe at very high compression values, will the algorithm consider to turn it into a malformed pyramid/cube thingy.

    SimpleLOD basically works by taking 2 adjacent triangles and merge them together into 1 triangle. There are always 2 options for this and for both options the impact on the shape and appearance of the model is computed. If the lowest of these 2 impact weights is less than the compression level, the triangles are merged.
    So at low compression values you will only see minor visual differences with the original model. At higher compression values these differences are bigger. In order to compress an already optimized model to 1/15th of its original size, you need really high compression levels, because the algorithm simply refuses to mess up the model too much.

    Here are some results of compressing Mixamo characters. Again: the original is already very efficient (apart from having 5 skinned meshes). MixamoCompression.jpg
     
  15. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Thanks so much for your detailed reply! Is there a way you can zoom in on that 1467 vertices model so I can take a better look at it? It actually doesn't look that bad because I only want to use the reduced model for a top-down game where the camera won't come very close.
     
  16. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Hi
    What might you be able to do for trees? Obviously billboarding distant ones is yet to come. Can you LOD Unity Trees? Any other ideas?
    Thanks!
     
  17. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    I have uploaded a few screenshots for you
    http://orbcreation.com/SimpleLOD/1365vertices_front.png
    http://orbcreation.com/SimpleLOD/1365vertices_left.png
    http://orbcreation.com/SimpleLOD/1365vertices_back.png
    http://orbcreation.com/SimpleLOD/1365vertices_top.png
    I'm not going to post them here, because for people just browsing through without actually reading, it would be bad advertising to put up a bunch of severely deformed models ;)
     
    Last edited: Jan 25, 2015
  18. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    I'm not an expert on terrains, but I believe that when you use the Unity terrain builder and the correct shaders, distant trees are billboarded for you.
    I never tried to make LOD levels of trees. Don't know if it will help much, because a tree is basically a bunch of tubes (trunk) and some quads (leafs). There is not much optimizing to do on a quad. Maybe you could save a few vertices on the trunks. I will test it for you this week and let you know.
     
  19. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Ah, sorry, my poorly considered quick question! A tree *not on Unity Terrain for use in mobile* (where terrain performs horribly).

    I'd thought to try combining the parts of the generated tree.

    Separately toying with potentially rigging as a Skinned Mesh Renderer by exporting -- for trying Dynamic Bone with them when close/on PC -- never found default shader wind very satisfying.) Again, something to degrade further away.

    Thanks for the reply and thoughts!
     
  20. thedreamer

    thedreamer

    Joined:
    May 13, 2013
    Posts:
    226
    I bought this asset for "Unity-chan!" model but Result is Disappointed.. Please test Unity-chan
    Unity-chan is the most popular asset Please bring some attention to Unity-chan
     
  21. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Thanks! I guess going from 15k to 1k is a bit of stretch, but 5k vertices doesn't look that bad right? I admit 67% reduction on an already optimized mesh is nothing to sneeze at
     
  22. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @eridani 5K is indeed a level where things things still look ok-ish
    @thedreamer I downloaded a Unity-chan model and tested a bit. The girl character I downloaded consisted of 19 skinned meshes, which could be merged into 1 mesh of about 12K vertices without any problems. This should already give you a significant improvement in performance.

    Compressing that single mesh is indeed difficult. The reason is that the girl wears several layers of clothes. When the vertices of the top layer are compressed, chances are that the clothes layer underneath it will pierce through in some areas.

    I also tested with only the skin and hair meshes, while leaving the clothes intact and that worked a lot better. But the reduction in vertices was not mind-blowing. This was an already highly optimized mesh and you just cant go removing vertices in an optimized mesh without compromising the visual result.

    What would work best is probably if I'd add a routine that would erase triangles that are completely covered, but that is a bit tricky. What if the top layer of clothing is (semi) transparent.

    Another option would be to add a routine that checks for any pierce-through areas and move the vertices outward a bit. But this will slow things down significantly.

    I need to think about this and experiment a little.
     
  23. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Couldn't we safely assume for the vast majority of cases that clothing will not be transparent? I think most people who use your asset will not be working with girly characters wearing fishnet and lacy see-through garments :)
     
  24. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Stating the probably obvious...
    Perhaps add an option to process for transparency. If selected, do a stochastic raycast using clothing surface normal checking the texture's colour at hit points to determine whether a triangle is potentially safe to remove.
     
  25. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    Yeah, there are indeed ways to deal with this, but I have to experiment with them and see how much processing time they take, whether or not I should add additional switch/on/off options, whether I can detect things automatically, etc.
    Right now I am working on a drag & drop texture atlas tool to include in the SimpleLOD package. When I have completed the work on that I will see what I can do for this multiple layer pierce through issue.
     
  26. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Texture atlasing sounds like a great feature add on.
     
  27. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Entirely fair - texture atlasing is probably greatest addition right now.

    Additionally, did you have any luck on the non-terrain tree test we discussed?

    Thanks
     
  28. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    I wouldn't assume that. Even macho undead like skeletons and zombies could have some transparencies (like worn and tattered clothing). It's a much better plan to give the user a checkbox to turn on / off different enhancements.
     
    eridani likes this.
  29. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @Arkade Sorry. I have created a tee with tree creator and instantiated a few standard trees. But all of them have just 1 mesh with 2 submeshes for the trunk and the leafs. There really is not much to merge. It's no use generating LOD levels either because there is hardly any reduction in nr of vertices/triangles. The trees are nothing but unoptimisable quads and a tiny little mesh for the trunk.
     
  30. Nifflas

    Nifflas

    Joined:
    Jun 13, 2013
    Posts:
    118
    Hey! I'm interested in this, but not because of the actual LOD features. All I'm looking for is a method I can call, both from editor scripts and at runtime, to decimate the Mesh I pass into it (which may or may not be attached to a component). Does SimpleLOD offer this?
     
  31. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    Hey Nifflas, Yup :)
    Some examples:

    Code (CSharp):
    1.  
    2. // looks up the Mesh in this GameObject in either SkinnedMeshRenderer or MeshFilter
    3. // and returns a new decimated mesh
    4. // parameters: float maxWeight, bool recalcNormals, float removeSmallParts
    5. Mesh decimatedMesh = someGameObject.GetSimplifiedMesh( 0.5f, false, 1f );
    6.  
    7. // or by calling an extension method of the Mesh class
    8. // parameters: float maxWeight, bool recalcNormals, float removeSmallParts
    9. Mesh decimatedMesh = someMesh.MakeLODMesh( 0.5f, false, 1f );
    10.  
    11. // or by calling The LODMaker function directly
    12. // parameters: Mesh originalMesh, float maxWeight, bool recalcNormals, float removeSmallParts
    13. Mesh decimatedMesh = LODMaker.MakeLODMesh( someMesh, 0.5f, false, 1f );
    14.  
    15. // or by running it in a background thread
    16. // I have added the MakeLODMeshInBackground function in the new version
    17. // that is currently in development. PM me if you need it now
    18. Mesh decimatedMesh = null;
    19. yield return StartCoroutine( someMesh.MakeLODMeshInBackground ( 0.5f, false, 1f, retval => decimatedMesh = retval) );
    Note that decimating a mesh with for example a high compression of 1.5 will give a different result than decimating it with for instance 0.75 and then decimating that result with 1.5. The reason is that the results improve if the process of decimating is repeated with gradually increasing compression level, but since that takes valuable time, the algorithm only processes the mesh in 1 go.

    When you make 2 or more LOD levels, this doesn't matter because the LOD levels already have increasing compressions. It also doesn't make any difference at lower compressions. Just when doing high compressions directly from the original mesh. Maybe I will add a parameter to specify the number of increments.
     
    Last edited: Jan 28, 2015
  32. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    quite impressive. do u have demo apk for mobile testing?
     
  33. Nifflas

    Nifflas

    Joined:
    Jun 13, 2013
    Posts:
    118
    Cool, that's good to know. Sounds like I'll be getting this today then. I'll attempt to strip it down to a minimal version that only has whatever is required for LODMaker.MakeLODMesh to work, since I'm actually only after a mesh decimator rather than an LOD system. Support for specify the number of increments would be cool, but not super necessary since it's so easy to implement. The information that it's a good thing to do is the most valuable part to me.

    Does MakeLODMesh modify the mesh you pass into it, or does it return a new mesh? With what want to use it for, it's required to modify the existing mesh so that references to it elsewhere are kept. If it does return a new mesh, is it easy to modify it so that it edits the existing one?
     
    Last edited: Jan 28, 2015
  34. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Alrighty I read through the thread and unless I missed it, it appears that while your system works well at run-time, I couldn't find if it combining skinned meshes at run-time works.

    I'd like to be able to have the various pieces of equipment the PC can equip (non-skinned) combine with his main body mesh (skinned) as he equips them. Subsequently can you 'separate' those same meshes if the item is unequipped?

    Thank you!

    -Steven
     
  35. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @imtrobin The web demo is at http://orbcreation.com/SimpleLOD/Demo.html There is no mobile demo I'm afraid.
    @Nifflas You are right in time, as I was rounding up the works on version 1.3. I have added an optional parameter for you. the function prototype is now:
    Code (CSharp):
    1. public static Mesh MakeLODMesh(Mesh originalMesh, float maxWeight, bool recalcNormals = true, float removeSmallParts = 1f, bool reuseOldMesh = false)
    Passing true for reuseOldMesh will change the old mesh rather than create a new one. Watch out with blendshapes, as they will be completely wrecked after this. There is no API to access them, so they will stick around in the original mesh.
     
  36. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    You can merge skinned and non-skinned meshes at runtime.
    Separating them will be harder though, because it makes an entirely new mesh that doesn't know anything about it's original parts.

    But if you merged into an empty parent object, all the orginal meshes are still around (unless you destroyed them explicitly). This is because upon merging, the child gameObjects are only made inactive. You can switch them back on with SetActive(true) and switch off the renderer on the parent.
     
  37. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    ...the only downside being that with every possible permutation of the character and his equipment would create another mesh. Arguably then you'd have to reactive the original and destroy the last merged mesh. Is that about the idea?
     
  38. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @SteveB What I mean is this:
    Code (CSharp):
    1. Character (empty gameObject)
    2.   character (skinned mesh renderer)
    3.   hip
    4.     spine
    5.       hand
    6.          Sword (MeshRenderer)      
    7.  
    8. After merging this becomes:
    9. Character (skinned mesh renderer)
    10.   character (inactive)
    11.   hip
    12.     spine
    13.       hand
    14.          Sword (inactive)
    15.  
    16. Then detach the sword (clear the skinned mesh renderer, reactivate the children, remove the sword):
    17. Character (empty gameObject)
    18.   character (skinned mesh renderer)
    19.   hip
    20.     spine
    21.       hand
    22.  
    23. Attach a Bow:
    24. Character (empty gameObject)
    25.   character (skinned mesh renderer)
    26.   hip
    27.     spine
    28.       hand
    29.          Bow (MeshRenderer)
    30.  
    31. After merging this becomes:
    32. Character (skinned mesh renderer)
    33.   character (inactive)
    34.   hip
    35.     spine
    36.       hand
    37.          Bow (inactive)
    38.  
     
  39. Nifflas

    Nifflas

    Joined:
    Jun 13, 2013
    Posts:
    118
    Wow, that is much appreciated! I've just had a quick look at SimpleLOD and its code, but everything looks great. I'll write a review once I've used it more. By the looks of it, it'll be very positive :)

    Edit: I've tested it out a bit more now and it's great. If I may suggest a feature, I'd like to have the option to preserve split edges (right now, a small hole can occur in a split edge). It's not crucial and my use of SimpleLOD is a bit unconventional, but it'd definitely be helpful!
     
    Last edited: Jan 28, 2015
  40. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    So, you're simply removing the Skinned Mesh Render component from that top most GO? Either way it sounds doable so I believe this is an insta-buy.

    I appreciate your time um, Orbcreation. (always awkward to call people by their company name hehe)

    Cheers man! (or woman!)

    -Steven
     
  41. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    Screenshot7.jpg Version 1.3 is now available in the asset store. It has the long awaited atlas editor with a drag & drop interface

    @SteveB Richard is the name, so I guess that makes me a man (or at least someone of the male gender).
     
  42. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Cool ... can't wait to test this out. This really is shaping up to be a must have asset. Great work!
     
  43. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Thank you Richard!

    Insta-bought!! :D

    -Steven
     
  44. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    Yes, the updates follow in rapid tempo. Sorry for that.
    But version 1.4 is out now. Mainly small bug fixes and uhmmm....., just one other thing..................... it has a 10 - 15 times faster decimation process!
    Thanks to some indexing of vertices and keeping track of triangles per vertex, the decimation of a big mesh will now only take a few seconds.
     
    Rajmahal, red2blue and hopeful like this.
  45. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @thedreamer Just to let you know you are not forgotten: I've been working on the problem where you can see lower layers of clothing or skin pierce through upper layers of clothing. For this I have added an option to remove hidden triangles, where hidden means: "there is another triangle to be found with roughly the same normals when you follow the normal of each corner of a triangle for a certain distance".

    The mesh decimator algorithm works on the mesh itself and has no knowledge of the used shader and texture, so it can not test for transparency. That's why this will become an option that can be switched on or off. This will be added in version 1.5

    Here's an example of Unity-chan. It's not perfect yet (when you look at the knees, there is a section gone) but this is still a working version. It'll get there.
    UnityChan.jpg
     
    red2blue and hopeful like this.
  46. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    hello, i made a quick test in a simple static mesh but i got this error "object reference not set to an instance...." not sure why this happen, any idea?
     
  47. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @toto2003 I can't really say what the cause might be with only this information. Are you using the latest version? Do other models give you the same error? Are you trying to merge meshes, bake atlases or generate LOD's?
     
  48. thedreamer

    thedreamer

    Joined:
    May 13, 2013
    Posts:
    226
    @Orbcreation amazing. You are the best! I am impressed with your great work
     
    Last edited: Feb 15, 2015
    hopeful likes this.
  49. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    oh never mind, not sure what was happening there, i reimport the asset and it work like a charms, something i would like to had if possible , is the possibility to really shrink the polycount to max, so it give me more control of performance visual i d like to achieve in term of performance. be able to go from 5000 to 50!!!! that would be yummie
    !!!
     
  50. red2blue

    red2blue

    Joined:
    Feb 26, 2013
    Posts:
    200
    Just wanted to buy your asset and now I see, that it is on sale! What kind of coincidence. I feel some kind of bad regarding the low price, but since I am right now short on budget I am very happy!

    Thanks a lot!

    P.S.
    For all the others:
    Here is the link to the Asset: https://www.assetstore.unity3d.com/en/#!/content/25366