USEFUL PERFORMANCE TIPS

Puppet2d is very light, and there are some great ways to use it that make it even lighter in terms of performance. 

 

Based on 4 areas here are some optimization tips and explanations. The 4 areas are CPU running scripts, CPU draw calls, GPU skinning, Runtime Memory.

 

1. CPU Running Scripts

 

The scripts running on the controls executed through the global control will take up a little in the CPU. To reduce this you have the option to bake animations onto the bones allowing you to remove any runtime puppet2d scripts. Although, this will add to the runtime memory as there will be more keyframes on the bones.

 

If you are working with skinned FFD meshes with many control points you may see a real saving on CPU by baking the animation as each skinned FFD control has a runtime script associated to it.

 

2. CPU draw calls

 

There are 3 ways to use puppet2d and this will change how much of an issue this may be:

 

a) parent sprites to bones

 

this is the most optimised way of using puppet2d as all the sprites will batch together into a single draw call

 

b) skin a mesh

 

if you skin the mesh to bones you will need to use the combine meshes checkbox to make the character 1 draw call. If you want to batch multiple characters together take a look at this script: http://wiki.unity3d.com/index.php?title=SkinnedMeshCombiner

( you'll need to make it work for your game in terms of instantiating and destroying the characters .)

 

c) FFD mesh

 

Same as above, only there may be a lot more bones so be mindful of that when creating your FFD mesh (each control is a bone)

 

3. GPU skinning

 

a) parent sprites to bones

 

there is very low GPU cost

 

b) skin a mesh

 

The more bones you skin to the larger the impact here. Also the number bones you skin to in the quality settings will affect performance. Setting it to 1 bone will give the bed performance but may not give such nice results as there will be no blending. 2 bones is the best in most cases - only go for 4 bones if you need really subtle deformations across multiple bones.

 

c) FFD mesh

 

When you first create an FFD mesh each vertex gets skinned to a single bone, so you can set it 1 bone skinning and it will work nicely. The only issue is if you want to embed another mesh into that FFD you will need it to have quality settings of 4 - it would be best to avoid doing this for low end devices.

 

4. Runtime Memory

 

The more keyframes you do the more memory your animations will consume. Watch out for this if you choose to bake the animations, or if you have very long animations.

© 2013 by Jamie Niman. 

This site was designed with the
.com
website builder. Create your website today.
Start Now