Hi all !
I have a question about vertices.
When I the this picture (from Unity best practices) :
The left one was what I see from many of you, with more vertices (center one) than mine (right one).
So, I know that I'm wrong, but I have less vertices ...
Why would you do like the first one ?
Thank you !
Replies
I will learn to avoid this.
Some good reading over here:
FAQ: Game art optimisation (do polygon counts really matter?)
It shouldn't be a problem for subdivision modeling, when you place triangles on a planar surface.
[ame]https://www.youtube.com/watch?v=k_S1INdEmdI[/ame]
More here
http://wiki.polycount.com/wiki/Subdivision_Surface_Modeling
This, thin triangles suck and contribute a lot to pixel shader overdraw :<
Are you implying that that are no problems with shading issues on low-poly models what-so-ever if triangles lie on the same plane? Just want to cross that off my list of things to worry about if i can.
As a necessary step, a GPU will process triangles in a way that is efficient when rendering the interior of triangles, but not so efficient when rendering the edges of triangles.
Therefore, if you wish to optimise the rendering of a model by means of its triangulation, you can avoid forming long thin triangles (also called slivers), which are triangles with very small angles in one or more vertices.
With some shapes or details in your model you can't help but use long thin triangles, but when you do have the opportunity to use wider triangles, it can improve the rendering efficiency of that model.
For you, as a 3D artist, there's the following.
If you have a flat area in a model and you're wondering what is the most optimised way to triangulate it (which vertices to connect to each other), you can triangulate it in a progressive manner: first form the biggest AND the "most equilateral" triangle that you can in that area, then do the same with the remaining vertices until the area is fully triangulated.
See the image below for an example, from the left with the least optimised triangulation to the right with the most optimised one (meaning, the fastest to render):
Note that this is just an optimisation. Models that weren't triangulated with care can still work. The point is that in some cases there are more optimised triangulations to be used. You can see performance data in reference [1].
The technical reason for why this happens is that the GPU works in 2x2 pixel blocks when rendering a triangle; it does so as a mathematical optimisation, in order to select a mipmap level and be able to do texture filtering.
This behaviour wastes around 25% ~ 75% of the shading processing in the triangle edges, since the edges don't cover all of the pixels in the 2x2 blocks but all the pixels in these blocks are processed anyway. See [2] for more information.
- The most optimised triangle to have in a model is an equilateral triangle.
- When you tesselate an area, it slightly increases not only the cost in polygon count but also the cost in pixel shading (even though the covered area is the same), because of the additional triangle edges that were introduced.
- There may be other reasons to avoid long thin triangles, such as artefacts with lighting (caused by problems with normals) and animation, but you can tell when these problems happen because they are visible and not abstract like the above.
References:
[1] http://www.humus.name/index.php?page=News&ID=228
[2] https://fgiesen.wordpress.com/2011/07/10/a-trip-through-the-graphics-pipeline-2011-part-8/ (In section "You need to go wider!")
[3] https://fgiesen.wordpress.com/2011/07/06/a-trip-through-the-graphics-pipeline-2011-part-6/#comment-3739
[4] http://stackoverflow.com/a/3678009