## Geometry Best Practices for Artists

Overview What is Geometry Triangles and Polygons Usage Level of Detail - LOD Other Best Practices

## Overview

Geometry is a main component when creating a 3D game. To make sure a game runs well on all devices it is essential that the geometry considerations of a game are taken seriously, and optimised as much as possible. This guide highlights geometry optimisations for 3D assets, that can make a game more efficient and achieve the overall goal of getting your game to perform better on mobile platforms.

What you will learn;

• Best practices for geometry targeting mobile devices
• Correct triangle/polygon usage
• Level of detail (LOD) tips and tricks
• Other various best practices

## What is Geometry

Geometry/polygon mesh is a collection of vertices, edges and faces that make up the shape of a 3D object. This can be a car, weapon, environment, character or any sort of asset in a video game.

Vertices - Plural noun for vertex. These are the points that make up the surface of a 3D object.

Edges - Edge is what you get when you connect 2 vertices with straight line.

Triangle - 3 vertices connected to each other by 3 edges then becomes a triangle. This is sometimes also referred to as a polygon or face.

Within 3D software such as Max, Maya or Blender; we usually work using quads (a 4 sided polygon) as they are easier to modify and work with. When rendered on screen all these polygon will be displayed as triangles, so that is why it is the term we are going to use in this guide.

## Triangles and Polygons Usage

Be savvy with number of triangles used

Use the least amount triangles possible (just enough to get the quality required)

• Fewer triangles helps boost performance.
• This should be one of the first things to keep in mind when creating content for a mobile platform.
• This is because fewer triangles mean fewer vertices to be processed by the GPU.
• Processing vertices is expensive, the fewer the number of vertices that get processed the better it is for overall performance.
• Having fewer triangles will enable the release of the game on more devices, not just the latest devices that have the most powerful GPUs.

On mobile platforms, the maximum number of vertices on each mesh is up to 65,535 vertices, so it is advisable to stay below this number.

• This is due to GPU support for 32 bit indices is not guaranteed on all platforms; for example Android devices with Mali-400 GPU do not support them. When we go beyond this number, the mesh will not render.

View/test game on target device instead of PC monitor screen.

• Some of the details that are created (with lots of triangles) might not even be visible on the phone.

Use more triangles on foreground object (closer to camera) and less on background.

• A game with a static camera POV (point of view) will benefit more by implementing this.

There are no hard numbers for maximum triangle count per model, as this depends on many factors.

• An example of this is the number of objects visible at a time in game. Many objects means the need to have a lower triangle count, if there are only 2 or 3 objects at a time we can go higher number. The example below shows characters from two demos. The Circuit VR demo only has 1 robot character, so we can go with a higher polycount, while the Armies demo has hundreds of soldiers in 1 frame so it is clear that it needs to be very low poly.
• The target device also matters. Newer phones such as the newest Samsung Galaxy S series will be able to handle more complex geometry that an older mobile device.

• The target device also matters. Newer phone such as Galaxy S9, S10 will be able to handle more geometry that an S5.

Below is an example number of triangles on our tech demo. This is not meant to be a hard number guidelines as it entirely depends on type of game and target device.

• The Armies demo (64 bit mobile tech demo built in Unity), the camera is static with lots of animated characters. In total, each frame render around  210K triangles and this triangle count enable the demo to run at ~30 FPS stably.

• The largest object in the scene, the cannon tower is ~3000 triangles each as they are occupy big portion of the screen.
• Characters only use around 360 triangles, this is because there are so many of them and they are only going to be seen from a distance. From the users camera POV, they look fine.

### Distribute triangles in areas that matter

Place triangles in areas that matter the most.

• Polygons (vertices) are very expensive on mobile platforms. By placing them in area that really contributes to visual quality of the game, we will not waste processing budget.
• Many small triangle details on a 3D object will not actually be visible on the games final screen, due to combination of a small phone screen size and placement of these 3D objects in the game level. This needs to be taken into consideration when creating details.

Focus on big shapes and forms that contribute to silhouette of the object instead of detail

• Use fewer triangles on the areas that are not seen very often from the camera POV. An example of this would be a bottom of a car or the back of a wardrobe.
• Avoid modelling small details using high density triangle meshes (use textures and normal maps for fine detail)
• The images below show the same mesh with and without normal map.

• Delete the back/bottom part of an object that will never be seen by the camera POV.
• This needs to be done carefully as it might limit re-usability of the scene. For example, if we delete the bottom part of a table mesh as we think it will never be seen by the end user, this mean we can't ever place it upside down.

Micro triangles are very small triangles which do not contribute much to the final scene in terms of the visual of an object/scene.

All 3D objects with many polygon count will have micro triangles problem when they are moved further away from the camera. There is no scientific definition for micro triangles, but it's usually addressed as triangles that smaller than 1-10 pixel in the final image (on phone screen). Micro triangles are bad because the GPU will need to do all the processing on all these triangles while they are not actually contributing much to the final image (as they are too small). Vertices are expensive to process and very small triangles mean a lot more vertices.

Micro triangles can be caused by 2 things

1. Details that are too small and consist of many triangles
2. Objects further from camera with lots of triangles

What to do to mitigate this?

• For an object further from camera use level of detail (LOD). This will reduce complexity of an object, making them simpler and causing them to have less dense triangles.
• Avoid modelling details using many polygons (use textures and normal maps for this type of fine detail).
• Merge vertices/triangles detail that are too small and not contributing much to final image.
• Rule of thumb: Aim to keep triangles above 10 pixels in area.

Why?

• The GPU will need to process all these triangles/vertices while they are not actually contributing much to the final image as they are too small.
• This will also affect memory bandwidth as there is a lot more data that needs to be sent to the GPU.
• On a mobile device all this processing will affect battery life, meaning the end user can't play the game for as long.

### Long thin triangles are bad

These are triangles that when rendered in final image are smaller than 10 pixel and span along the screen. Long thin triangles are bad because it's generally more expensive to process compared with normal (non long thin) triangles.

Example of long thin triangles - bevel on this pillar when viewed from a distance. These bevels are not a problem if seen close up.

What to do to mitigate this?

• Remove long thin triangle on an object if possible. There will be situations where this is not possible but the best solution for this problem is by removing it completely.
• Avoid having shiny material on an object with long thin triangles as this will cause flickering.
• Use LOD and remove long thin triangles when they are further away
• On a more technical side it will be ideal to keep triangle close to equilateral. So it have more inside area and less edges.

• Objects with long thin triangles combined with shiny material will look shimmering/flickering from distance.
• Because the triangle is very thin, when the camera moved slightly it will make the triangle sometimes touch the sampling point and sometimes missed, resulting the fragment sometimes get rendered sometimes not. This will appear flickering in the final image.
• Long thin triangles perform worse compared to bigger triangles in general.

## Level of Detail - LOD

Level of Detail (LOD) is a technique of reducing mesh complexity as objects become more distant from the viewer. LOD not only reduces the number of vertices that need to be processed, it also avoids the micro triangles problem and potentially looks better for objects placed further away in the scene.

Use LOD (whenever possible)

• Focus on the silhouette of the objects for LOD.

• LOD can also apply to shader complexity, optimise shader/material for object that are further away (e.g. by reducing number of texture used)
• Remove more polygon on flatter area
• Use mip map as LOD for texture.

When NOT to use LOD?

On a game where the camera view is static (not moving) and the objects are static as well.

• An example of this is shown below, LOD is not used on the Armies tech demo, where the camera is static so it is a different method of mesh optimisation, such as removing parts that are not visible from the camera.
• On object that is already very simple or it has a very low triangle count.

Why do we need to use LOD?

• As an object goes further from camera we can see less of the detail of that object. Visually, it will be hard to see difference between same object that consists of 200 triangles and another object with 2000 triangles from 20 meters away, so there's little point in having that many triangles that add nothing to the scene.

• This will boost performance as less triangles need to be processed.
• LOD will help mitigate problems caused by micro triangles (explained above).
• LOD will come with a memory overhead meaning a bigger file size. All this LOD mesh data will need to be saved in memory.

### Use appropriate number of triangles on each LOD

• Generally speaking, reducing number of triangles between levels by 50% is a good rule of thumb.

• Do not have very dense triangles on lower LOD (LOD that only going to be only seen when object are further away).
• Test/check the LOD in the way they are meant to be seen at correct distance from camera.  Lower LOD will look bad up close and that's fine as they are not meant to be seen that way.

Why LOD triangle count matters?

• Too little polygon reduction will mean less performance improvement as it will still render similar number of triangles.
• Too much polygon reduction and popping will be more noticeable on LOD switch.

### Reasonable number of LOD level on an object

There is no hard number for how much LOD should an object have. It depends on the size and how important the object is.

• A character in an action game or a car in racing game might have more LOD level than small background objects like a tree.

Why?

• Too few LOD and the effect would be;
• The performance gain will not be worth it (If the polygon reduction is not substantial enough between levels).
• The popping that would happen on LOD switch might be more noticeable.
• Too much LOD will cost CPU workload, as there is processing needed to decide which LOD is going to be displayed.
• These LOD meshes will also cost memory (as we will need to store these extra meshes) meaning bigger a file size.
• The biggest real cost is time needed to create and verify these LOD models (if they are created manually by an artist).

### How to create LOD meshes

• Manually within any 3D software.
• Remove edge loops or number of vertices on a 3D object.
• This gives more control to the artist, but may potentially take a longer time to do.
• Automatically.
• Using modifier inside a 3D package such as ProOptimizer within 3DSMax, or Generate LOD Meshes within Maya.
• Using LOD generation software such as Simplygon, InstaLOD.
• Within game engine. Unreal have automatic LOD generation feature to easily create and apply LOD meshes.

## Other Best Practices for Geometry

Smoothing Groups/Custom Vertex Normal

• Use smoothing groups/custom vertex normal to define the hardness of an edge and alter the look of a model.
• Smoothing group will help to create better shading on very lowpoly art direction.
• Smoothing group affect our UV islands splitting also quality of normal map when we do baking, so extra care need to be taken on this. This will be explained further in the Textures Best Practice (coming soon) section.

• If this is implemented on a 3D model, then it needs to get exported from the 3D software and get imported into the engine.

Mesh topology

• Do have reasonably tidy/clean topology when creating a 3D asset.
• Clean topology is essential for character or other object that are deforming/animated.
• Don't be too obsessed with having perfect topology on a 3D model, it should be tidy to a certain degree, but not all objects need perfect edge flow.
• Player/end user will not see the wireframe of a 3D model
• Mesh will have texture/material applied to it and this will have bigger contribution to the look of a 3D model.

Shape exaggeration

• Make certain part/shape bigger than normal to help readability. This depends on type and style of the game
• A mobile devices screen is small and sometimes it's hard to capture certain shape when they are really small, exaggerating it will help to overcome this.
• For example, make characters have bigger hand to make it easier to be seen.

### What do I do next?

There will be more guides on best practices for artists coming soon!