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.
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.
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.
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.