Character System for Thakuru Wars
Characters of Thakuru wars is divided into 5 classes, each with their unique in story and appearance. Characters are built in customization in mind, so each body is divided into multiple parts.
Model
Main modeling pipeline is like how any basic model for game being carried out. Games cannot handle higher polycounts, Epic games developed a new mesh streaming system called nanite that is capable of handling high polycount meshes. Unfortunately nanite is not supported for mobile platforms, so modeling is carried out in the legacy method.
Modeling Process
- High Poly model is either sculped or modeled to give the maximum details, This model then later can be used to bake normal maps (this process is in more details in texturing)
- Low Poly model is then created using the high poly model with Decimate process or Retopology, depending on the method used to make the high poly model
- Decimate (Un-subdivide) - Faster method, that reduce the polycount by the power of 2, Most 3D software has the feature however the model should be fully quads and loops should be divisible by 2 for it to work properly
- Retopology - Retopology is a process of creating a Low-poly model out of a sculped model. This method is often slow but more accurate.
- Once low-Poly model is created, it can be UV mapped to export for the engine.
Model Setup
Since Characters of Thakuru wars has customization, the model should be divided into multiple parts.
- Hair
- Facial Hair
- Body
- Legs
- Each Mesh is exported separately as a skeletal mesh
- This is later then combined together using MasterPoseComponent, More on this on a later article
Rigging
Rigging is a process of skinning the character into a Skeleton, so Unreal engine can read the animations and move the specific bones its meant to move.
- Unreal engine reads animation data using bones.
- Mesh is moved alongside the bones using weights on vertex groups
- Each Vertex group should match the names of the bones for it to work.
- In weight paint editor shows how much weight its influencing the current selected vertex group, 1 and 0 visually shows Red > Yellow > Green > Turquoise > Blue (Blender), This differs based on the software you use.
- With this method Unreal engine will pick up any kind of mesh big or small, as long as the skeletal hierarchy remains the same (The bone names and Hierarchy should remain the same).
- This method is repeated with different parts of the mesh to match the whole body
Facial Expressions
- Facial Expression is brought using Shape Keys
- Each Shape keys has a value of 0 and 1, that moves certain vertices to different positions
- Combined all shape keys and animation creates multiple expressions
LODs (level of Detail)
Level of detail or LODs are a powerful method to reduce the GPU cost of the scene by reducing the overall polycount of an object based on the amount of screen the object is covering at the time, with a cost of additional memory.
- Number of LODs determine how much LOD reduction there can be in the model, the more the LODs, the more reduced the object be in a distance. But for each LOD, unreal engine creates a reduced mesh in memory, so advice to keep LODs to an optimal level to save memory space and additional disk space.
- For Skeletal meshes, you can create a LOD data asset that share controls an overall setting than to setup LODs on each individual mesh.
- LOD data asset contains mainly the control the percent of triangles to reduce on a set screen size. This process can be automated too but it does not often yield good results.
- Morph target only works properly on LOD 0 or base LOD, there is an option to remap, (there a chance there will be artifacts when morph targets are remapped)
- In Thakuru wars, we use LOD 0 for menu and LOD 1 for in-game, however this method is not forced so if camera comes close enough the LOD will switch.
Texture system
- Textures are what brings the color to the mesh, it is also where the memory cost is the highest. there are some special treatment given to textures of Thakuru wars to reduce the memory cost and compress to reduce the size of the overall game.
- Unreal reads textures parameters as RGBA (Red, Green, Blue, Alpha). GPU read these as Vector 4 parameters.
- Other than colors, Textures also brings other physical properties like, Roughness, Normals, Emissive, Metallic, Ambient occlusion, each texture for each property will be costly so each can be compressed into multiple parts of the textures. For example, Metallic parameter can be Red and Roughness can be Green.
- Other than Normal and Color, Character system in Thakuru wars uses 2 Mask textures
- Mask 1 Contains (Red - Ambient occlusion, Green - Roughness, Blue - Metallic)
- Mask 2 Contains (Red - Emissive, Green - Subsurface Scattering, Blue - Skin Mask, Alpha - Cloth Mask)
- For hair there is only one mask with (Red - Ambient Occlusion , Green - Hair Mask, Blue - Cloth Mask)
Normal map
- Normals are the direction perpendicular to the surface
- Normal map textures gives control on the direction pointing on each pixel of the surface of the mesh. It contain X Y and Z position of the particular normal direction. this gives a fake surface for shading.
- Normal map can also be baked from a high poly model to a low poly model so it looks as if its a high poly model, this works to some extent. Thakuru wars use this method to get the mesh close to the high poly model look.
- Normal map is also the most costly map as it require pinpoint accuracy and less compression, so most mobile games rely on more polycount than bigger normal maps
Texture Sizes and Compression
- The best method to reduce the file size and memory size is the reduce the size of the textures.
- For compression and texture reduction to work properly the texture should be in the power of 2. 64, 128, 512, 1024, 2048, 4096.
- Using the power of 2 Engine creates multiple Level of details reduced by the power of 2 called Mips. Mips are then calculate based on the distance the texture is drawn from the screen. This is called Texture streaming. (this works very similar to LODs). This saves the overall GPU memory cost in the scene however this increase the disk size.
- User has an option to not to calculate Mips for textures that mostly sits on screen like UI.
- The easiest method to reduce is to reduce the resolution, this reduce the amount of Mips and overall size of the texture.
- Compress Without Alpha makes it so the texture ignore alpha channel completely.
- Thakuru wars uses maximum 1024 resolution maps with handpicked compression quality, this reduced texture maps that cost 42mb to just 10.5mb.
- More detail on texture compression can be found here
Materials
- Above is a material graph used for the body of Thakuru
- Material is what gives function and physical properties of the mesh. and it utilized the textures to render the colors.
- Material is where all the limitation of Mobile phone becomes a big problem.
- Thakuru wars uses .4 amount of emissive to give a bright look. as skylight alone yield bad result for a stylized game.
- Thakuru wars use fully rough material eliminate the use of reflection entirely and uses fake reflections saving the GPU cost
Workarounds
Some are very straightforward, here are some in character we had to make some workarounds for things to work properly
Custom UVs
- Panner nodes moves the texture to a specific direction, but these calculation on pixel side even though is simple, mobile GPU find it hard to handle. after sometime the texture gets pixelated. Instead its better to pan the UV map instead of the texture itself. that solves from fractal side instead of pixel side.
Fake Subsurface Skin
- Sub Surface Scattering is one of the major properties of the skin, when light enters the skin it scatters to multiple direction giving a soft look on the skin, You can see this when you hold a flashlight through your fingers.
- This method works on PC games but for mobile phones its not yet supported. so physical method cannot be created for mobile phone instead we can give a fake Subsurface look by mixing toon shader and regular shading.
- Current toon effect is created by clamping atmospheric light vector (directional light shading) to give a toon like soft shading. this is then added with regular shading to give a softer look on the character.
Eye Material
One of my proudest work 🙂
- Basic iris is caved inside the eye, we could model the eye twice and use glass material to create an eye. but glass material is very expensive to render.
- Custom reflection vector gives a depth to the texture making it appear a bit deeper than the surface its rendering, mostly used to make Ice material. It can be mask with iris to give a depth effect to the iris. This method also be used to give a fake reflection by combining with Fresnel node.
Conclusion
The character system of Thakuru wars is created using some basic and some advanced method, and is fully optimized to use for mobile multiplayer game. the procedure go as follows.
- High Poly Model
- Low Poly Model
- UV mapping
- Texturing
- Rigging
- Morph Target Setup
- LOD setup
- Material Production
This method is very different to the character system first used by Thakuru wars, and is still in development on this day of writing this article. and hope to release the updated character system in the future update.