- Home /
Skinned Mesh Renderer vs Mesh Renderer
I have a project in Unity Pro iOS Pro. I plan to have a large number of characters in a scene (at least 100). Each character is around 150 poly. The character is rigged and uses a SkinnedMeshRenderer.
For performance reasons, I would like to use non-rigged characters and use a puppet setup instead.
Will I notice anything considerable?
What do you mean by puppet, do you mean animated transforms as opposed to defor$$anonymous$$g a skin?
How many bones are we talking? 150 polys is very low, have you created your model yet? In our experience it is very hard to create a good biped model that will animate well with less than 400 polys.
Our approach is to LOD the S$$anonymous$$R based elements in our game, using an S$$anonymous$$R for the nearest 5 mobs only and swapping to a mesh we just bob about to give the illusion of movement.
We have a tile based game, so it is very hard to have 5 S$$anonymous$$Rs very near the player anyway, and if they are near, then they tend to obscure the meshes that are just bobbing about and the eye is naturally drawn to those meshes that are nearer and animating smoothly.
You could take the puppet approach but you would need to manage the drawing yourself, build up a buffer and draw in one or more calls, but it's a lot of work and you would need to check that the phone can handle the bandwidth of updating a vertex buffer for your target number of mobs * vetrtex count every frame for your desired frame rate.
Back when the VBO support on iPhone 3G was erm.. fake, the 20 draw calls was the max, this was the best way to draw stuff. You'r effectively batching say 10 or more mobs into a single call and thereby reducing the drawcall overhead from say 600 to say 10 (drawing 10 mobs with each call)
This is quite a bit of work however and your puppets will have clear seams where geometry is poking through, but this can work well enough for mobs like robots say.
@Bovine. yes animated transforms as animations attached to each character. appreciate your response.
Here is a screen shot https://dl.dropbox.com/u/978764/Screen%20Shot%202013-01-21%20at%209.12.23%20P$$anonymous$$%20%282%29.png
There are only 30 Crowd characters in this scene. I would like to get to at least 100 characters. the character in the image is not textured yet or rigged. I haven't changed it to a pupper yet, but I would like to.
I am going to have about 10 different characters or so and clone them throughout the scene.
I want the camera to go fairly close and have dynamic perspective around them so I had to switch to using characters over having a 2d plane of an animated crowd texture.
Also, I dont $$anonymous$$d doing the puppet animation myself. Clear seams is ok, Im not too concerned with detail per character since I feel having the user see a large crowd of characters dancing will give enough of a positive response.
Answer by Paulius-Liekis · Jan 21, 2013 at 12:38 PM
It depends.
SkinnedMeshRenderer is more heavy on CPU (skinning). Doing separate MeshRenderers for each part is more heavy on GPU (drawcall count).
It's a bit hard to say. At least you have to say what is your target hardware. But simple test would tell you more than any theoretical assumptions. Maybe you're game will be bound by fill-rate instead.
Is skinning definitely done on the CPU?
Draw call count is going to be a problem for him if he's going to have 100+ mobs. iOS will not like say 600 draw calls, at least on older devices, even 3G S will baulk.
Yes. I believe Unity on Xbox does skinning on GPU, but the "default" platforms (Win/$$anonymous$$ac/iOS/Android) do skinning on CPU. Usually games do skinning on GPU, but Unity has to support so many varying plaforms (think early iPhones din't have complex shaders at all), so it does it on CPU.
Yes, such drawcall count can be an issue on 3GS.
Having a Transform rotating increases draw calls? I thought draw calls were for materials.
@PauliusLiekis I have decided not to release for 3GS thanks to you :)
Answer by arosellisp · Jan 21, 2013 at 01:37 PM
Considering your target of 100+ meshes on screen (wich is going to be a hard task considering iOS hardware), I would go with the non-rigged characters, using a Mesh Renderer instead of the Skinned Mesh Renderer, as you would be then able to batch them and save some Draw Calls and FillRate.
Still a heavy task to be accomplished.
Yep, I actually made the same comment above at practically the same time - batching will make it work. 100 meshes would be the ceiling I expect for iOS, and if each mob has 4 limbs a body and a head, that's 600 draw calls. Do your own transforms and batch 10 mobs together in a single draw and it could be made to work.
gah! so you say it as well. Skinning increase draw calls? Would regular $$anonymous$$esh Render transformations wont increase draw calls due to batching correct?
Answer by Phong · Nov 06, 2013 at 10:30 PM
I have an asset in the Asset Store "Mesh Baker LOD" which can combine skinned meshes at and MeshRenderer meshes at the same time into a single combined skinned mesh. You can specify how many meshes are allowed at each level of detail. For example imagine a mob of 200 characters with three levels of detail:
LOD0 = 4000 vert skinned mesh, LOD1 = 800 vert skinned mesh, LOD2 = 100 vert MeshRender mesh
You can specify a maximium number of meshes at each level of detail:
5 at LOD0, 10 at LOD1, unlimited at LOD2,
The LOD manager keeps the mob adjusted so that the characters closest to the camera are always the highest poly version. The selected meshes are baked into combined meshes so would only have a few drawcalls. See a video of it here (skinned mesh demo is 6:30 into video):