Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
February 17, 2020
arrowPress Releases







If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

A modern asset pipeline: 7 reasons to optimize content

by Samuel Rantaeskola on 06/15/15 05:44:00 pm   Expert Blogs   Featured Blogs

2 comments Share on Twitter    RSS

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

Find the previous post in this series here: A modern asset pipeline: Introduction.

The reasons to why and how to optimize content differs a lot from case to case, depending on asset complexity, platform, game engine, viewing distances etc. I will give you a brief overview of a number of reasons why optimizing content is a good idea if you want to keep your game running smoothly.

Reducing over shading

img4.png

Small polygons are not utilizing the hardware efficiently. In order to get maximum performance out of the hardware the recommendations from many vendors is that triangles rendered should be at least 16 pixels in size. Sliver triangles are not recommended, because they have long edges but small contributing areas.

Here we have two triangles, and a few pixels on a screen. The pixels are organized on the hardware into 2x2 quads, and all pixel processing is done on the quads.

When shading, a pixel will be drawn if the triangles overlaps the center position of the pixel.

img6.png

However, most GPUs have even wider SIMD units. In this example we would need 16 pixels to utilize the hardware most efficiently. In the case to the right the triangle only covers small portions of each unit.

Since pixel processing is done per quad, we have to disable some of the edge pixels, and output results only from the covered pixels.

 

img5.pngThis is a bigger issue with smaller triangles. You can see in the example images that the left triangle has really bad usage, but the triangle on the right have much better usage, even though it is only a bit larger.


In short, highly tesselated objects are more expensive to render. Here is a video that hihglights the difference in cost of rendering. The mesh to the left contains a large number of triangles while the object to the right contains fewer and larger polygons.

Example techniques to reduce over shading are:

  • Use LOD’s to replace highly tessellated objects as they are further away from the viewing position.

Reducing data per frame

Even though you have a lot memory at disposal in today’s consoles the data transfer bandwidth limits how much you can use per frame. Realistically you cannot count on using much more than 100GB/s in a PS4 or Xbox One. Which means that if you are running a game at 60FPS the amount of data you can render to screen per frame is around 1.6GB. When this becomes the bottleneck you optimize content so that you don’t send unnecessary data to the GPU.

Example techniques to reduce data per frame are:

  • Use LOD’s to avoid having to send vertex intense objects to the renderer.
  • Use mip-mapping to send lower resolution textures to the renderer
  • Pre-process objects to remove internal geometry that cannot be viewed from the distance.

Reducing draw calls

One of the most common bottle necks in game development today is the number of draw calls per frame. Modern GPUs are very fast at processing vertex and polygon data, but the cost of starting a new batch is significant. Hence it’s a good idea to optimize content so that the number of draw calls per frame are reduced. Each new material and object is likely to generate a new draw call, depending on engine architecture.

Example techniques to reduce draw calls are:

  • Merging objects so that they can be drawn in one draw call. This is especially applicable when building games using modular building pieces.
  • Merging textures for several objects so that they exist in one texture atlas and can be drawn in one draw call.
  • Simplifying shaders so that a more generic one can be used to render objects when they are far away.

Reducing animation cost

In games where you have a lot of animated objects animation cost may become a bottle neck. This is especially true if you are using procedural animations, for example physics-driven, you would prefer not to calculate things that aren’t visible from the viewing position.

Example techniques to reduce animation cost are:

  • Using LOD’s to remove skin weights when the object is far away and only making calculations for the larger bones. Removing vertices will make the skinning cheaper to calculate as well.
  • Replacing the head with a very simply skinned one to not have to do facial animations at a distance.

Reducing vertex transformations

Assets are usually created around the origin and then placed in the world. Each frame vertices for the each asset has to be transformed into world space. Each operation is quite cheap, but when you do this a million times per frame it adds up to a significant cost. Reducing the number of vertices that are drawn every frame will decrease the cost to render.

Example techniques to reduce transformation cost are:

  • Burning in the world positions for static when baking the world. This will reduce the amount of transformations needed, but it will also consume memory if you have assets that are used in many places.
  • Using LOD’s to reduce the amount of vertices that needs to be transformed for far away objects.

Reducing overdraw

img7.png

Overdraw is covering a pixel multiple times, with overlaying triangles.

Most engines use a Z-pre pass to fill in the Z-buffer beforehand and reject layers behind the first layer.

However, this is ineffective on meshes with multiple layers of triangles that are really close. The reason is that the Z-pre pass uses hi-z early rejection, but it is coarse and cannot reject surfaces close to the nearest surface.

Transparent surfaces are also a huge time sink as every pixel behind the surface will have to be drawn at least twice.

Example techniques to reduce overdraw cost are:

  • Using LOD’s can alleviate this by only keeping the outer visible surface of the mesh.
  • Removing transparent surfaces by burning in the background on the object when it’s far away.

Reducing shading cost

For example, the skin shader is typically one of the most expensive in games with characters. There are a lot traits of skin that makes it expensive to simulate in a natural way. As a character gets further away a lot of those traits would not be noticeable. Hence it’s a good idea to use a cheaper shader at a distance.

Example techniques to reduce shading cost are:

  • Merging materials so that a more generic and cheap shader can be used when an object is further away.
  • Baking procedural textures and blend networks in to static textures.

In the next post in this series we will look into some stats regarding optimization.

How much time is spent optimizing?


Related Jobs

None
None —

None





Loading Comments

loader image