Code Monkey home page Code Monkey logo

autolod's Introduction

AutoLOD

Automatic LOD generation + scene optimization - Initial release was on January 12, 2018 via blogpost

AutoLOD is primarily a framework for enabling automatic post-processing of geometrical model assets on import to create simplified levels-of-detail (LOD). A default mesh simplifier is included, but can be swapped out with other simplifiers and on a per-model basis if needed. Additionally, a whole scene can be hierarchically chunked into LODs with SceneLOD.

Experimental Status

It’s important to note that AutoLOD is an experimental feature. As such, there is no formal support (e.g. FogBugz, [email protected], Premium Support, etc.) offered, so please do not use these channels. Instead, post your questions, comments, suggestions, and issues here on GitHub.

As with anything experimental/preview/alpha/beta, it is always a good idea to make a backup of your project before using.

Experimental means this:

  • Namespaces, classes, software architecture, prefabs, etc. can change at any point. If you are writing your own tools, then you might need to update them as these things change.
  • There won’t always be an upgrade path from one release to the next, so you might need to fix things manually, which leads to the next point...
  • Stuff can and will break (!)
  • There’s no guarantee that this project will move out of experimental status within any specific timeframe.
  • As such, there is no guarantee that this will remain an actively supported project.

Features

Useful classes (for your own projects, too!)

Evaluating

Unity 2018.4 (LTS) or a later version is required

Install via package manager

  • Using the UI
    1. Follow the steps provided here.
    2. The Git URL to use is https://github.com/Unity-Technologies/AutoLOD.git
  • Manually through editing manifest.json
    1. Read the instructions from the official documentation here.
    2. Open up manifest.json inside the Packages directory in your Unity project using a text editor.
    3. Under the dependencies section of this file, you should add the following line at the top: "com.unity.autolod": "https://github.com/Unity-Technologies/AutoLOD.git",
    4. You should now see something like this:
    {
        "dependencies": {
            "com.unity.autolod": "https://github.com/Unity-Technologies/AutoLOD.git",
            "com.unity.ads": "2.0.8",
            "com.unity.analytics": "3.2.3",
            "com.unity.collab-proxy": "1.2.15",
            "...": "...",
        }
    }

Cloning locally to your project (requires git-lfs)

  1. Create a new Unity project or use an existing one
  2. From the command line change directory to your project's Packages directory.
  3. Run git lfs clone https://github.com/Unity-Technologies/AutoLOD

Project Settings

If you plan on making changes to AutoLOD and/or contributing back, then you'll need to set the Asset Serialization property under Edit->Project Settings->Editor to Force Text.

License

Unity Companion License (see LICENSE)

All contributions are subject to the Unity Contribution Agreement (UCA)

By making a pull request, you are confirming agreement to the terms and conditions of the UCA, including that your Contributions are your original creation and that you have complete right and authority to make your Contributions.

Initial Contributors

Amir Ebrahimi
Elliot Cuzzillo
Yuangguang Liao

Community Contributors

@Camarent, @LoneDev6, @marwie, @msellens, @redwyre

autolod's People

Contributors

amirebrahimi avatar katitov avatar lonedev6 avatar marwie avatar msellens avatar redwyre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autolod's Issues

Overriding defaults % decimation

Autolod uses % decimation, it's currently hard coded at 50% of each previous LOD in the chain. It would be great to override those % in the LOD override.

unable to remove LOD in 2017.3

Destroying assets is not permitted to avoid data loss.
If you really want to remove an asset use DestroyImmediate (theObject, true);
UnityEditor.Experimental.AutoLOD.AutoLOD:RemoveLODs(MenuCommand)

How about Lightmap baking?

I think HLOD is most important part of Game Making. Because perfomance is most important part of Game.
Unity lightmap are belong to scene. How can I bake lightmap in HLOD?

Imposters Support?

As an alternative to an automatic LOD generation for individual assets, could Imposters perhaps be implemented in their stead?

https://shaderbits.com/blog/octahedral-impostors/

With the advent of the new Shader-Graph situation, I would think this would be in the cards for LOD, right? D:

PS: I just wanted to yell from the top of my lungs that YOU GUYS ARE AWESOME!!! -- Thanks for looking into this LOD stuff! -- I've been wanting to make larger worlds, but Unity has been very adament about crushing my dreams on this... :(

Compiler error in Unity 2017

Line 808 of LODVolume is this:

var prefab = PrefabUtility.GetCorrespondingObjectFromSource(go);

This requires Unity 2018, but you don't have a corresponding compiler directive. You'll need to change this like you did in AutoLOD:

#if UNITY_2018_2_OR_NEWER
                var prefab = PrefabUtility.GetCorrespondingObjectFromSource(go);
#else
                var prefab = PrefabUtility.GetPrefabParent(go);
#endif

Editor script does nothing, any errors silent

I tried selecting a model with skinned mesh renderers either as a prefab in the Assets directory, or as a game object in the scene with absolutely nothing happening when running the editor script.

No errors.

Using 2018.2.5f1

Packages didn't download?

The packages didn't download, I got the folders: Packages, Packages/CCU and Packages/UnityMeshSimplifier.
But it didn't include the contents only the meta files. I can manually fix this i'm sure but it'd be nice not to have to. If this is a Github related issue like I assume when you download the zip it doesn't include submodules than that's understandable but either way you should say that somewhere if not fix it. Loving this idea though so far.

LODs created in HDRP's package folder

In 2018.3b2, it seems AutoLOD is creating lods in the HDRP's package folder which is read-only. This results in editor spam of the following error:

'Read only asset Packages/com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/Disc_lods.asset has no meta file.'
'Read only asset Packages/com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/Sphere_lods.asset has no meta file.'
'Read only asset Packages/com.unity.render-pipelines.high-definition/HDRP/RenderPipelineResources/Quad_lods.asset has no meta file.'

Memory Leak Errors: Possible Extension of Issue #49

Problem:

Memory leak warnings produced during creation of LODs post import of model. Problem occurs on models of several different types including .fbx, .blend, and .obj. The warnings indicate possible memory leaks, and if an error occurs, error indicates that they are produced from the memory leak.

Engines Attempted:

2019.1.02f, 2018.3.13f, 2018.3.08f

Changes Tried:

Max Exec Time 8, 15
Both Mesh Simplifies
Both Default Batchers
Max LOD Gen 3, 4 and 5
Initial LOD Max Poly 5000000, 50000000, 50000000

Additional Notes:

Model Max Poly: 190000
The error seems to occur on larger/more complex meshes that use only a few different sections/subsections as compared to a model that is broken into several sections/subsections

Simulated Mesh Simplifier

Firstly, nice work as for the first release.

While others are talking about Simplygon and InstaLOD, I noticed that there is also provided here the Simulated Mesh Simplifier. This one, different from other two, does not seem to require any external plugins and seems to be written from scratch.

I was trying to test a bit recently by importing high-polycount icosphere from Blender to Unity. The AutoLOD creates two additional LODs nicely. When I drag it into the scene, the main gameObject gets two child gameObject, where these two LODs are working. But when I zoom-in and out, the sphere disappears on LOD1, and appears back on the main LOD0. Is something not working here?

Run-time implementation

Fantastic job, this is a welcome addition to the Unity eocsystem! In the Wiki I noticed:

  • HLOD generation occurs at edit time (however, the framework doesn’t preclude having run-time generation)

I imagine this refers to a case where: the meshes & textures themselves are known at edit-time (already part of the Assets/ or Resources/ folder), and it is only their instances/transforms in the scene that are determined at run-time. Is it possible to take it a step further and say: the meshes & textures are living in an AssetBundle in StreamingAssets, so are not known at all until run-time?

autoLOD vs LODGroup?

Once the meshes are baked, what's the difference?
when I dolly in and out in the scene view I notice a hiccup, is this LODGroup trademark ? I mean 5.3 shader prewarm got much better and was no longer needed plus all the lods share the same material...

Switch over to Unity namespace

The lines have been blurred about what is UnityEngine and what is UnityEditor for awhile and this definitely came up on EditorVR. Seeing what the ECS team is doing I think it makes sense now to switch over to the Unity namespace. The assembly definition files and DLL options in the editor now allow us to pick what platforms a DLL should be loaded on.

Compiler Error 2018.1.3f1

I have got this issue when importing in a 2018.1.3 project :

Assets/AutoLOD/Scripts/Editor/MeshSimplifiers/QuadricMeshSimplifier.cs(2,7): error CS0246: The type or namespace name `UnityMeshSimplifier' could not be found. Are you missing an assembly reference?

The line are those
devenv_2018-08-01_12-05-25

Namespace ScriptableSingleton could not be found.

Hello I come across internet and found this interesting unity tools. I planning to build on PC Standalone by Unity 2018.1.0f2. Everything works fine on editor, but when I build it resulting error:

Assets/AutoLOD/Scripts/Helpers/MonoBehaviourHelper.cs(15,40): error CS0246: The type or namespace name `ScriptableSingleton' could not be found. Are you missing an assembly reference?

What am I supposed to do to fix this? Trying to add some #if UNITY_EDITOR but doesn't work at all. Thank you.

Really unable to test it out

It sounds like a fantastic project, but it doesnt matter what objects I import or how simple they are, the editor crashes as soon as it starts the simplification/lod generation process.

Is there any important thing im missing out ?
Using unity 2018.1.0b2

UPDATE.
Downgraded to 2017.3 , it doesnt crash anymore, but, one it generates unusable meshes, and second, the meshes wont show in the scene anyway.
I guess this is "very experimental".

UPDATE 2.
It seems like some simplygon 3rd party software/plugin is required in order for this to work.

AutoLOD generated mesh smoothing, how to disable?

Hi, trying to use AutoLOD with lowpoly project, but generating mesh with the default QuadricMeshSimplifier results in smoothed mesh. I spent hours trying to learn the code and trying to pinpoint the exact part where the smoothing feature is done, but couldnt find it.

Removing these files from the QuadricMeshSimplifier script results in sharp mesh, but all the colors of the model are lost.
meshSimplifier.UV1 = inputMesh.uv;
outputMesh.uv = meshSimplifier.UV1;

Hope that helps to solve the problem!

What about ManualLod?

Can i generate lods manually? most of my models already have lods so i don't need lods been generated.

Exceptions on generating LODs

Hello,

the AutoLOD project looks very promising!!
I just added it to my actual project.
If i try to generate LODs of an fbx file in the Editor i get the following exceptions:

ArgumentException: array.Length (15) does not match the Length of this instance (14).

A Native Collection has not been disposed, resulting in a memory leak. It was allocated at V:\AREC\AUS\trunk\AUS\Assets\AutoLOD\Scripts\Helpers\WorkingMesh.cs:472.

Any suggestions whats the reason??
Unity 2018.3.0f1

thanks, sebastian

Skinned meshes and LOD

Are they supposed to work?

Nothing happens seemingly when right clicked.

latest version

Build for artists?

Hello,
I'm an artist and I don't know how to use the git functions that are required to install this plugin. It'd be really cool if you guys could upload a unitypackage for people like me!

LODGroup Upload to importer

Could we get upload to importer non grayed out? that'll allow to fine tune the lodgroup regions and fuse them back in the asset

Doesn't work with Simplygon anymore

I'm getting this error, which is weird because it used to work a few weeks ago
NullReferenceException: Object reference not set to an instance of an object UnityEditor.Experimental.AutoLOD.SimplygonMeshSimplifier.Simplify (UnityEngine.Experimental.AutoLOD.WorkingMesh inputMesh, UnityEngine.Experimental.AutoLOD.WorkingMesh outputMesh, Single quality) (at Assets/Scripts/AutoLOD/Scripts/Editor/MeshSimplifiers/SimplygonMeshSimplifier.cs:48) UnityEditor.Experimental.AutoLOD.ModelImporterLODGenerator+<GenerateMeshLOD>c__AnonStorey1.<>m__0 (System.Object sender, System.ComponentModel.DoWorkEventArgs args) (at Assets/Scripts/AutoLOD/Scripts/Editor/ModelImporterLODGenerator.cs:321) System.ComponentModel.BackgroundWorker.OnDoWork (System.ComponentModel.DoWorkEventArgs e) System.ComponentModel.BackgroundWorker.ProcessWorker (System.Object argument, System.ComponentModel.AsyncOperation async, System.Threading.SendOrPostCallback callback) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary () System.ComponentModel.RunWorkerCompletedEventArgs.get_Result () UnityEditor.Experimental.AutoLOD.ModelImporterLODGenerator+<GenerateMeshLOD>c__AnonStorey1.<>m__1 (System.Object sender, System.ComponentModel.RunWorkerCompletedEventArgs args) (at Assets/Scripts/AutoLOD/Scripts/Editor/ModelImporterLODGenerator.cs:334) System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted (System.ComponentModel.RunWorkerCompletedEventArgs e) System.ComponentModel.BackgroundWorker.<CompleteWorker>m__1 (System.Object darg) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnitySynchronizationContext.cs:92) UnityEngine.UnitySynchronizationContext.Exec () (at C:/buildslave/unity/build/Runtime/Export/UnitySynchronizationContext.cs:53) UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at C:/buildslave/unity/build/Runtime/Export/UnitySynchronizationContext.cs:74)

Failing to add LoD in basic scene when inputting to LoD Volume script

A LoD group of 5 levels was generated from Simplygon on local grid.
The resulting prefabs were copied into a basic scene.
The LoD Group prefab was attached to the HLoD Root public input of the Volume Script which is attached to the automatically added LODVolumeNode0 object.
The "Enable HLOD" button was clicked.

No geometry renders during play in the editor, with a basic FlyCamera moving in the scene.

I'm not sure if the LoD prefabs were connected to the AutoLoD system in the correct way, by attaching the group prefab to the HLoD root.

AutoLoDTest

SceneLOD and Multiple Scenes

Loving these plugins so far, but running into some issues with SceneLOD on one of my projects. It's a relatively large project, and is split into multiple scenes that are loaded additively on top of each other (using the plugin https://assetstore.unity.com/packages/tools/utilities/advanced-multi-scene-cross-scene-references-47200 - though I suspect the same issue would be present just using Unity's built-in additive scene system).

As far as I can tell, SceneLOD doesn't handle multiple scenes appropriately. I've tried to make some local changes to the code base to get it working properly, but haven't been able to get it fully functional yet. Is multiple scene support something that might be handled at some point, or should I start considering coding our own HLOD system?

Random resize bug Blender models

Hello, I think I found a bug: lods scale appears to be broken if the original object has a scale not equal to (1, 1, 1) when imported.
For example:
I have a road model scaled in Blender to (0.096, 0.45, 0.45), if I import it with the AutoLOD enabled the generated lods have a strange size:

lod0

lod1

Let me know if I made any mistake or if it's a real bug, thanks! 😄

Unusable output

I was really excited to find this. But unfortunately the first try is giving me really really bad results (much worse than expected). Basically just garbage with slight resemblance of the original contours.

Are there any options I can play with?

unity_2019-02-22_14-15-43
unity_2019-02-22_14-15-38

For comparison, here's an optimization to 3% using ProOptimizer in 3ds max:
3dsmax_2019-02-22_14-34-30

Demo Please!

Demo Please! Dont Know How to use Scene LOD at all.

Editor

Hello Unity Labs.

I'm having an issue using this. I have cloned, pulled dependencies and imported into a project.

But whenever It tries to run it logs this:

Can't add script behaviour LODVolume because it is an editor script. To attach a script it needs to be outside the 'Editor' folder.
UnityEngine.GameObject:.ctor(String, Type[])
LODVolume:Create() (at Assets/AutoLOD/Scripts/LODVolume.cs:187)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

and this:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Experimental.AutoLOD.SceneLOD+<UpdateOctree>c__Iterator2.MoveNext () (at Assets/AutoLOD/Scripts/Editor/SceneLOD.cs:338)
UnityEngine.Experimental.AutoLOD.TimedEnumerator.MoveNext () (at Assets/AutoLOD/Scripts/Helpers/TimedEnumerator.cs:38)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.