This page covers in general the many areas of optimisation of an object.
Suitable Modelling & UV Mapping
When modelling objects it is vital to ensure that we pay attention to the silhouette of the building as this is noticed most greatly. With this mind we should make sure that we have used geometry and UV appropriately. Geometry should be greatly simplified out of view.
The key priority is the view whilst driving the car, although care should be taken to ensure suitable geometry is in place for TV cameras too.
UV and Material use should follow a similar pattern. There is no need to assign huge parts of texture space to not visible areas (unless it is mapped in a way that it uses parts used elsewhere of course).
Reducing Draw Calls
The first step is to ensure we are keeping draw calls as low as possible. The number of draw calls at it's most simple is defined by the number of materials in an object. So to reduce this careful attention needs to be paid to the number of materials in an object
The first thing is to texture atlas as much as possible in order to reduce the number of materials. With PBR metallic and non metallic materials can be atlased together, helping with this. However the following issues are still likely to require different materials:
- Different Transparency Settings - Objects which require transparency should be isolated onto their own materials.
- Different Shader Requirements - If you need to use different shaders, then obviously we don't need them to share textures.
- Different UV Requirements - Some objects may require the use of tiling textures. If only tiled in one direction this may not cause an issue, however if all directions are required this can prevent or restrain atlasing many different materials together.
- Decal Object Requirements - If we require a separate decal object, then it makes no sense for the object to use the same material as surface that are not decaled.
Object Grouping and Draw Distances
It is very important to group the same or similar objects placed close together and set Draw Distances (LOD Out in exporter) accordingly. Especially when they share materials.
However it is also important to take into account the trade off between the detail of the object and how long it is visible for. Simple objects using the same material but visible for long distances should definitely be grouped together more often for example.
The Draw Distance values should be set based on how far that object should be visible when driving the car. The TV cameras have separate multipliers to keep objects visible for longer.
Additionally it is worth noting that Draw Distances in the gMotor Plugins are from the centre point of the object.
Below are some general tips to adhere too though.
- We probably do not want too many objects bigger than around 15k tris or in the region of 3mb file size, although it maybe necessary. We should certainly keep file sizes beneath 10mb / 50k tris.
- We probably want to group objects so that they cover approximately 25-33% of the Draw Distance if that does not contravene the size limitations.
- We may need to split object groups up for different situations. (For example only show some spectators in different sessions, or show different number of parked vehicles depending on detail settings)
Reducing Alpha Overdraw
Briefly alpha overdraw is the issue of transparent pixels being rendered on top of each other over and over causing a degradation in performance. To reduce the cost of this we should ensure that the polygon structure matches the texture as closely as possible.
For example treelines can be created using profiles which cut down to the edge of where the non transparent parts of the texture extend to. Trees can have their remit reduced so their UV adjusted so that they do not use any unnecessary transparent pixels, although the potentials here are limited by the need for them to be a square quad. Similar techniques should be employed for any other meshes which have large parts transparent.
LOD Meshes and Detail Meshes
LOD and Detail Meshes should be used on high definition meshes which are rendered far off into the distance.
LOD Meshes are completely swapping out the geometry of the high poly object for a lower detail object as it gets furher into the distance. At Le Mans this has been used on Armco and Tyre Stacks to reduce the number of tris rendered, and allow for higher poly LOD0 meshes. See this page for more details.
When to use a LOD Mesh is a difficult question. The following guidelines are some good rough rules to stick to:
- The LOD0 mesh should be "large". Probably megabytes in size.
- The LOD should have around at most half the tri count of the mesh it is replacing.
- It should be visible for at least double if not more the distance before it was switched in. For example if it switches in at 200m, we would want it to be visible for until at least 400m.
- Finally the amount of screen space it occupies has also at least halved.
- Although there will obviously be exceptions to these rules.
Detail Meshes are splitting out the object into separate objects, and giving different parts shorter Draw Distances. This is a common practice on grandstands and other objects where seats and fences may not need to be visible from the distance. Although this can require careful fine tuning.
If you are unfamiliar with the concepts discussed here, background reading on the majority of them can be found here: