Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

SimpleLOD user support thread

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

  1. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    That's right @red2blue. It's now on sale from Feb 17th - Feb 27th with 65% off. Don't feel bad. Enjoy.

    One little thing though. There is a version 1.4a pending approval by the Asset Store people. Unfortunately they haven't reviewed it yet. So if you buy 1.4 today, make sure you update it in a few days to 1.4a.

    Here's what changed in 1.4a with respect to 1.4:
    - Fixed an error where flat meshes (like a plane) were deformed
    - Normals of merged mesh were always calculated even if the original already had normals
    - Editor window now has a separate backup and revert button
    - Decimation algorithm was too careful on some meshes, causing holes when the compression level was increased to compensate

    After the sale there will a big new 1.5 release with very cool new options like:
    - selecting which meshes/submeshes to combine
    - removing submeshes
    - removing hidden triangles (by clothes)
     
  2. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    Question, before I buy, how well does this work on Mobile? Does this work with Unity Free.. I know LOD is a pro only thing for Unitys LOD. So this is why I'm asking. Anymore info, would be great before I buy.

    Thanks.
     
  3. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    If anybody is on the fence about buying this while it is on sale ... my advice is to BUY IT! :)

    Doesn't everybody working in 3D need a tool like this? So helpful.
     
  4. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    453
    I use it in my Mobile game VirusInfection2.
    It's a amazing product, LOD system+Atlas+Polygon reducers.
    Very easy to use and works on Unity Free.
    It's better than other $100 Assets.
     
  5. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    Thanks @menfou

    @recon0303 There are 2 ways to merge submeshes and create LOD meshes. One is with the editor tools and the other is by calling the functions at runtime.

    When you start running heavy tasks at runtime, your mobile app will notice of course.

    But assuming you will use the editor tools to create your meshes and other stuff beforehand, all you get from SimpleLOD is better performing game.
    - Rendering multiple meshes with multiple submeshes (materials) will generate a lot of drawcalls and that has a big impact on your game's performance. With SimpleLOD you can merge those meshes and thus reduce the nr of drawcalls.
    - When you use it on skinned meshes the performance gain is even bigger, because instead of for instance computing the positions of the vertices in the arms and legs for the 3 skinned meshes of body, shirt and trousers, the game engine will only have to compute them for 1combined mesh.
    - It has a drag & drop window where you can combine your textures into atlases, again saving drawcalls
    - You can simplify meshes and make a small compromise in appearance in favor of a smaller and faster mesh for your mobile game
    - You can generate LOD meshes that will greatly reduce the nr of triangles to render
    - It has an LOD Switcher component that uses very little resources and does not run every frame.

    The only downside I can think of for mobile is that the download size increases a bit when you add 1 or more LOD meshes to the build.
     
    red2blue likes this.
  6. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    Thanks for the fast reply. I will pick it up now since it works with mobile.
     
  7. S-P-A-C-E-D

    S-P-A-C-E-D

    Joined:
    Jan 11, 2014
    Posts:
    45
    I am having a problem with the LOD switcher. No matter how far away I am from the character, it stays the same LOD level.
     
  8. rpgw

    rpgw

    Joined:
    Jul 3, 2012
    Posts:
    47
    I am having problems getting this to work at all. Concerned I am missing something obvious. :)
    Unity 4.6f1
    OSX

    Everytime I try to LOD something using 3a and 3b I get this standard error within the dialogue box.
    The LODSwitcher is added but no actual LOD meshes are generated and set to the fields on the component.

     
  9. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @NewTimeBurnout Do you have the LOD distances set up? Are you testing this in the Editor or when you press the Play button. When you are not running the game, there is no way for the LODSwitcher to determine the camera distance. If it still doesn't work, can you send me a screenshot of your LODSwitcher in the Editor?

    @rpgw When you look in your Console, do you see the results of the decimation? A reason to see that message that I am aware of is when the total nr of vertices after decimation ends up 0. (fixed in new version). Can you send me a model or a screenshot in a PM or email?

    Actually, this goes for both of you. If you send me an email with the model you are trying to decimate or a zip of your project, I can probably help you a lot better. richard (thingy) orbcreation (dot) com
     
  10. S-P-A-C-E-D

    S-P-A-C-E-D

    Joined:
    Jan 11, 2014
    Posts:
    45
    @Orbcreation I followed steps 1, 2, and 3a. I am play testing it and the lod model never changes. If I leave the lod screen sizes alone the model usually stays on lod 3 and never changes regardless of how close I am. If the camera matters I am using the third person camera that comes with the Beta Sample assets and it works with a script and pivot point, with a camera as a child...
     
  11. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    Your editor should look something like this when you run the game. If you mail me a few screenshots I might be able to help you better, for it is really hard for me to imagine what could be the cause of your problem this way.
     

    Attached Files:

  12. S-P-A-C-E-D

    S-P-A-C-E-D

    Joined:
    Jan 11, 2014
    Posts:
    45
    @Orbcreation I got it working, it seems that it might have been because I had it as a child of an empty gameObject. Taking it out alleviated the problem.
     
  13. Deleted User

    Deleted User

    Guest

    Thanks for the very useful asset. Makes LOD and texture atlas creation very simple.

    I am using !RFPS first person camera and have this same issue. The main camera is also parented to an empty gameObject, but in my case, I cannot get rid of this or else I break !RFPS functionality. Looks like I'll be busting into a SimpleLOD's code and maintaining my own private fork in order to continue using SimpleLOD. SmartLOD, which I also own, unfortunately conflicts with SimpleLOD or else I'd try using SmartLOD's component with SimpleLOD's generated meshes. Any guidance on resolving this issue is definitely appreciated. Thanks again for the hard work, and congratulations on the Unity sale!
     
  14. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    when i use simple lod on a model i got this:


    how can i avoid to cause holes?
     
  15. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @Black Lodge Games I don't understand how this happens. I tried making the main camera a child of an empty gameobject and it all just works like it should. I looked in the Asset Store but RFPS first person camera does not exist.

    The LOD Switches uses 2 functions to determine which LOD level to use:
    Upon startup: Camera.main.ScreenToWorldPoint()
    Every x frames: Camera.main.transform.position
    I don't see how those could give different results when you parent your camera.

    Unless.... Do you have a different camera or different camera settings (like field of view) upon start up? In that case, call LODSwitcher.ComputeDimensions() once the camera settings are ok.

    Can you perhaps mail me a stripped version of your project?

    @Damien Delmarle Do you have the remove small parts slider set to 0?

    It may also have something to do with the way the mesh is set up. Sometimes you get better results by decimating the various parts separately and then merge them together later on. But could you mail me this model? That way I can have a look and see if there is anything I can do to improve it.
     
  16. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    For if it is useful to someone:

    The problem null reference exception happens when reach:
    Vector3 p0 = Camera.main.ScreenToWorldPoint(new Vector3((Screen.width - 100f) / 2f, 0, 1f));

    The reason is simple, the building is in a scene that is a SECTR Stream Chunk and there is not a Camera in that scene.

    Problem resolved. Thanks Richad!
    ---------------------------------------------------
    I am having the same problems that @rpgw. Version 1.3 was good, but with 1.4 and 1.4a I get "Object reference not set to an instance of an object"
    Unity 4.5.4f1
    Windows 8

    Options 3a), 3b) and 3c)

    I get in console Log:

    compression:0.4, vertices:35153 -> 34585, triangles:22948 -> 22358

    started 2015/02/19 03:00:20.461
    ended 2015/02/19 03:00:22.234

    UnityEngine.Debug:Log(Object)
    LODMaker:MakeLODMesh(Mesh, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Boolean, Boolean) (at Assets/SimpleLOD/LODMaker.cs:156)
    LODMaker:MakeLODMesh(Mesh, Single, Boolean, Single, Boolean) (at Assets/SimpleLOD/LODMaker.cs:30)
    OrbCreationExtensions.MeshExtensions:MakeLODMesh(Mesh, Single, Boolean, Single) (at Assets/SimpleLOD/Extensions/MeshExtensions.cs:114)
    OrbCreationExtensions.MeshExtensions:MakeLODMeshes(Mesh, Single[], Boolean, Single) (at Assets/SimpleLOD/Extensions/MeshExtensions.cs:187)
    OrbCreationExtensions.GameObjectExtensions:SetUpLODLevelsWithLODSwitcher(GameObject, Single[], Single[], Boolean, Single) (at Assets/SimpleLOD/Extensions/GameObjectExtensions.cs:620)
    SimpleLOD_EditorPopup:CreateLODSwitcherWithMeshes() (at Assets/SimpleLOD/Editor/SimpleLOD_Editor.cs:259)
    SimpleLOD_EditorPopup:OnGUI() (at Assets/SimpleLOD/Editor/SimpleLOD_Editor.cs:144)
    UnityEditor.DockArea:OnGUI()


    compression:0.6, vertices:34585 -> 33965, triangles:22358 -> 22221

    started 2015/02/19 03:00:22.266
    ended 2015/02/19 03:00:24.213

    UnityEngine.Debug:Log(Object)
    LODMaker:MakeLODMesh(Mesh, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Boolean, Boolean) (at Assets/SimpleLOD/LODMaker.cs:156)
    LODMaker:MakeLODMesh(Mesh, Single, Boolean, Single, Boolean) (at Assets/SimpleLOD/LODMaker.cs:30)
    OrbCreationExtensions.MeshExtensions:MakeLODMesh(Mesh, Single, Boolean, Single) (at Assets/SimpleLOD/Extensions/MeshExtensions.cs:114)
    OrbCreationExtensions.MeshExtensions:MakeLODMeshes(Mesh, Single[], Boolean, Single) (at Assets/SimpleLOD/Extensions/MeshExtensions.cs:187)
    OrbCreationExtensions.GameObjectExtensions:SetUpLODLevelsWithLODSwitcher(GameObject, Single[], Single[], Boolean, Single) (at Assets/SimpleLOD/Extensions/GameObjectExtensions.cs:620)
    SimpleLOD_EditorPopup:CreateLODSwitcherWithMeshes() (at Assets/SimpleLOD/Editor/SimpleLOD_Editor.cs:259)
    SimpleLOD_EditorPopup:OnGUI() (at Assets/SimpleLOD/Editor/SimpleLOD_Editor.cs:144)
    UnityEditor.DockArea:OnGUI()


    compression:0.8, vertices:33965 -> 33739, triangles:22221 -> 21844

    started 2015/02/19 03:00:24.243
    ended 2015/02/19 03:00:26.128
    UnityEngine.Debug:Log(Object)
    LODMaker:MakeLODMesh(Mesh, Single, Single, Single, Single, Single, Single, Single, Single, Single, Single, Boolean, Boolean) (at Assets/SimpleLOD/LODMaker.cs:156)
    LODMaker:MakeLODMesh(Mesh, Single, Boolean, Single, Boolean) (at Assets/SimpleLOD/LODMaker.cs:30)
    OrbCreationExtensions.MeshExtensions:MakeLODMesh(Mesh, Single, Boolean, Single) (at Assets/SimpleLOD/Extensions/MeshExtensions.cs:114)
    OrbCreationExtensions.MeshExtensions:MakeLODMeshes(Mesh, Single[], Boolean, Single) (at Assets/SimpleLOD/Extensions/MeshExtensions.cs:187)
    OrbCreationExtensions.GameObjectExtensions:SetUpLODLevelsWithLODSwitcher(GameObject, Single[], Single[], Boolean, Single) (at Assets/SimpleLOD/Extensions/GameObjectExtensions.cs:620)
    SimpleLOD_EditorPopup:CreateLODSwitcherWithMeshes() (at Assets/SimpleLOD/Editor/SimpleLOD_Editor.cs:259)
    SimpleLOD_EditorPopup:OnGUI() (at Assets/SimpleLOD/Editor/SimpleLOD_Editor.cs:144)
    UnityEditor.DockArea:OnGUI()

    Create LOD levels: Object reference not set to an instance of an object

    UnityEngine.Debug:Log(Object)
    SimpleLOD_EditorPopup:OnGUI() (at Assets/SimpleLOD/Editor/SimpleLOD_Editor.cs:145)
    UnityEditor.DockArea:OnGUI()

    Folder LODMeshes is EMPTY!!!!
     
    Last edited: Feb 21, 2015
  17. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    I also have HOLES applying simplify mesh with factor 1 and 1 passes to buildings.

    1.png Before use simpleLOD
    2.png After using simpleLOD. HOLES in Windows

    If I apply factor 2, second floor dissapears!!
     

    Attached Files:

    • 1.png
      1.png
      File size:
      167.6 KB
      Views:
      961
    • 2.png
      2.png
      File size:
      168 KB
      Views:
      955
  18. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
  19. Deleted User

    Deleted User

    Guest

    Thanks for the reply; I definitely appreciate the help! It's fantastic software by the way, kudos on a job well done.

    That's weird about the URL to RFPS not working when you click the link, because if you just paste it directly into the browser it works fine:
    https://www.assetstore.unity3d.com/en/#!/content/7739

    So, in order to send you a scaled down test project, I figured I'd just start a new project, import only SimpleLOD and RFPS, and then recreate the issue. However, inside of the test project, SimpleLOD worked as intended, suggesting that my issue is not with RFPS, but with an another aspect of my game's main loop. I'm going to conduct some more tests to see if I can come back with better information or a solution before bothering you again. Thanks again for the help!
     
  20. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    Deleted User likes this.
  21. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,291
    Hi,

    Is there a way to run it in Unity 4.3.4 ? I get errors when inserting to my project and i suppose it is because i use a lower verison.

    Are crucial files dependent on Unity 4.5.0 or i can get away with deleting a few and using the core in 4.3.4 ?

    I get some errors about uv3-4 etc

    Thanks
     
  22. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    mesh.uv3 and mesh.uv4 are introduced in version 5. Version 4.5 and 4.6 are captured with #ifdef UNITY_4_5.
    When you search the code for #ifdef UNITY_4_5 and either replace this with #ifdef UNITY_4_3 or add and #elif UNITY_4_3 things should be fine.
     
  23. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,291
    Thanks, i will check it asap :)
     
  24. Crazydadz

    Crazydadz

    Joined:
    Mar 29, 2012
    Posts:
    50
    Hi @Orbcreation,

    First of all, just creating LOD model on the fly certainly worth the price, but for our current project, we won't use that feature. That is why we have some questions :).

    We want to know if it is possible to merge textures without combining the mesh at runtime to get only one material for all selected meshes but keep selected meshes separated? We have a bunch of collectable items, but each level doesn't need all of them. So between each level we want to merge all used items into one material, but keep items separated. We could script it, but for 10$, why should we if you already did a great job :p.

    Does your tool works in unity 5 pro?

    Does your lod system has advantages compared to the built-in one in pro version of unity? (we know that your lod system is really nice for Unity Free user :))

    Thanks for your time!
    David
     
    Last edited: Feb 23, 2015
  25. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    Sorry, you can only create atlases and merge materials within one gameobject.
    It does work on Unity 5
    The LOD Switcher component's main advantage is that it is very lightweight and can deal with either separate gameobjects per LOD level (like LODGroup does) or with an array of meshes to switch between.
     
    Crazydadz likes this.
  26. Crazydadz

    Crazydadz

    Joined:
    Mar 29, 2012
    Posts:
    50
    Thanks you for the fast response!

    Edit: Just bought it to help :) maybe we will use it on another project :)
     
    Last edited: Feb 24, 2015
  27. Landci

    Landci

    Joined:
    Aug 28, 2012
    Posts:
    33
    Hello i have troubles with the normal map.
    i am using a mixamo model.
    First thing i did was change the compression of the normal map to true color or to 16 bit because otherwise it throws an error exception and the normal map shows just as plain blue.
    what is strange is that it then shows as pink color. any ideas?


    this is what it looks like in game:
     
  28. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    You need to import your normal maps as normal maps in Unity. That's the only way to make them work. I have a package called "Texture2D Extensions" that can convert normal maps from the blue-ish textures to Unity's internal format and back again, but that is not what you need here.

    It looks like you have the normal maps imported in Unity the wrong way. They should appear as grey scale images in SimpleLOD when they are not yet made readable and as blue images when they are made readable.
     
  29. Landci

    Landci

    Joined:
    Aug 28, 2012
    Posts:
    33
    Well I imported them as a normal map take a look :


    i tried format 16 bit and truecolor, both not working.
     
  30. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    And does the original, non SimpleLOD version of your model have functioning normals maps? If so, maybe you should mail me your model including the textures/normal maps. If not, I think you should try to fix that first.
     
  31. Landci

    Landci

    Joined:
    Aug 28, 2012
    Posts:
    33
    ok i just made a new project, it is working there.
    1 Draw call instead of 5! awesome!
    Seems to be something wrong in my other project, thanks for the fast reply anyways!
     
  32. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    ok, glad it works for you.
     
  33. SpectralEdge

    SpectralEdge

    Joined:
    Sep 17, 2012
    Posts:
    33
    With the latest update, calling transform.CombineMeshes() causes the game to hang and never continue. It was working before updating, any ideas what may have changed?

    Sorry for the lack of detail, but literally nothing else has changed in the project and the error reports are giving me nothing.
     
  34. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    I just tested combining a few meshes by script and it works fine. But what might cause the problem is that previously, the same GameObject would always remain in place and only it's contents would be changed.

    If the top level GameObject is just an empty placeholder without a MeshRenderer, a new MeshRenderer and MeshFilter is added to it and the children are disabled. That remains unchanged in 1.5

    But previously, if the top level GameObject already had a MeshRenderer, the mesh would be replace with the new combined mesh. I found that this would alter things too drastically and it made it difficult to return to the original.

    So now, in 1.5, the original gameObject is disabled (only when there is a renderer component in it) and a new
    GameObject is created. Could it be that your code is trying to use the now disabled gameObject, causing it to hang at some point?

    If you want it back the way it worked in 1.4 you could try to remove line 321 of GameObjectExtensions.cs where it says:
    Code (csharp):
    1.      if(aGO.GetComponent<SkinnedMeshRenderer>() != null || aGO.GetComponent<MeshRenderer>() != null) makeNewGameObject = true;
    In the meantime, I will add an optional parameter to the function in version 1.5a that will let you choose whether you want to keep the old GameObject or not. And maybe also a function that returns the new GameObject
     
  35. Deleted User

    Deleted User

    Guest

    This is my 2nd attempt to use this asset. This time in a fresh Unity 5 project. All meshes give this error when I run the LOD tool on them to generate LOD meshes "object reference not set to an instance." Reimporting SimpleLOD did not solve my issue. All mesh functions of SimpleLOD either produce the identical starting model or a blank mesh with a blank name that doesn't actually exist. Any insight into this would excellent. Thank you.

    EDIT:
    System.NullReferenceException: Object reference not set to an instance of an object
    at LODSwitcher.ComputeDimensions () [0x000c7] in D:\Game Projects\XXX\Assets\SimpleLOD\LODSwitcher.cs:62
    at OrbCreationExtensions.GameObjectExtensions.SetUpLODLevelsWithLODSwitcher (UnityEngine.GameObject go, System.Single[] lodScreenSizes, System.Single[] maxWeights, Boolean recalcNormals, Single removeSmallParts, Single protectNormals, Single protectUvs, Single protectSubMeshesAndSharpEdges, Single smallTrianglesFirst, Int32 nrOfSteps) [0x00129] in D:\Game Projects\XXX\Assets\SimpleLOD\Extensions\GameObjectExtensions.cs:679
    at SimpleLOD_EditorPopup.CreateLODSwitcherWithMeshes (UnityEngine.GameObject aGo) [0x0005c] in D:\Game Projects\XXX\Assets\SimpleLOD\Editor\SimpleLOD_Editor.cs:540
    UnityEngine.Debug:LogError(Object)
    SimpleLOD_EditorPopup:CreateLODSwitcherWithMeshes(GameObject) (at Assets/SimpleLOD/Editor/SimpleLOD_Editor.cs:542)
    SimpleLOD_EditorPopup:OnGUI() (at Assets/SimpleLOD/Editor/SimpleLOD_Editor.cs:411)
    UnityEditor.DockArea:OnGUI()
     
  36. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    The log suggests that the error is triggered in the function LODSwitcher.ComputeDimensions(). What it does there is compute the size of an object in the screenspace as defined by the camera. I think the problem is that you don't have a camera in your scene.

    You will find the function on line 49 of LODSwitcher.cs (assuming you have version 1.5) If you want, you can change it like this:
    Code (CSharp):
    1.     public void ComputeDimensions() {
    2.         Bounds bounds = gameObject.GetWorldBounds();
    3.         centerOffset = bounds.center - transform.position;
    4.         objectSize = bounds.size.magnitude;
    5.         if(skinnedMeshRenderer == null && meshFilter == null) GetMeshFilter();
    6.         if(skinnedMeshRenderer != null) {
    7.             bounds = skinnedMeshRenderer.localBounds;
    8.             objectSize = bounds.size.magnitude;
    9.             centerOffset = bounds.center;
    10.             frameInterval = 1;
    11.         }
    12.         Camera cam = customCamera;
    13.         if(cam == null) cam = Camera.main;
    14.  
    15.         // Insert this line here
    16.         if(cam == null) return;
    17.  
    18.         Vector3 p0 = cam.ScreenToWorldPoint(new Vector3((Screen.width - 100f) / 2f, 0, 1f));
    19.         Vector3 p1 = cam.ScreenToWorldPoint(new Vector3((Screen.width + 100f) / 2f, 0, 1f));
    20.         pixelsPerMeter = 1f / (Vector3.Distance(p0, p1) / 100f);
    21.     }
    22.  
    Beware that you will have to call this function again manually after the Camera is set. Otherwise, the system will not switch between LOD levels.
     
    Deleted User likes this.
  37. Deleted User

    Deleted User

    Guest

    Oh geeze, now I feel bad for posting before doing basic investigating. Thanks man, you rock!
     
  38. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    No! It's great that you posted here. This way I was pointed to a potential problem that I normally would never discover and can prevent it from happening with others in the next update by adding that simple line of code.
     
    Rajmahal, red2blue and Deleted User like this.
  39. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    224
    I bought this a little earlier, mainly because I am fooling around with batching trees manually and I have unsuccessfully tried several of the older free scripts that were available (they all failed to combine the mesh topology correctly).

    I tried batching a small chunk of trees (the conifers from the unity terrain assets), and it combines the meshes correctly, but they appear washed out after the batching (with the CombineMeshes extension method) - in Deferred/Linear. I'm not sure if I am doing something wrong or if these trees will not batch correctly because of their shaders, etc.

    Any insight?
     
  40. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    Hi Dirty Hippie :) I tried the Conifers in my test project and get an object that already has 3 LOD levels set up. When I take out LOD 0 and place a few of them in my scene, and then merge them together I don't see anything strange.
    Can it be that you are combining meshes of different LOD levels?
     

    Attached Files:

  41. SpectralEdge

    SpectralEdge

    Joined:
    Sep 17, 2012
    Posts:
    33
    I figured out the issue I was having, it was another piece of code doing it, not yours.

    I am wondering, if you could write the mesh combine to use co-routines so if a large mesh is combined when the game is running it does not hickup? Right now I combine when the scene loads, but it would be much more useful if I could combine while the game is running.
     
  42. netvortex_dc

    netvortex_dc

    Joined:
    Jan 13, 2014
    Posts:
    126
    @Orbcreation, are you aware of any flickering issues on Unity5 when using the atlas window ? Inside the window it's flickering like crazy when moving the mouse over the elements.

    Also, 1 bug report : When choosing "Create LoD Levels and create childobjects" you are not looking for the original type of the renderer, instead of a skinned meshrender a normal mesh renderer was added.
     
    Last edited: Mar 18, 2015
  43. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    224
    Oops. Well that is good to know it works for speed tree :). I meant the ScotsPines assets (i.e. legacy trees) from the "Free Terrain Assets".
     
  44. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    Pro-tip: Don't tag users unless you spell out their full username ;)
     
  45. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @SpectralEdge The problem with threads is that you can not use any Unity objects in them. In order to combine meshes in the background, you will need to read the old meshes and then create a new one in that background thread. And that can't be done, because Unity classes are not thread safe.
    The decimation functions that can run in the background first read the mesh info in arrays, then processes them and when the thread is finished a new mesh is created in the main thread
    We could do something similar for combining meshes, but I doubt if it would make much difference. The part that could technically run in the background is not so big.

    @netvortex_dc Thanks for reporting the flickering issues and the SkinnedMeshRenderer bug. It turns out that in Unity5 it is not a good idea to reuse a Texture2D in your GUI. I fixed both and have submitted version 1.5a to the Unity Asset Store people.

    @DirtyHippy The legacy shader does some weird things with directional light. When you merge multiple trees together, the bounds and normals of the mesh change. I guess this is what causes your problem.
    If I were you I'd use the shaders that come with speed tree or a different tree shader
     
    Last edited: Mar 18, 2015
  46. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Code (csharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. SimpleLOD_EditorPopup.GameObjectToBackup (UnityEngine.GameObject aGO) (at Assets/SimpleLOD/Editor/SimpleLOD_Editor.cs:708)
    4. SimpleLOD_EditorPopup.GetBackup (UnityEngine.GameObject aGO) (at Assets/SimpleLOD/Editor/SimpleLOD_Editor.cs:720)
    5. SimpleLOD_EditorPopup.Update () (at Assets/SimpleLOD/Editor/SimpleLOD_Editor.cs:168)
    6. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    7. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    8. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    9. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    10. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:244)
    11. UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:237)
    12. UnityEditor.HostView.SendUpdate () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:302)
    13. UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorApplication.gen.cs:268)
    14.  
    Trying to do an undo.

    Still not managing an undo :(

    Why not increase usability and flip this problem on its head.

    When a user chooses to create an LOD set (or sequence of sets) create each of the LOD meshes and then store the Editors Scene.Camera's location

    Spawn the first LOD mesh at a far away place like -2000, -2000, -2000 , snap the camera perpendicular above it and zoom out to accommodate the full bounds (screen space calculations are already in there somewhere)

    Make a DO YOU ACCEPT [SKIP] [YES] [CANCEL] appear in your LOD GUI.
    if they accept, hide that mesh, place the next LOD mesh in the same spot
    (and popup the details in the console or LOD GUI which mesh you are viewing)
    repeat the message process until all the LOD's for all the selected gameObjects are YES'd

    (If they choose SKIP we assume they want them all and just skip to the next step straight away, if they choose CANCEL the process can just stop and the backup(S) could be deleted)

    Only then - at the last YES - bother to create all the switchers, children or LOD groups.
    Make a manifest of these changes (just the refs to the stuff you added maybe) linked to a timestamped gameObject in the BACKUP structure (however you want to do that)

    Restore the stored Editors Scene.Camera's location.

    Before then (the current workflow) the user has no idea if he wants the results.
    After this point is passed in the current workflow you (as in you the author in his undo) have all the mess to clear up if you don't get this ratification.

    I don't know what you think. but that seems like a more sensible undo workflow.

    Just have one MASTER COPY of the stuff you adjusted - in the previous state - an exact copy - just DISABLED in a parent Game Object called CONVERSION+timestamp"

    that makes undo pretty simple. if they choose Undo EVERYTHING UNDO's.
    Assuming you bothered to make that manifest linked to the timestamp you could just delete everything in that list and restore the other thing in the history.

    So, In precis, you get a preview of the outputs before you OKAY all the changes and your UNDO workflow is a lot less heartache.

    Those are my thoughts. Rejiggling the current undo to match all use-cases since post editing is possible (I didn't above - in my error - but it is) is possibly a tough job whereas ripping a list of GameObjects by refs - regardless of their content - and un-parenting a hidden GameObjects contents is not.
     
    Last edited: Mar 20, 2015
    ZenMicro likes this.
  47. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @twobob Thanks for your extensive description and thoughts. The backup/undo process with only 1 backup copy is certainly not optimal. I will think of a new way to deal with this and may use your suggestions or part of them.

    About the error: are you using SimpleLOD 1.5 or 1.5a? It looks like you are trying to revert back to a saved copy after you created LOD levels using the LOGGroup option. This used to give a similar error in 1.4 and was fixed in 1.5 (or at least as far as I know). I just tested this again with 1.5a and couldn't recreate the error. Could you maybe tell me some more about when and how the error occurs? Maybe a screenshot of the objects in the hierarchy that are involved?
     
  48. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Sure man,

    I most certainly used the one from the store to that project - but maybe I didn't check everything was removed from the old install. (maybe, total guess)

    Will double double checked today mate.

    I hope it came across as positive thoughts, it was late, always hard to sound upbeat in the early hours.

    Much obliged for your time
     
  49. netvortex_dc

    netvortex_dc

    Joined:
    Jan 13, 2014
    Posts:
    126
    Hi Orb,
    been following your tutorial for Daz and i encountered another bug - this time a bit bigger, Unity 5 crashs every time i'll try to press "Merge child meshes" if i apply it on a Skinned Mesh Render that contains BlendShapes. When disabling Blendshapes in the .FBX it runs through just fine. Is there any chance you can fix this ? Thanks!
     
  50. Orbcreation

    Orbcreation

    Joined:
    May 4, 2010
    Posts:
    231
    @netvortex_dc I will have a look, but I fear the worst.

    The Unity API really sucks when it comes to blendshapes. You simply can't access them and can only hope for the best. So what I do now is make a full copy of the first mesh it encounters and use that as the basis for the new merged mesh. This way the blendshapes will remain intact.

    If I am to fix this bug i will probably have to start with a clean mesh and then merge everything in there. All the existing blendshapes will be lost then.
     
    Last edited: Mar 23, 2015