Difference between revisions of "Beveling"
Professor420 (talk | contribs) |
Professor420 (talk | contribs) |
||
Line 1: | Line 1: | ||
+ | You can find an up to date version of this tutorial at http://robg3d.com/beveling.html | ||
+ | |||
There is information floating around, especially of recent, about never having hard edges (except in certain cases), and instead, bevel everything. The information here is not from my own investigations, but merely what I've heard, checked, and had confirmed. | There is information floating around, especially of recent, about never having hard edges (except in certain cases), and instead, bevel everything. The information here is not from my own investigations, but merely what I've heard, checked, and had confirmed. | ||
Line 41: | Line 43: | ||
The conclusion here isn't really to try to get one to achieve pure mathematical efficiency and plan out your UV's according to where your hard normals would be (though this isn't a bad idea if you can manage it, since hard normals will hide seams). It is just so that you are aware of the math behind beveling and broken vertices. Use this knowledge well. | The conclusion here isn't really to try to get one to achieve pure mathematical efficiency and plan out your UV's according to where your hard normals would be (though this isn't a bad idea if you can manage it, since hard normals will hide seams). It is just so that you are aware of the math behind beveling and broken vertices. Use this knowledge well. | ||
+ | You can find an up to date version of this tutorial at http://robg3d.com/beveling.html | ||
[[Category:3D Modelling]] | [[Category:3D Modelling]] |
Revision as of 11:16, 2 February 2008
You can find an up to date version of this tutorial at http://robg3d.com/beveling.html
There is information floating around, especially of recent, about never having hard edges (except in certain cases), and instead, bevel everything. The information here is not from my own investigations, but merely what I've heard, checked, and had confirmed.
Contents
How Real-Time Rendering Works
In order to understand beveling, you have to understand a bit of the 3D pipeline. As far as this article is concerned, rendering- whether through old-school fixed-function pipelines or now via shaders- is concerned mostly with vertices. It is easiest to understand if we think about a simple shader. A shader, at the minimum, will input a UV coordinate, a position (in object space), and a normal vector. It will run all its rendering calculations based on those inputs.
However, we run into two interesting scenarios; the same vertex may have two (or more) UV coordinates (such as if it lays on a seam), or two (or more) normals (if it has hard normals, separate smoothing groups, etc), even though it is, in your modeling program, the same vertex. This means, even though your modeling application tells you it is one vertex, it is actually multiple vertices.
With this in mind, let's go back to what I said about vertices as all that matters. "Polygons" are irrelevant. Polygons are simply a nice way to approximate a vertex budget and appearance; as we will see later, they do a poor job of actually describing vertex count.
Should I Bevel Everything?
Well, no. In many or most cases, beveling will have exactly the same cost as a hard edge. However, your poly count will increase by two for each beveled edge... suddenly we go from a 12 faced cube, to a 44 faced cube (try it out). And your vertex count will increase as well. But what we have to worry about is not what our modelling program tells us about vertex count, but how the GPU treats vertices.
A vertex is broken or split when it has a hard normal, or new UV coordinate. Let us take the cube again. We select all vertices, and we get 8 vertices. However, if this cube has hard normals (no smoothing groups), we have 24 vertices! Each vertex is broken for each coincident face. Smooth normals do not break the vertex, so a box with one smoothing group will have a vertex count of 8 (well... not really but let's say it does, for now).
What has how much?
So, to recap:
- Hard Cube in Software: 12 faces, 8 vertices
- Hard Cube in Game: 12 faces, 24 vertices
- Soft Cube in Software: 12 faces, 8 vertices
- Soft Cube in Game: 12 faces, 8 vertices
However, the soft cube looks like crap, because soft normals at a 90 degree angle distort things far too much. Beveling, however, splits this 90 degree transition between two angles, for two (close to) 45 degree transitions, that look infinitely better than the soft cube, and, when lit correctly, far better than the hard edge (since now its edge will catch highlights, which is very important).
- Soft Beveled (Chamfered) Cube in Software: 44 faces, 24 vertices
- Soft Beveled Cube in Game: 44 faces, 24 vertices
As I stated earlier, its only vertex count that is really important, and the vertex count between the hard cube and soft chamfered cube is identical, but the latter looks much better. So, always bevel, right!
Wrong.
Vertices break at discontinuous UV's as well. So, where you have a break in UV's, you can have a hard edge, and you won't increase your vertex count, since they are breaking anyway.
Epitome of Efficiency
Let us consider the most simple example, a cube, with no top or bottom. We apply a Cylindrical UV Map with its UV border at Edge 1 (vertices 1 and 2, let's say).
So, what is the best arrangement? We should bevel edges 2, 3, and 4. Edge 1, since it is broken for the UV's, we can leave Hard.
Tri-Stripping
This is a whole subject into and of itself. It is often times cheaper to add geometry in order to achieve optimal triangulation and vertex count. However, this requires a more full exploration and experimentation, and it is usually out of the realm of anyone lacking the direction of a technical artist or strong graphics programmer. It is related to the idea of beveling, in achieving a maximal appearance/efficiency tradeoff, and the idea of vertex counts (and order) as important. When I have better information, I will post another article.
Conclusion
The conclusion here isn't really to try to get one to achieve pure mathematical efficiency and plan out your UV's according to where your hard normals would be (though this isn't a bad idea if you can manage it, since hard normals will hide seams). It is just so that you are aware of the math behind beveling and broken vertices. Use this knowledge well.
You can find an up to date version of this tutorial at http://robg3d.com/beveling.html