Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

UniLOD BETA: Level-of-detail and streaming support [UPDATE]

Discussion in 'Made With Unity' started by BearishSun, Mar 3, 2010.

  1. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175


    Features
    • Automatic mesh simplification (Windows + Unity Pro only)
      [list:5d7e76b1a6]
    • Generate meshes with reduced polygon count automatically
    [*]Level-of-detail editor
    • Easily create LOD prefabs that change quality levels or that disappear at a certain distance
    • Build your LOD scene
      [list:5d7e76b1a6]
    • Easily replace existing prefabs with LOD prefabs for converting your scene to a LOD-managed one
    • Group objects together into a single mesh and texture to reduce draw calls
    • Save scene as standard assets or asset bundles
    [/list:u:5d7e76b1a6][*]Scene manager
    • Streaming support
      [list:5d7e76b1a6]
    • Stream your scene as the player moves through the world
    • Resources are automatically loaded/unloaded
    • Stream from resource folder, or asset bundles
    • Minimal performance impact with resource buffering
    • Adjustable for your needs, speed or memory
    [*]Takes care of switching quality levels as the player moves though the world
    • Fully optimized, uses minimal resources
    [/list:u:5d7e76b1a6][*]Resource manager
    • Standardized loading for both asset bundles and normal resources
    • Keeps reference counts on your resources and frees them automatically
    [*]Fully integrated into Unity using UnityEditor API
    • No coding required
    [/list:u:5d7e76b1a6]

    Editors



    + few others

    In action
    Lots of objects demo (Old video, new one coming in a few days, it does a much better job now)
    Streaming demo
    In-game demo

    All the demo videos except the first one are running on Running on Vista x64, E6600 at 2.4Ghz, 295GTX and 2GB RAM. (The first video is running on 8800GTX, rest is the same).

    Video tutorials
    UniLOD Tutorial 1 - Installation
    UniLOD Tutorial 2 - Mesh simplification
    UniLOD Tutorial 3 - LOD prefab creation
    UniLOD Tutorial 4 - LOD scene editing
    UniLOD Tutorial 5 - Scene loading

    Download
    Win + Unity Pro
    Mac + Unity Pro
    Mac/Win + Unity Indie

    Other notes
    This is the first released version of UniLOD, I hope you can report all found bugs to me. Personally I have never even tested the Mac version but it is available here anyway. It is very doubtful it will work at this time, but I do plan on fixing it in the future (Feel free to give it a shot, it might just work). Testers have also reported errors with mesh simplification in the Win Pro version, most likely related to .dll dependencies, and although I'm quite sure I removed all of them it still won't work for some people, so I hope to hear from you on this issue. Also make sure you have newest DirectX and VC++ runtimes if installing the Win Pro version.

    Cheers!

    UPDATE

    UniLOD is now open-source and free for personal and commerical use. You may download the source from here.
     
  2. Amon

    Amon

    Joined:
    Oct 18, 2009
    Posts:
    1,114
    This looks very interestng. I'll test it in a bit and report back. :)
     
  3. giyomu

    giyomu

    Joined:
    Oct 6, 2008
    Posts:
    1,090
    hey thanks , that look pretty cool

    will that package stay free at all ?
     
  4. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,002
    I could have sworn you were Higgy for a second.

    On topic, this looks great! I will have to test this out this weekend.
     
  5. Yorick2

    Yorick2

    Joined:
    Jan 24, 2009
    Posts:
    297
    If you had not said that I would have still thought he was HiggyB.

    ontopic: I'll try out the LOD. I suspect the small hiccups might be a problem for my racegame though... I'll report back!
     
  6. the_gnoblin

    the_gnoblin

    Joined:
    Jan 10, 2009
    Posts:
    722
    I had the same thought too :)
     
  7. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    It's likely gonna stay free, but I haven't decided yet.

    With LOD alone there shouldn't be hiccups, I did a lot of experimenting to find the best way to switch quality levels with no framerate impact. If there is some, report it as a bug.

    There will be some hiccups if streaming is enabled(as shown in the videos). Although in the demos all houses use 2k diffuse, and 1k normal maps. With a bit smaller textures for streamed objects, and tweaking the streaming settings a little I'm sure you could avoid even those hiccups.



    Has anyone got any experiences? Does it work at all? ;) How about Mac version?
     
  8. Zylex

    Zylex

    Joined:
    Nov 25, 2008
    Posts:
    196
    This is great! I just installed it and it seems to work perfectly. I'm going to try implementing it in a game soon.

    Anyhow thanks for all your work, really appreciated!
     
  9. Arges

    Arges

    Joined:
    Oct 5, 2008
    Posts:
    359
    Mac user here - installs and builds, but as it doesn't have a mesh simplifier, I can't quickly test the other functionality.
     
  10. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    This is seriously awesome work. Thanks so much for releasing this.
     
  11. amirebrahimi

    amirebrahimi

    Joined:
    Jan 27, 2008
    Posts:
    171
    The Mac download installs and runs, however, I notice that the mesh simplification is not included. Are you using D3DX to accomplish this?
     
  12. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    Yeah it's just D3DX. I started implementing my own tool but after about three weeks of work realized that the algorithm I chose to implement just simply didn't do a very good job with uv coordinates. I decided to stop right there as I was on a deadline for the entire UniLOD project, so I used D3DX.
     
  13. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    <off-topic>

    :|

    Time to change my avatar. No offense directly Amon but I like my avatar to be mine, as in unique and only me. I'll have something new up soon enough. :)

    </off-topic>

    On topic, I'll give this all a look now that I'm here in the thread, but my first reaction was (clearly) about Amon's avatar. :)
     
  14. Amon

    Amon

    Joined:
    Oct 18, 2009
    Posts:
    1,114
    I didn't mean any offence by it. It was just a friendly joke. I'll switch it back to that muppet krow Mascot of mine.

    Soz. :)
     
  15. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    This is some really fantastic stuff. I haven't tried it in a practical situation and won't for some time, but the general structure you have here is great!
     
  16. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    Thanks guys :)

    I'm kinda surprised no one is reporting any bugs however, but if it all works, even better.

    Also, the UniLOD library contains a few maybe useful functions: CombineSkinned for combining skinned meshes, but it also lets you provide a skeleton which all of the meshes will use. RemoveBones, AddBones, ReplaceSkeleton and CombineSkeleton for combining different skeletons. Those come in handy if for example, you'd like to combine your character and its armor, but the armor uses some additional bones(for cloth animation or such).

    Even if you don't use LOD or streaming capabilities, you can still get advantage of the AssetBundleManager, which basically provides the same features of Unitys Resource.Load, only for asset bundles. (Unloads automatically, already loaded bundles never get loaded twice, etc.)
     
  17. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,002
    I can't really use this in the project I'm working with now, but hopefully I can dig into it for my next project. It seems like you put a lot of work into this, so I will definitely try to put it to use. :D
     
  18. lazalong

    lazalong

    Joined:
    Oct 13, 2009
    Posts:
    139
    Excellent.

    - Can you use it without an Asset Server?
    - Do you plan to expose the api so we can connect to our own server (custom server, photon, ...)?


    My only concern.
    It would be painful if middle of a project we couldn't afford it :/
    IMO a license clarification is necessary before studios use your library seriously.
     
  19. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    I reckon the SceneManager is something that's extensible, and it could be refactored in a way that makes UniLOD a module for it (and people could easily make others like a lightmapping thing, etc.). Then leave SceneManager free and possibly open source, and sell UniLOD at whatever you think is feasible.
     
  20. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    - It's in no way connected to the asset server so, yes you can.
    - All relevant functions are exposed. I uploaded the documentation too: http://www.mediafire.com/?2miynwm24nd. Not sure what you mean by connecting to the server.

    If someone wants to use this in a project, but is worried about licence problems, please contact me. I'll decide on the license soon, if I don't get any bug reports, so I can end the beta. It's very likely to be free however.

    Actually scene manager just loads the scene from an xml file, calls different resource managers based on scene type for loading/unloading, and changes LOD. It works only specifically with scenes generated by the editors. I doubt it would be useful to anyone on its own.
     
  21. theinfomercial

    theinfomercial

    Joined:
    Sep 9, 2008
    Posts:
    1,000
    I'm getting an error when I import the files:

    I'm on a Mac, but I was wondering if being on the Pro trial had anything to do with it. Does anyone know if plugins are disabled when using the trial version?
     
  22. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    Hmm, weird that it's complaining about UnityEditor assembly... Although, that's a C# plugin, so it should work even in free unity. I'll look into that, let me know if you figure out whats causing it.
     
  23. northman

    northman

    Joined:
    Feb 28, 2008
    Posts:
    131
    I got the same error message. so I think maybe the DLL file did not work on Mac computer.

    please test your tool on mac, thanks. :D
     
  24. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    I'll try to get a mac and take a look as soon as possible, got a couple other projects on my mind right now. I hope to look into it by the end of the week.
     
  25. jr57k

    jr57k

    Joined:
    Oct 28, 2006
    Posts:
    12
    I see the same problem on Mac Unity Pro. Any assistance I can offer is yours as I've got a demo due next week that I'd love to put this in.
     
  26. Hilmer

    Hilmer

    Joined:
    Mar 15, 2010
    Posts:
    6
    This looks very promising.

    Unity crashes when I use Mesh simplifier. I have installed the latest DirectX but I'm not sure I have the latest VC++ runtimes. Where do I find them?

    When I examine DXMeshCombine.dll and UniLOD.dll with Dependency Walker I notice that IESHIMS.DLL and WER.DLL are missing.
     
  27. immFX

    immFX

    Joined:
    Mar 20, 2010
    Posts:
    109
    This is probably the most promising project I've seen on these forums.

    What is the status? Are you planning on updating it further?
     
  28. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    Thanks. I am planning on fixing any existing bugs, but I have no plans for additional features.

    I apologize to the Mac owners, I still have no time to fix the existing bugs.

    @Hilmer
    I've seen this problem before with my testers. I haven't figured out what is causing it. I also used dependency walker to check for dependencies, and there doesn't seem to be anything else but DirectX and VC++ runtimes. Does it just crash, or does it show an error message about not being able to find a .dll?

    Also, the .dlls you mention are both delayed-load and they don't get called from the .dll. WER.dll is Vista specific, and shouldn't cause problems as Windows prevents loading of this file if ran on earlier OS versions. IESHIMS.dll I am missing myself, so that can't be the cause.
     
  29. IPete

    IPete

    Joined:
    May 15, 2008
    Posts:
    414
    Hey there BearishSun,

    Congratulations on this project, it really does look awesome - and thanks for sharing thus far, I would love to use it soon, so I shall be keeping it on my radar.

    Great work and all the best.
     
  30. hasanisakhani

    hasanisakhani

    Joined:
    Jan 9, 2010
    Posts:
    2
    " First thanks BearishSun for Unilod."
    I have a problem with it.and i don't know that its a bug or i do wrong!
    When i drag object to lod simplify and then press create;this appear :
    "
    MESH FOLDER EXISTS
    Folder with the specified name already exists.if you continue,all meshes with the same name in the folder will be replaced. do you want to continue?
    "
    If i press yes it ask again!
    if i press no it stop work!
    I use ut pro 2.61 and for this test i used unity's cube and cylinder and other owner meshs.they have same result.
    at bottom of viewport,in unity error reporter it report:
    dllNotfoundException:"**unity project address**/assets/plugins/DXMeshCombine.dll
    what i can do?
    Thanks!
     
  31. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    @hasanisakhani

    This happens when some of the dependencies the .dll is using are missing. Do you have the latest directx and vc++ runtimes?
     
  32. thellama

    thellama

    Joined:
    Mar 25, 2010
    Posts:
    360
    I've actually being trying to learn how to work with CombineSkinned and Skeletons. Any information would be welcome, not to steal the thread away from it's ultimate goal.

    This is very impressive but the downed resolution meshes are so un-predictable I'll stick to doing everything by hand in the 3d app. Quality's sake.

    I have an LOD script that swaps meshes around for the lods but I haven't found a way to implement layer changing or material changing. Those impressed me the most I think.
     
  33. hasanisakhani

    hasanisakhani

    Joined:
    Jan 9, 2010
    Posts:
    2
    No.so i update them and test it again.unity crashed out i test it both on my notebook and pc it have same result.
     
  34. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    @TheLlama

    If all your skinned meshes share exactly the same skeleton you can just do something like this (Code not tested):

    Code (csharp):
    1.  
    2. Mesh CombineMyMeshes(SkinnedMeshRenderer[] MeshRenderers)
    3. {
    4.    GameObject[] MeshRendererParents = new GameObject[MeshRenderers.Length];
    5.    for(int i = 0; i < MeshRenderers.Length; i++)
    6.        MeshRendererParents[i] = MeshRenderers[i].gameObject;
    7.  
    8.    Vector3 NewCenter;  
    9.    Mesh OutputMesh;
    10.  
    11.    UniLOD.ModelCombine.CombineSkinned(MeshRendererParents, MeshRenderers[0].bones, MeshRenderers[0].sharedMesh.bindposes, true, out OutputMesh, out NewCenter);
    12.  
    13.    return OutputMesh;
    14. }
    15.  
    If you want to combine their materials too, you use a slightly extended version of the CombineSkinned method, but the extra paramaters are pretty self explanatory.

    If all of your meshes do not use the same skeleton, then you must call some of the skeleton combining functions(AddBonesToSkeleton or CombineSkeleton), before calling CombineSkinned, and pass the new skeleton(and new bindposes) to CombineSkinned.

    Let me know if you need any more help.

    @hasanisakhani
    There seems to be some other problem with the plugin then. I sadly don't have time to look into it yet...You may try installing the DirectX SDK(not the Runtimes, but the SDK). That's the only thing I can imagine that might be missing, but it's just a guess.
     
  35. ginze

    ginze

    Joined:
    Mar 30, 2010
    Posts:
    9
    same problem
    On notebook with WInXP SP3 - Unity Pro 2.6.1
    DX9/vc++runtime 2008 sp1
    error log

    • at (wrapper managed-to-native) UniLOD.MeshSimplify.SimplifyMesh (single[],single[],single[],single[],int,int[],int,single[],int,intptr,intptr,intptr,int,intptr,int,intptr) <0x00004>
      at (wrapper managed-to-native) UniLOD.MeshSimplify.SimplifyMesh (single[],single[],single[],single[],int,int[],int,single[],int,intptr,intptr,intptr,int,intptr,int,intptr) <0xffffffff>
      at UniLOD.MeshSimplify.Simplify (UnityEngine.Mesh,int,UnityEngine.Mesh) <0x009e7>
      at UniLOD.LODSimplifyInternal.CreateLODMeshes (string) <0x001a5>
      at UniLOD.LODSimplifyInternal.Update () <0x0001d>
      at LODSimplify.Update () [0x00000] in E:\WORK TOOLS\Unity\TEST_CLEAR_ASSET\Assets\Editor\UniLOD\LODSimplify.cs:33
      at (wrapper runtime-invoke) LODSimplify.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff>
      at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (object,object[]) <0x00004>
      at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (object,object[]) <0xffffffff>
      at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <0x0009a>
      at System.Reflection.MethodBase.Invoke (object,object[]) <0x0001a>
      at UnityEditor.HostView.Invoke (string) <0x0002a>
      at UnityEditor.HostView.SendUpdate () <0x0000f>
      at UnityEditor.EditorApplication.Internal_CallUpdateFunctions () <0x00016>
      at (wrapper runtime-invoke) UnityEditor.CompilerHelper.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff>
     
  36. Pixelstudio_nl

    Pixelstudio_nl

    Joined:
    Jun 22, 2009
    Posts:
    179
    perhpas you have copied the the plugin directory in the wrong place.

    as seen in the video you have to copy the three directory in the root of your assets folder....

    seemed to solved the problem for me...
    Nice work on the system!!!
     
  37. ginze

    ginze

    Joined:
    Mar 30, 2010
    Posts:
    9
    2pixelstudio
    If copy plugin in wrong place dont see unilod menu =)



    I tryed in other 3 PC with XPsp3+Unity3d Pro and same result - crush in simplification.

    Instaling last DX9 / vc++ runtime 2005/2008/2008sp1
    or Visual C++ Express 2008 did not produce results
     
  38. grfxman

    grfxman

    Joined:
    May 28, 2009
    Posts:
    309
    So I'm really interested in using this in my game. Has the licensing been decided on yet? Am I free to use this in games at this point?
     
  39. grfxman

    grfxman

    Joined:
    May 28, 2009
    Posts:
    309
    I seem to be getting an error. It's cutting off the A in the asset directory.

    Here is the errors:

    Code (csharp):
    1. DirectoryNotFoundException: Directory 'C:\PRODUCTION_ART_STORE\PRODUCTION_UNITY\_UniLOD_\CHECKIT_002\ssets\Resources\Scenes' not found.
    2. System.IO.Directory.GetFileSystemEntries (System.String path, System.String pattern, FileAttributes mask, FileAttributes attrs)
    3. System.IO.Directory.GetFiles (System.String path, System.String pattern)
    4. System.IO.DirectoryInfo.GetFiles (System.String pattern)
    5. System.IO.DirectoryInfo.GetFiles ()
    6. (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:GetFiles ()
    7. SceneManagerInspector.OnEnable ()   (at C:\PRODUCTION_ART_STORE\PRODUCTION_UNITY\_UniLOD_\CHECKIT_001\Assets\Editor\UniLOD\SceneManagerInspector.cs:87)

    Not sure why
     
  40. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    Thanks for your interest. The project UniLOD was originally developed for was recently put on hold, and with it so was UniLOD.

    Sadly I cannot help you with any bugs at the time, nor can I provide licensing details.

    I am considering releasing the source code so you can fix the problems yourselves, but I can't give you an official answer yet.
     
  41. grfxman

    grfxman

    Joined:
    May 28, 2009
    Posts:
    309
    Well it might be giving me a little trouble right now :), But i have heard a lot of good things about it. And Unity really needs a tool like this. SO I hope you choose to go the open source route.
     
  42. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    I uploaded the source and UniLOD is now open-source and free. Hope you enjoy it.

    You may find the download link at the bottom of the original post on the first page.
     
  43. Neodrop

    Neodrop

    Joined:
    Oct 24, 2008
    Posts:
    1,358
    Thank you too much for a good news.
    Open Source is a best way for whole community.
     
  44. grfxman

    grfxman

    Joined:
    May 28, 2009
    Posts:
    309
    THANK YOU :)
     
  45. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    This looks very nice, but I have a question: Can I use this (the Mac/Pro version) if I want to build a Windows standalone? Or do I have to build a Windows standalone with a Windows version of Unity?
     
  46. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,602
    you can build it on the mac side, should work without a problem. (already did so with unity 2.1 and earlier where only mac editors existed)

    you potentially just can't test it in the editor any longer at all and get errors when you try to test run it with it present unless you have an appropriate mac plugin present
     
  47. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    You can build from any platform targeting any platform Unity supports.

    The only difference between Windows and Mac, is the mesh simplification plugin, and that is only used as a tool to help you build your scene, and never in the actual published game.
     
  48. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,435
    Got it, thanks. Bummers that "mesh simplification" script doesn't work on a Mac, could really use that.
     
  49. BearishSun

    BearishSun

    Joined:
    Dec 1, 2008
    Posts:
    175
    You could buy some old windows and run it as a virtual machine, then simplify meshes on windows and transfer them to a Mac machine. That would work fine.
     
  50. grfxman

    grfxman

    Joined:
    May 28, 2009
    Posts:
    309
unityunity