- Home /
Creating LOD Group for character
Hi
I have a character which I created a LOD version of so I have _LOD0 and _LOD1 for high poly and low poly.
I followed the Unity manual for creating a LOD Group which works perfectly for objects like rocks and buildings that dont move but when I do this for a character it has some issues transitioning between LOD versions.
It seems to transition between 2 versions of the character rather than just switching between the high poly and low poly mesh on the same character but I can't figure out how to set this up properly in the LOD Group.
I tried adding only LOD0 and then adding just the skinned mesh renderer object in the LOD1 slot which makes the LOD versions appear in the same place but only the LOD0 one is animating.
Please can someone explain how to setup a LOD Group for a character properly?
Answer by OllyNicholson · Oct 01, 2012 at 03:44 PM
The workflow for setting up a character for LOD support is as follows:
Create and name an empty game object in your scene - e.g. characterName
Drag both LOD0 and LOD1 models from your project pane onto this node in the hierarchy
Add Component > Rendering > LODGroup to the characterName node
Select the LOD: 0 group and Add the LOD:0 Renderer
Select the LOD: 1 group and Add the LOD:1 Renderer (repeat for other LODs)
Make relevant adjustments to the Distance by dragging
The character controller scripts will then determine which animations to use etc.
Note LOD does not understand the concept 'same character' so yes in a sense it is simply switching between two models, but they share the animation. Here is a link to our 3.5 pro features demo with the soldiers set up for LOD:
http://unity3d.com/unity/preview/download (Pro Features Demo - bottom right)
I have downloaded the pro features demo and seen the LODGroup working on a character but cannot reproduce this using the demo assets and following Olly's guide above.
It seems the key is to get a character with multiple skinned meshes and a single skeleton and animation - this is the bit I cannot repro.
In the demo, the characters with working LODs have this structure
Soldier_Red_Agent(GameObject with LOD Group)
Lightprobe_Anchor (works fine without this)
SoldierRed_LODs (with Animation)
Pelvis
Other bones
Soldier_LOD0 (Skinned$$anonymous$$eshRenderer)
Soldier_LOD1 (Skinned$$anonymous$$eshRenderer)
Soldier_LOD2 (Skinned$$anonymous$$eshRenderer)
When I follow the steps above I get this structure
$$anonymous$$ySoldier (GameObject with LOD Group)
Soldier_LOD0 (with Animation)
Pelvis
other bones
Soldier (Skinned$$anonymous$$eshRenderer)
Soldier_LOD1 (with Animation)
Pelvis
other bones
Soldier (Skinned$$anonymous$$eshRenderer)
The result is that the mesh will switch at distance, but will not animate unless I apply the animation to both Soldier_LOD0 and Soldier_LOD1.
Has anyone had any luck with Olly's steps for an animating character over several LODs?
I suspect that the fbx needs to include a single skeleton and multiple skinned meshes, but if anyone has any advice on how to set this up from multiple fbxs containing a single skinned mesh each, then I would really appreciate some info on how to achieve this.
p.s. Hope this is submitted correctly - first post ;)
Had a reply from Ricardo at unity support with details on how to set this up, so thought I would share. Steps detail how to get a character with a single skinned mesh to LOD through 3 meshes, whilst still being run from a single animator. It is also possible to import an fbx with multiple skinned meshes, but for our workflow this wasn't best.
Anyway, here goes...
Drag character into the scene (or parent under a newly added empty game object)
Find the skinned mesh
Right Click and duplicate x2
You now have the single animator, 3 skins layout (all at same hierarchical level) which is vital to this working.
Next switch the duplicates for the LOD versions by dragging your low poly skinned meshes onto the 'mesh' property for each duplicate.
You could consider rena$$anonymous$$g the duplicates so they make more sense for the LOD setup...
To activate the LODs go to the root object, add component of type LODGroup.
Select LOD0 and drag the high res mesh onto it. Repeat for LOD1 and 2 (using medium and low res)
You can slide the LOD bars to adjust when each level kicks in.
You can also drag the camera icon in the lod group to shift the camera back and forth to see when they switch.
To test this drag an anim onto the 'Animation' component.
That's it!
You should also consider the properties of each skinned mesh renderer LOD - you can get performance back by turning off cast/receive shadows, quality (maximum bones per vert).
Thanks Ricardo!
How are the variation meshes setup? I have three versions skinned to their own skeletons which are a copy of the main. Sloting the lower res version into the duplicates property slot blows them up. Do the three meshes have to be skinned to the same rig then?
Answer by sxnorthrop · Apr 21, 2016 at 03:17 PM
Try using a 3D modeling program, and on your character, duplicate the skin 2 times. Select the second layer and dumb down some of the vertices. Do this for the third layer as well. Import into unity, drop a LOD Group on the base of the model above the rig. Drag in the separate layers of the model into each different LOD. And you should be good, now all your different model layers will use the same rig, and also use the LOD group.
Answer by holyfot · Jan 07, 2020 at 05:50 AM
Here is an example script that doesn't require a bunch of objects. You just setup the materials (in the right order) and the meshes. Character LOD Script
Your answer
Follow this Question
Related Questions
LODGroup feature not available despite being on Unity Pro 1 Answer
LOD Popping in when objects placed via terrain painter 0 Answers
LOD only working in scene view 1 Answer
Character Animation Pose Mesh,Animated Pose Mesh 0 Answers
Is it normal to have one drawcall PER levels of detail when using LODGroup? 0 Answers