4
\$\begingroup\$

Many games facilitate better performance by increasing/decreasing the number of triangles/polygons that are drawn, depending on how close the camera is to said object. Mountains, viewed from far away, could become literally flat. Models would steadily lose resolution as you walk further away from them, etc.

If I want to implement such a system, how many different permutations of the same model/models should I have? Suppose the model is 20,000 triangles when viewed up close, but then I halve that when the camera goes away, so now it is 10,000. Then again, when the camera is even further away, making it 5,000 triangles. Would three versions be enough? Or is this really just an arbitrary implementation? Does it depend on the game itself?

\$\endgroup\$
  • 2
    \$\begingroup\$ I'd expect something like this depends on a lot of factors. The best you can do is profile and adjust your implementation if the profiling shows that it's not performing as you want it to. You can also make it configurable to the user, making it up to them to decide if they want details or consistent updates. \$\endgroup\$ – bornander Apr 9 '15 at 7:56
  • \$\begingroup\$ At least one; any more is just gravy. \$\endgroup\$ – ratchet freak Apr 9 '15 at 8:05
  • \$\begingroup\$ Some game engines can simplify models automatically. \$\endgroup\$ – Philipp Apr 9 '15 at 14:38
  • \$\begingroup\$ Neat example of dynamic mesh simplification from Wolfire Games' Overgrowth. \$\endgroup\$ – Anko Apr 15 '15 at 10:02
1
\$\begingroup\$

Research the new-ish tessellation stages.

LOD and complex curved surfaces are both easy to implement with a hull shader.

LOD example:
A terrain, composed of 2 triangles, can be subdivided and the tessellation factor simultaneously used to select the appropriate mip for the displacement map. In this way, peaks of mountains would retain their height, but reduce to pyramid-like shapes. Tessellating more creates more, smaller, triangles and selects a higher displacement mip; the terrain becomes more accurate, on demand.

Curve/Spline/Bezeir/NURBS
If you tessellate a cube, then normalize all of the vertices, you've made a sphere. The more you tessellate, the more accurate the sphere. The same approach can be applied to model geometry by utilizing the curve primitives within your favorite modeling software, rather than permanently baking the tessellation into multiple copies of the same model.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Good samples to get started - In SimpleBezier, change MIN_DIVS define to 1 to be able to see raw input patch. Other one uses an awful mesh, but still gets the point across. \$\endgroup\$ – Jon Apr 10 '15 at 3:14
2
\$\begingroup\$

This technique is called LOD (Level of Detail). Look it up and you will easily find several references on the internet.

How many levels of detail you use is completely up to you. It depends heavily on the camera's point of view, how many objects are within your viewport at the same time, and how many are so far away they are just barely visible.

Using this you should be able to decide how many levels of detail you require and how much reduction in polygons/triangles you need to have for each model to reach a decent polycount for your renderer at any possible camera point in your game.

|improve this answer|||||
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.