Search Unity

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

Mesh Baker LOD [RELEASED]

Discussion in 'Assets and Asset Store' started by Phong, Nov 1, 2013.

  1. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,742
    Hi LeveAnts, I would take a careful look at the LOD setup. For some reason the same MeshRenderer in the scene is being added twice to a combined mesh. You should be able to use previously baked mesh assets. There is nothing magic about the baked meshes. A mesh is a mesh is a mesh.
     
  2. LeveAnts

    LeveAnts

    Joined:
    Jan 13, 2016
    Posts:
    2
    Hey again, I didn't quite figure out what was causing the mesh to be added twice, didn't have to really I ended up using own meshes combined in blender, the vertex count rising issue was something weird with unity's Game view statistics, started working today on my project again, and somehow magically after opening unity the verts count went back down matching those of the meshes in the project view.

    Thank you for replying so soon Phong, really good support there from your side definitely a worthy asset with such dedication.
     
  3. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    198
    Hi,

    Does Mesh Baker LOD decimates a model at runtime?
    If not, could it be integrated with solutions like Automatic LOD?

    Regards,
    R
     
  4. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,742
    Hi Rod,

    Mesh Baker LOD does not do any decimation. It is similar to an LOD group.
     
  5. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,742
    I will be on vacation from July 8th to July 17th. Support will not be available during this time. Sorry for the inconvenience.
     
  6. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,220
    Shouldn't you update the original post removing the unity free references?
     
  7. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    198
    We have a bunch procedural generated content so there isn't LOD at editing time to attach to Mesh Baker LOD.

    Could you integrate it with Automatic LOD or provide us a way to attach a dynamic mesh at runtime?
     
  8. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,742
    Hi Rod, the LOD prefabs need to be built in the editor. It is not really possible to build them at runtime.
     
  9. Ramulos

    Ramulos

    Joined:
    Feb 19, 2017
    Posts:
    57
    Hello,

    I implemented mesh baker and lod for my trees(alot of them) in my project. I was hoping you could help me with two things.

    There's an issue of popping when it transitions from one lod to another. I know in the unity lod system there's a crossfade feature to make the transition smoother. Is there any way to put something like that in place here?

    Also my project is for VR so id appreciate any tips you have on maximizing performance and squeezing every ms i can get. i.e. best max vertices in combined mesh for performance, cluster type simple vs grid (doc doesn't mention performance), garbage collector optimization for the meshes, anything else you think might help would very much be appreciated.

    Sorry if I'm asking a bunch. Thank you for your time.
     
  10. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,742
    Hi Ramulos,

    Sadly there is no easy way to avoid the popping. The Unity crossfade system is deeply integrated with Unity with no way to hook into it. One thing that helps is to try to make sure the LODs have the same silhouette.

    Regarding performance, is your game on Mobile or PC? Tuning can be a bit of an artform. I would recommend sizing the clusters to be about 1/3 the distance from the near to the far fustrum using the grid cluster. The max verts in combined can very a lot depending on hardware you are running on for mobile I would suggest 15k but this is something I would experiment with.
     
  11. Ramulos

    Ramulos

    Joined:
    Feb 19, 2017
    Posts:
    57

    Thank you for the reply :). Im using pc vr, the HTC-Vive. Ill try out the cluster size reccomendation and play around with the max verts a bit.
     
  12. Ramulos

    Ramulos

    Joined:
    Feb 19, 2017
    Posts:
    57
    Hello again,

    Sorry to be asking questions every other week. Everything seems to be working great so far, managed to to mitigate the popping effects with some "creative" use of lod models and fog.

    I have another problem regarding the startup of the Lod manager. How can I delay the lod manger from searching for the lod camera script till after I've initialized the camera?
    Currently to support vr multi platform my scene is initialized with a vr sdk manager to detect which headset is connected and then creates the relevant camera prefab and settings from that since each has a unique camera. The problem is that the lod manager meanwhile is constantly throwing hundreds of errors and slowing up the startup massively saying it cant find a lod camera script. Where can I make this delay happen?
     
  13. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,742
    Hello, this will be tricky as the setup for each LOD would need to be delayed as well. This is something I hadn't considered when designing this. I will try to fix it so that things work without a camera.

    As a workaround I would suggest:

    Have an extra camera in scene with a LODCamera script on it. When you camera is ready. Add the new camera to the manager using LODManager.AddCamera. Then remove the initial camera from the LOD manager and delete it. It is a bit of a hack but it should work.

    [Update] adding the line to MB2_LODManager.cs line 512 (line 7 in the code below) should fix the errors when there is no LOD camera in the scene. You will still need to call "AddCamera" when your camera is ready.

    lodCameras = new MB2_LODCamera[0];

    Code (CSharp):
    1.      
    2.  
    3. public MB2_LODCamera[] GetCameras(){
    4.             if (lodCameras == null){
    5.                 MB2_LODCamera[] lcs = (MB2_LODCamera[]) MB2_Version.FindSceneObjectsOfType(typeof(MB2_LODCamera));
    6.                 if (lcs.Length == 0){
    7.                    lodCameras = new MB2_LODCamera[0];
    8.                     MB2_Log.Log(MB2_LogLevel.error,"There was no cameras in the scene with an MB2_LOD camera script attached",LOG_LEVEL);
    9.                 } else {
    10.                     lodCameras = lcs;
    11.                 }        
    12.             }
    13.             return lodCameras;
    14.         }
     
    Last edited: Aug 24, 2017
    syscrusher likes this.
  14. Ramulos

    Ramulos

    Joined:
    Feb 19, 2017
    Posts:
    57
    Thank you so much! :D:D:D
    This fixed my problem. I'm able to startup now with no errors from the LOD manager. Thank you for all your help and awesome work on these assets!
     
  15. katasteel

    katasteel

    Joined:
    Nov 21, 2014
    Posts:
    223
    "Combine many skinned meshes into a mob that renders in one drawcall."
    Does/can that happen at runtime?

    I am created an ARPG that will contain many skinned meshes on the screen at one time.
    I am looking to buy or create a tool that bakes skinned meshes with matching materals/shaders at runtime.
    So if a character enters the cameras frustum it will be baked into an existing(or new) skinned mesh, and removed from it when it leaves the cameras frustum.

    Can MB LOD do this?
     
  16. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,742
    It does something very similar. It bakes the skinned meshes based on proximity to the camera. It does all the mesh combining at runtime.

    I would encourage you to create the atlases ahead of time. This process takes time and there are limitations like all textures must be readable.
     
  17. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    630
    Hi, i currently own the paid version of mesh baker , and felt mesh baker LOD might be a nice add-on to use as well. I was wondering if there was any added support for billboards as a final lod level. I noticed in the reviews someone posted some code that may have made it possible ? thanks
     
    Last edited: Aug 14, 2018
  18. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,742
    Hi JBR-games,

    It is not possible to include BillboardRenderers in a combined mesh. I tried to do this but the meshes used by BillboardRenderers are not simple meshes like those used by SkinnedMeshes and MeshRenderer meshes so I doubt that it will ever be possible to do this.

    BillboardRenderers can still be used by the LOD, by setting the "dont include in combined mesh" flag, but there will not be a performance benefit. That is what the code did in the review. It sets this flag.
     
    JBR-games likes this.
  19. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,067
    @Phong, I have the paid version of Mesh Baker and am just learning to use it. I watched your tutorial video last night (nice job on that ... very clear and easy to follow).

    Is the LOD tool still an add-on with the paid Mesh Baker, or is it included with the paid MM but an add-on for the free version? I ask this because when I imported Mesh Baker, I saw some references to LOD things in the import list. I'm not unwilling to buy the add-on, but wanted to make sure I don't already have it included. :) Thanks!
     
  20. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,742
    Sorry for the slow reply. Mesh Baker LOD is not included in Mesh Baker. It is an independent asset. It requires Mesh Baker.
     
  21. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,067
    No worries on the response time, and thanks for the info. No objection that it's not included, just wanted to make sure I wasn't double-buying. :)
     
  22. attaway

    attaway

    Joined:
    Nov 12, 2014
    Posts:
    41
    Hey I'm interested in getting something setup like Unreal's HLOD with Impostors described in https://shaderbits.com/blog/octahedral-impostors/ and https://docs.unrealengine.com/en-us/Engine/HLOD/Overview.

    I'm using Amplify Impostors to generate impostors but then I'm wondering if its possible to integrate them with Mesh Baker & MB LOD in the same way. The system described works by selecting "Use MaxLOD as Impostor".
    I'm generating my own LODs so I dont mean to include their Auto LOD system, just the way in which they work with clusters and impostors.
     
    taymdevr and JBR-games like this.
  23. unity_Zf3d_qzQMfmU3Q

    unity_Zf3d_qzQMfmU3Q

    Joined:
    Jan 30, 2020
    Posts:
    27
    Hi,

    This is in the documentation:
    "Requires Mesh Baker 2 - available in the Asset Store"

    And I already have latest Mesh Baker, then this is the error
    The type or namespace name 'MB2_MeshBaker' could not be found (are you missing a using directive or an assembly reference?)

    What should I do, mate?
     
  24. unity_Zf3d_qzQMfmU3Q

    unity_Zf3d_qzQMfmU3Q

    Joined:
    Jan 30, 2020
    Posts:
    27
    I tried but it's still getting these errors
     
  25. Phong

    Phong

    Joined:
    Apr 12, 2010
    Posts:
    1,742
    Hmmm, what version of Unity are you using. I have tested in 2019.4 and 2018.4 and it works for me.

    It looks like MeshBakerLOD cannot see the Mesh Baker scripts. Are you using "Assembly Definition Files" in your project? Or did you put the Mesh Baker LOD scripts in the Plugins folder? If the Mesh Baker LOD folder has been imported into an different assembly than the Mesh Baker scripts then you will need to add a reference to the Mesh Baker assembly from the Mesh Baker LOD assembly.

    You can see what assembly a script is in by selecting it in the project and looking in the inspector:

    upload_2020-7-2_16-32-13.png

    If the Mesh Baker LOD files are in a different assembly then you will need to add references to the Mesh Baker assembly by assigning a reference to it in whatever assembly the Mesh Baker LOD is in. Let me know if that is the case.
     

    Attached Files:

    unity_Zf3d_qzQMfmU3Q likes this.
  26. unity_Zf3d_qzQMfmU3Q

    unity_Zf3d_qzQMfmU3Q

    Joined:
    Jan 30, 2020
    Posts:
    27

    Thanks, i have solved the issue by deleting the folders and re-import the package. It was a mistake from my colleague
     
    Phong likes this.
  27. DeadHandInteractive

    DeadHandInteractive

    Joined:
    Dec 11, 2015
    Posts:
    1
    Hello,

    Has anyone tried implementing dithering or crossfading between LODs? I'm not sure how Unity's default LOD system handles it, but we would like that functionality for the game we're making.

    Cheers,


    Greg
     
  28. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,220
    @DeadHandInteractive as far as I understood the option works only with the built in pipeline and it's not their fault.
     
unityunity