Unity implementation of GPU skinning (animation instancing). Targeting on mobile devives (es3) specifically, but is compatible with other platform. Developed on Unity2019.1.
- Create a new 3D project in Unity Hub
- Switch platform to Android in Build Settings
- Switch quality level to Medium in Project Settings/Quality. Modify shadow distance to a larger value as you need
- Import GPUSkinning.unitypackage via Asset/Import Package/Custom Package
- You will encounter a compile error. If you don't need MeshSimplifier provided by this project, just delete /Assets/Editor/MeshSimplifier.cs. Otherwise, please add "com.whinarn.unitymeshsimplifier": "https://github.com/Whinarn/UnityMeshSimplifier.git" to /Packages/manifest.json
- Open /Assets/Scenes/ExampleScene and play the game
- The basic control is similar to PUBG Mobile. Use the left stick to navigate. Slide anywhere else on the screen to view.
- Some UI toggles are on the screen for controlling the game behaviour.
The "Crowd" object in the example scene is the core component that matters, you can begin exploring the project from here
- Expand the Crowd object and you will see 3 LODs. You can change the mesh of each of them.
- All meshes should share the same skeleton as specified in the Animator component of the Crowd object
- If your mesh has a different skeleton or avatar, please retarget it. Otherwise you should generate a new prefab
- In the detail panel of the Crowd object, change the mesh list in the WeaponManager component
- The weapon will be bound to the bone specified in GPUSkinRenderer component
- In the detail panel of the Crowd object, change the animation list in the CrowdManager component
- Right click on the object and choose GPUSkinning/Bake Animation
- All animations should share the same skeleton as specified in the Animator component of the Crowd object
- If you want to use a new skeleton or avatar, please retarget your animations. A better way is to generate a new prefab
- Place your object with SkinnedMeshRenderer in the scene (if it is a prefab, please unpack it first)
- If you want to use the weapon system, please remove the built-in weapon
- Right click on the object and choose GPUSkinning/Generate Prefab
- In the detail panel
- Specify a Controller and an Avatar to Animator
- Adjust the size of Capsule Collider if needed
- Specify a list of animations to CrowdManager
- Specify a list of LODs to GPUSkinRenderer. Every LOD should be assigned with an LOD child under the object
- Add a behaviour script to control the crowd behaviour. The implementation used in demo is CrowdBehaviour.cs. You can refer to it to design your own
- If you want to use the weapon system, specify a list of weapon meshes and a weapon material to WeaponManager, and specify a weapon bone to GPUSkinRenderer
- Right click on the object and choose GPUSkinning/Bake Animation