Difference between revisions of "HowTo:Bevel"
m (→Introduction: fixed a link) |
|||
(11 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
===Introduction=== | ===Introduction=== | ||
− | This tutorial, out of necessity, is a bit of a mix of topics. Make sure you read the smoothing groups tutorial first, though. | + | This tutorial, out of necessity, is a bit of a mix of topics. Make sure you read the [[HowTo:Smooth_Groups|smoothing groups]] tutorial first, though. |
Some of the instructions are Blender-specific hotkeys, but the main idea applies no matter what tools you use. | Some of the instructions are Blender-specific hotkeys, but the main idea applies no matter what tools you use. | ||
There are some fundamental things we need to understand, to make good models: | There are some fundamental things we need to understand, to make good models: | ||
− | a) Flat-shading doubles the amount of vertices to process in the gpu (videocard). It does not mean that you should "never" use flat-shading, but it does mean you need to think about where and when to use it. The multiplication of vertex data occurs in the video card (GPU), not in the file, so you may think you have a low poly count, and feel falsely reassured; but the vertex count that is actually processed may be astronomical, if you flat-shade everything. Essentially, each tri will have its own vertices!... no sharing at all!!! | + | a) Flat-shading more than doubles the amount of vertices to process in the gpu (videocard). It does not mean that you should "never" use flat-shading, but it does mean you need to think about where and when to use it. The multiplication of vertex data occurs in the video card (GPU), not in the file, so you may think you have a low poly count, and feel falsely reassured; but the vertex count that is actually processed may be astronomical, if you flat-shade everything. Essentially, each tri will have its own 3 vertices!... no sharing at all!!! |
− | b) You can achieve flat-shaded look while actually using smooth shading, by "spitting the smooth groups". This doubles the vertices at the edges of each smooth groups surface, increasing your vertex count in the mesh file; but it is much less costly than flat-shading the whole surface. | + | b) You can achieve a flat-shaded look while actually using smooth shading, by "spitting the smooth groups". This doubles (splits) the vertices at the edges of each smooth groups surface, slightly increasing your vertex count in the mesh file; but it is much less costly, in real vertex count processed in the gpu, than flat-shading the whole surface. |
− | c) In smooth shading, the video card interpolates normals, and this may cause unwanted effects; but the unwanted effects can be solved with extra cuts, which add to the geometry, but cost far less than flat-shading | + | c) In smooth shading, the video card interpolates normals, and this may cause unwanted effects; but the unwanted effects can be solved with extra cuts, which, again, add a bit to the geometry in the file, but cost far less (in real performance) than flat-shading. |
===In more detail=== | ===In more detail=== | ||
Line 18: | Line 18: | ||
b) How to split smooth groups: | b) How to split smooth groups: | ||
Start by smooth-shading: In Blender, press A to select all faces, W->Set Smooth. Now, surfaces at an angle should look really weird... | Start by smooth-shading: In Blender, press A to select all faces, W->Set Smooth. Now, surfaces at an angle should look really weird... | ||
− | A again to un-select everything. Now select all faces (manually) that should be part of a continuum without sharp edges, press Y, for split, and answer 'yes'. Bingo! This should be done for all continuous surfaces, no matter whether they are curvy or flat, so as to avoid the multiplication of vertices in the gpu. | + | Press A again to un-select everything. Now select all faces (manually) that should be part of a continuum without sharp edges within, but with a sharp boundary; press Y, for split, and answer 'yes'. Bingo! This should be done for all continuous surfaces, no matter whether they are curvy or flat, so as to avoid the multiplication of vertices in the gpu. |
− | Check out the SES model, for example: Select any face and press Ctrl-L to see the extents of the split group it belongs to. Here's the current file: | + | Check out the SES model, for example: Select any face and press Ctrl-L to see the extents of the split group it belongs to. Here's the current (as of this writing) file: |
http://deeplayer.com/dan_w/NewMod/SES/fullbody14.blend | http://deeplayer.com/dan_w/NewMod/SES/fullbody14.blend | ||
Back to a) for a moment: You might wonder, then: when should one use flat shading? Primarily for any single-poly surface. Small cube boxes, for example, you'd gain nothing from flat-shading and splitting the sides, because you'd be generating as many vertices, manually, as the gpu would generate, anyhow. Any surface that's more than a single quad, though, should be flat-shaded. In the SES, for example, if you look at the buildings on top of the military section, some of them have an L shape; they have a smooth-shaded and split roof; with flat-shaded, non-spit sides --since the sides are a single quad each. | Back to a) for a moment: You might wonder, then: when should one use flat shading? Primarily for any single-poly surface. Small cube boxes, for example, you'd gain nothing from flat-shading and splitting the sides, because you'd be generating as many vertices, manually, as the gpu would generate, anyhow. Any surface that's more than a single quad, though, should be flat-shaded. In the SES, for example, if you look at the buildings on top of the military section, some of them have an L shape; they have a smooth-shaded and split roof; with flat-shaded, non-spit sides --since the sides are a single quad each. | ||
− | c) The artifacts of smooth-shading | + | c) The artifacts of smooth-shading (and here we tackle beveling, the subject of the title of this tutorial) ... |
You have to understand how smooth-shading normals are generated, and how they affect the way polygons are shaded. | You have to understand how smooth-shading normals are generated, and how they affect the way polygons are shaded. | ||
First of all, the face normals Blender shows you are only good for flat-shaded surfaces. Smooth-shaded surfaces work on the basis of vertex normals. You want to show those, instead, to understand smooth shading phenomena. | First of all, the face normals Blender shows you are only good for flat-shaded surfaces. Smooth-shaded surfaces work on the basis of vertex normals. You want to show those, instead, to understand smooth shading phenomena. | ||
Line 51: | Line 51: | ||
− | What's happening is that the videocard interpolates, --across entire surfaces--, the vertex normals at the edges. In the case on the left, the small, slanted strip in the middle gets "flat-shaded", because the normals at either side of it are parallel!!! And the bigger surfaces to the left and right, which we intended to look flat, are actually shaded across, because the normals at the edges are NOT parallel, and so get interpolated across. The beveled corner on the right gets smooth shaded properly, as its normas at either side are at | + | What's happening is that the vertex normals are computed by averaging the face normals connected to that vertex. Then the videocard interpolates, --across entire surfaces--, the vertex normals at the edges. |
+ | |||
+ | In the case on the left, the small, slanted strip in the middle gets "flat-shaded", because the normals at either side of it are parallel!!! And the bigger surfaces to the left and right, which we intended to look flat, are actually shaded across, because the normals at the edges are NOT parallel, and so get interpolated across. | ||
+ | |||
+ | The beveled corner on the right gets smooth shaded properly, as its normas at either side are at at an angle; but the big flat surfaces connecting to it look rounded, which wasn't our intention :-/ | ||
What to do? | What to do? | ||
Line 67: | Line 71: | ||
− | What happened is that when we made that middle cut, we | + | Much better; isn't it? |
+ | |||
+ | What happened is that when we made that middle cut, we caused new vertex normals to appear. Vertex normals are generated by averaging the vertex's neighboring face normals. The neighboring faces of those vertexes formed by the middle cut are parallel and slanted, so the new normals are at the exact angle we wanted at the middle of the bevel. | ||
+ | |||
It's still not perfect, though; as the flat faces on the sides still don't look flat. To fix that, we add two more cuts: | It's still not perfect, though; as the flat faces on the sides still don't look flat. To fix that, we add two more cuts: | ||
Line 98: | Line 105: | ||
My lighting setup is less than ideal, but you get my drift. | My lighting setup is less than ideal, but you get my drift. | ||
+ | NOTE: This is absolutely NOT the same thing as doing a recursive beveling. | ||
+ | In a recursive beveling, the first bevel strips next to the flat faces are | ||
+ | NOT co-planar with them; and this will cause the big surfaces to still look | ||
+ | non-flat, the way normals are interpolated in the GPU. | ||
+ | This technique which I (chuck_starchaser) discovered, or invented, calls | ||
+ | for ***co-planar*** thin strips bordering large, flat faces. So you do this | ||
+ | by cutting close to the (non-recursive) bevels, or rounded corners. | ||
===Actual model example=== | ===Actual model example=== | ||
Line 182: | Line 196: | ||
Of course, I'm making assumptions about Kangaroo's intended look, which assumptions aren't necessarily correct; but just to show what things are possible. But one thing to remember is, even with the extra cuts, the new columns produce a much lower count of vertices to process in the GPU. | Of course, I'm making assumptions about Kangaroo's intended look, which assumptions aren't necessarily correct; but just to show what things are possible. But one thing to remember is, even with the extra cuts, the new columns produce a much lower count of vertices to process in the GPU. | ||
+ | |||
+ | |||
+ | NOTE: Before someone points this out to me, there's something really wrong in the transformer's top slab or beam, on the left side. Probably some inverted normals. I hadn't noticed it, and I'm too lazy to produce new images now, so, to hell with it... ;-) | ||
Line 187: | Line 204: | ||
--chuck_starchaser | --chuck_starchaser | ||
+ | |||
+ | |||
+ | [[Category:HowTos|Bevel]] | ||
+ | [[Category:Modeling|Bevel]] | ||
+ | [[Category:Blender|Bevel]] |
Latest revision as of 23:18, 5 January 2013
Contents
Introduction
This tutorial, out of necessity, is a bit of a mix of topics. Make sure you read the smoothing groups tutorial first, though. Some of the instructions are Blender-specific hotkeys, but the main idea applies no matter what tools you use.
There are some fundamental things we need to understand, to make good models:
a) Flat-shading more than doubles the amount of vertices to process in the gpu (videocard). It does not mean that you should "never" use flat-shading, but it does mean you need to think about where and when to use it. The multiplication of vertex data occurs in the video card (GPU), not in the file, so you may think you have a low poly count, and feel falsely reassured; but the vertex count that is actually processed may be astronomical, if you flat-shade everything. Essentially, each tri will have its own 3 vertices!... no sharing at all!!!
b) You can achieve a flat-shaded look while actually using smooth shading, by "spitting the smooth groups". This doubles (splits) the vertices at the edges of each smooth groups surface, slightly increasing your vertex count in the mesh file; but it is much less costly, in real vertex count processed in the gpu, than flat-shading the whole surface.
c) In smooth shading, the video card interpolates normals, and this may cause unwanted effects; but the unwanted effects can be solved with extra cuts, which, again, add a bit to the geometry in the file, but cost far less (in real performance) than flat-shading.
In more detail
a) When you designate surfaces as flat-shaded, all polygon vertices are split *in the video card*. A flat surface with 100 quads, --i.e. 200 triangles--, will generate like 6 times as many vertices to process (in the videocard), if you 'Set Solid' it, as compared to 'Set Smooth' (in Blender parlance). Thus, by default, one should try to smooth-shade everything; then split smooth groups as necessary.
b) How to split smooth groups: Start by smooth-shading: In Blender, press A to select all faces, W->Set Smooth. Now, surfaces at an angle should look really weird... Press A again to un-select everything. Now select all faces (manually) that should be part of a continuum without sharp edges within, but with a sharp boundary; press Y, for split, and answer 'yes'. Bingo! This should be done for all continuous surfaces, no matter whether they are curvy or flat, so as to avoid the multiplication of vertices in the gpu.
Check out the SES model, for example: Select any face and press Ctrl-L to see the extents of the split group it belongs to. Here's the current (as of this writing) file: http://deeplayer.com/dan_w/NewMod/SES/fullbody14.blend
Back to a) for a moment: You might wonder, then: when should one use flat shading? Primarily for any single-poly surface. Small cube boxes, for example, you'd gain nothing from flat-shading and splitting the sides, because you'd be generating as many vertices, manually, as the gpu would generate, anyhow. Any surface that's more than a single quad, though, should be flat-shaded. In the SES, for example, if you look at the buildings on top of the military section, some of them have an L shape; they have a smooth-shaded and split roof; with flat-shaded, non-spit sides --since the sides are a single quad each.
c) The artifacts of smooth-shading (and here we tackle beveling, the subject of the title of this tutorial) ... You have to understand how smooth-shading normals are generated, and how they affect the way polygons are shaded. First of all, the face normals Blender shows you are only good for flat-shaded surfaces. Smooth-shaded surfaces work on the basis of vertex normals. You want to show those, instead, to understand smooth shading phenomena. Typically, the problems show when trying to bevel edges, or more generally, when trying to combine curved and flat areas. Let me illustrate two typical cases...
Typical beveling and flat/curved combo cases
Here's a case of an S-curve in a flat plane (left) and a beveled corner (right). This first pic using flat shading, to understand the intent:
If we select all faces as they are, and smooth-shade them, it looks horrible:
Why?
We'll get a better understanding of what's going on by looking at the vertex normals:
What's happening is that the vertex normals are computed by averaging the face normals connected to that vertex. Then the videocard interpolates, --across entire surfaces--, the vertex normals at the edges.
In the case on the left, the small, slanted strip in the middle gets "flat-shaded", because the normals at either side of it are parallel!!! And the bigger surfaces to the left and right, which we intended to look flat, are actually shaded across, because the normals at the edges are NOT parallel, and so get interpolated across.
The beveled corner on the right gets smooth shaded properly, as its normas at either side are at at an angle; but the big flat surfaces connecting to it look rounded, which wasn't our intention :-/
What to do?
First let's make a new cut through the middle of the slanted strip on the left:
See what happens?
Much better; isn't it?
What happened is that when we made that middle cut, we caused new vertex normals to appear. Vertex normals are generated by averaging the vertex's neighboring face normals. The neighboring faces of those vertexes formed by the middle cut are parallel and slanted, so the new normals are at the exact angle we wanted at the middle of the bevel.
It's still not perfect, though; as the flat faces on the sides still don't look flat. To fix that, we add two more cuts:
Notice that now the flat surfaces are surrounded by 4 parallel normals each. And the result...
Those flat surfaces finally do look flat, don't they?
Now let's fix the bevelled corner case:
As we said earlier, the actual bevel strip is properly smoothed, so a cut in the middle is not necessary, in this case. The only problem that needs fixing is the curvy look of those flat surfaces. We only need extra cuts on both sides of the bevel, like ...
And the result:
My lighting setup is less than ideal, but you get my drift.
NOTE: This is absolutely NOT the same thing as doing a recursive beveling. In a recursive beveling, the first bevel strips next to the flat faces are NOT co-planar with them; and this will cause the big surfaces to still look non-flat, the way normals are interpolated in the GPU. This technique which I (chuck_starchaser) discovered, or invented, calls for ***co-planar*** thin strips bordering large, flat faces. So you do this by cutting close to the (non-recursive) bevels, or rounded corners.
Actual model example
Let's try now with an actual model; --Kangaroo's port-split's "transformer":
Most of it, if not all, is flat-shaded.
If we try to smooth-shade it as-is, this is what happens:
Actually, it doesn't look as bad as it would in-game, because Blender's renderer won't smooth-shade between surfaces at angles sharper than 80 degrees; but the videocard will.
So, I do smooth group splits, as well as flat-shade (back) the simpler boxes and greebles (with single quad or tri surfaces) and things begin to improve, though it's hard to notice a difference for the reason just stated, about Blender's renderer...
The big surfaces look rounded, which is not what's intended.
Let's look at the normals:
Actually; the vertex normals in the highlighted section were corrupted, --always pointed inwards, even after Flip Normals--, and only by introducing a cut (at the bottom) I was able to fix them. Anyways, I'll add more cuts now, on the sides of the bevels... like this:
And the result:
Bingo! Bevels look rounded; flat areas look flat.
Actually, object mode view is better than renderings to appreciate shading, because, instead of fancy raytracing formulas, it uses Open GL, --i.e.: The videocard's own smoothing:
Summary
Another way of summarizing this whole idea is: For a smooth-shaded surface to look flat, all polygons connected to it must be co-planar with it. If they form any angle at all with it, normal interpolation in the videocard will make the big surface look rounded. So the trick is to add cuts at the edges of big flat surfaces such as to form thin but co-planar strips which force the roundness towards the intended areas.
In the case of S-shaped curves, a surface whose normals on both sides are parallel needs to be split down the middle, to generate a representative set of vertex normals where they count.
One more example:
For another example, if I include the columns...
They look pretty good because Kangaroo painstakingly split smooth groups for all rings, basically... I highlight some of them to show you, by clicking one facet in each of 3 rings and pressing Ctrl-L:
Now I'll merge (remove duplicates) a lot of the vertexes and add some extra cuts:
And the result:
Of course, I'm making assumptions about Kangaroo's intended look, which assumptions aren't necessarily correct; but just to show what things are possible. But one thing to remember is, even with the extra cuts, the new columns produce a much lower count of vertices to process in the GPU.
NOTE: Before someone points this out to me, there's something really wrong in the transformer's top slab or beam, on the left side. Probably some inverted normals. I hadn't noticed it, and I'm too lazy to produce new images now, so, to hell with it... ;-)
Cheers!
--chuck_starchaser