Level-of-detail manager

Update: UniLOD BETA released: http://forum.unity3d.com/viewtopic.php?t=45295

Hi, I thought I’d share a project I’m currently working on. It’s still in VERY early stages.

Basically it allows creation of pretty huge scenes within Unity with no real performance impact(Hopefully there won’t be one, there’s still a lot of things to work out).

More specifically:

  • Automatic mesh simplification - Reduce mesh polygon count automatically, for lower level of details. You may also specify lower-detail textures

  • LOD editor

  • Easily switch between different quality levels(Low, Medium, High, etc.)

  • Group models on lower qualities together - Both their models and textures will be combined. Heavily reduces number of draw-calls for far-away low-quality objects.

  • Easily add new quality levels

  • Save the entire scene

  • .xml with object information(position, mesh/tex location, etc)

  • All objects are saved to asset bundles, taking into account possible duplicate texture and model combinations.
    [/list:u:ffb46cabec]

  • Scene manager

  • Loads the scene XML, and based on camera distance from the player it will load and display different quality level objects

  • Uses tree-hierarchy as defined with the LOD Editor so the search for active objects is quite fast

  • Resource manager

  • Contains wrappers for all larger resource types(Material, Mesh, Texture, etc.). Wrappers allow a simple asynchronous load mechanism without making the user write callback functions or co-routines

  • Handles loading resources exclusively from asset-bundles

  • Queues resource load requests for optimal performance

  • Keeps a reference count of all resources and automatically unloads unused resources
    [/list:u:ffb46cabec]

This is for Unity Pro on Windows only. Why?

  • Because it uses asset-bundles. If I didn’t use asset bundles I would have had to used Resource.Load. But with Resource.Load you may never unload the loaded resources completely, therefore you can never free the memory, so this kind of LOD system is a bit pointless since at one point you’re gonna run out of memory. I might consider making it using Resource.Load, although you would have to split your scene into manageable chunks.
  • Because it uses a C++ plugin which calls a DirectX function for mesh simplification. This means it is Windows only. Initially I wrote my own mesh simplification classes, and it turned out to be quite a massive undertaking. However, i never managed to get it to work as good as the DirectX does, so I decided to use that instead. I might write a non-Windows plugin later.

Here’s a pic of the editors:

And here it is in action:

Running on Vista x64, E6600 at 2.4Ghz, 8800GTX and 2GB RAM.

Hope you like it

This looks very cool.
Will you release this ?

this is great news - you rock.

When will it be done and is it free or paid?

I will release it, but if it will be free or paid I don’t know right now.

It’s likely gonna be free but I can’t really confirm it, I did put a lot of effort in it, and there’s still a lot to finish.

Hopefully a full version for Windows using Unity Pro will be done in a month.

Possibly a Mac+Indie version early next year, since I got some other stuff to work on after Win+Pro version is finished.

Holy cow this is cool, with my dungeon code coming to a screeching halt, this will fix that instantly! Going to be watching this like a hawk.

Here’s a thought: Maybe UT should commission this project and release it with Unity Pro? Not sure if you or UT are interested in this, but it sure looks like something that almost every serious developer would be interested in.

we’d love to pay if it’s good enough!!!

Bigkahuna’s got the right idea!

Work with UT to implement this as a default part of Unity, something that will ship with it, and work pretty much out of the box, allowing devs to focus on making the game fun, not optimizing it! Awesome idea, however it’s released.

bigkahuna is definitely right.

But great job. I really like how much more efficient it is then normal :smile: .

Problem is from what he posts he uses the D3DX progressive mesh capabilities, something that does not have any OpenGL counterpart …

But definitely a very interesting thing for Windows Standalones :slight_smile:

Very cool. Makes me want to slap down the money for pro right now! :smile:

Very exciting, I would love to get my hands on it. Great job!

I own Pro and would be interested in purchasing this.

Well, he said he might make it for mac later. Soo, if he finished for mac that is when he could do the thing with unity!

Thanks for your support guys.

I’ll keep this thread updated with my progress.

neeeeeeeeeeeeeeeeeeeeeeed!!!
nice job!

Very nice. I was going to be writing something like this myself, but alas…

It seems a web-player build would benefit most from this feature, but of course the C++ plugin makes that a no-go. But, it is good to hear you may still try to develop the mesh-simplification algorithm yourself.

Have you also considered mesh-compression to reduce the streamed asset payload? Of course, it seems Unity 2.6 now has mesh compression feature, but I’m not clear on what method they are using nor how efficient it is.

GREAT WORK HERE!
any recent updates on this great script? really hope some decent iOS LOD features get added someday.

Is there any LOD script our there for iOS that anyone can recommend?