Patrick
| Author | Comment | ||
|---|---|---|---|
tuxtax |
Hard Edges vs Edges? |
Lead | |
|
(07/01/09 14:26:56) |
I posted earlier about making a *.wings command line importer to convert *.wings to a different mesh format, specifically one supporting vertex colors. During
the process I've been reading through old source code samples written in Perl and Python, but one thing also confused me, the notion of hard edges. How are
these so called "hard edges" used instead of just the winged edge data structure. It seems like winged edges are sufficient to describe the mesh
topology. Could anyone please explain to me what they are, and how to handle them in an importer/exporter (generally speaking).
Patrick |
||
deerwood |
Re: Hard Edges vs Edges? | ||
|
(07/01/09 18:09:02) |
Hi tuxtax again. Hard edges mainly are used to mark edges that shall preserve the angles between the 2 faces left/right of the "hard" edge extactly/as good as possible, when subdividing/smoothing. Look at this image:
Gotten from 4 cubes. In the BG the original cubes, in the FG after smoothing (Catmull-Clark) 3 times. To the left without hard edges, to the right with some hard edges. Wings also uses hard edges as a "natural/default" indication of edges to use as "cut" edges when UV mapping. Note, that there were recent changes to Wings (in 1.1.4 I believe) where the hard edges are also used in the *.obj export to construct "smoothing groups" and optimized in 1.1.5 to only produce a minmal set of such groups. And there is a recent thread with hints, how Blender can be instructed to make use of that new feature (sorry, too lazy now to look that thread up). Note also, for subdividing, there are other (prefered/better?) ways to keep edges rather hard, but more organic: e.g. instead of marking the edges of the cubes top face hard, bevel these 4 edges by a small amount and then subdivide and compare. You'll notice, that the "bullet" top face essentially looks like with hard edges, but that the subdivided mesh is different and the former "hard" edges ain't "sharp" any more, but rounded and respond to lighting. Finally, the hard edges are just normal edges (as of the winged edge data structure) with an additional attribute/marker, that they are to be considered hard. This is so, because hard edges are very uncommon in most objects and storing this attribute for every edge, where most of them ain't hard, would waste space a lot. HTH |
||
tuxtax |
|||
|
(07/02/09 12:32:53) |
Deerwood,
Thank you for the very informative explanation! For my purposes (rendering), hard edges aren't useful to have. |
||
Ran13 |
|||
|
(07/03/09 05:43:50) |
For my purposes (rendering), hard edges aren't useful to have. Wha??? Hard edges (and smoothing groups in other apps) are used to tell the renderer which vertex normals are averaged together (smooth shading) or require multiple vertex normal vectors (for smoothing "breaks"). Essentially, all vertices that comprise a "hard" edge have multiple vertex normals... one value for each "side" of the hard edge. |
||
deerwood |
|||
|
(07/03/09 16:04:49) |
Yes, Ran13 is right, I forgot to mention this. To show even in Wings and with a "bullet" as in the image above press TAB for the OGL smooth shading; then set all hard edges to soft and compare the smooth display. Besides, as we have it about hard edges here: another use of hard edges in Wings is to use them as a visual accumulator for very complicated edge selections (e.g. preparing cuts for UV mapping).
I know, this also can be done with the selection system (Add to/Subtract from Group etc.), but I had cases, where the visual feedback helped to spot errors much more easily. Best regards |
||
tuxtax |
|||
|
(07/06/09 12:18:02) |
Let me explain what I mean by "not useful to me." I am using low-poly models of items and such for a game, not for rendering photorealistic images.
While the calculations of normals may be useful, it can possibly done offline, and as of now, I don't think any of the models being used have hard edges
(which is why I've never heard of it in Wings3D), so the normals follow directly from the geometry of the models themselves. Most of the (static) lighting
is done via lightmaps anyways, or simple modulation with [0-1] uniform intensity value calculated dynamically.
Patrick |
||
Ran13 |
|||
|
(07/06/09 12:40:45) |
I am using low-poly models of items and such for a game That makes them doubly useful. There's a reason that 3dsmax's smoothing groups are a well-worn staple of low poly game models. When doing hi-res stuff, hard edges are usually replaced my small bevels to "hold" the shape, ... pic, 1000 words...
on the left, hard edges, on the right "micro bevels". While the bevels look better visually, the hard edges allow the poly count to be much lower, and still shade properly. If the object on the left was being used as a game model, the standard gouraud shading would be pretty nasty as the renderer tries to smooth (re: average the normals) across those 90° angles. The smoothing "breaks" offered by splitting the vertex normals will help the renderer figure out the proper shading. This is why most game engines created in the last 10 years or so have support for smoothing groups built into their 3dsmax exporters. |
||