Thursday, October 23, 2008

Optimization for a 3D model

Two things that video game artist should do. The first one. All 3D model have hidden polygons. I mean polygons that no one can see them. It’s important to remove all of them, because for each one, the 3D engine has to do operations. With less hidden polygons to compute, less operations faster the engine runs. Just below you have an example of hidden polygons:

Base of the house

You can see in the image above the structure of a house seen from the base. We remove the base polygon because, surely, the house is going to be over a terrain, and nobody will see the base polygon. This trick can be done in many places of a model obtaining this way an optimization.

The technical specifications of a graphics cards say that they can compute millions of polygons per seconds. It really means triangles per second. The triangle is the basic calculation of geometry of any polygon. The polygon we removed before, was formed by four vertex, which means at least two triangles. Although we only see a polygon, the graphic engine computes two triangles. If we have more than four vertex the number of triangles grow.

With lots of polygons, these are lots of calculations for the engine. Bad thing. To reduce the number of triangles is something difficult. But we can do the calculation work easier for the engine, and here comes the second thing that should have been done by an artist. For a graphic engine it’s very expensive to compute long triangles -for example a long base and a short hight-. These kind of triangles can be avoided by using the tool ‘Turn’ of 3D Studio Max.

The tool 'Turn'

This tool shows you all hidden triangles and allows you to choose the best hypotenuse of the triangles, turning the hypotenuse in all possible ways with different vertex. The hypotenuse is drawn with a dotted line. The tool is very useful specially when you cut over a polygon, because this operation generates new triangles that you don’t see and could affect the efficiency.

Walls of the house

Then, here you have one more reason to remove hidden polygons. Because you aren’t leaving a polygon, you’re leaving at least two triangles that we didn’t think were there.

No comments: