Exporting hard edges/Smoothing groups in Blender

Discussion in 'Guides' started by Mini, Apr 17, 2014.

  1. Mini Member

    So... I figured something out today and thought I would share.

    [Edit: Hmm, sorry about the smallish sized pics. I thought they would be much bigger]

    In order to shade hard marked edges in Blender you have to use the Edge Split modifier. I prefer to mark my hard edges manually when using this modifier. I un-check the Edge Angle box and check the Sharp Edge box in the edge split modifier panel. This is fine and dandy inside Blender because the software needs this modifier in order to shade the object correctly. However, if you apply this modifier and export the .OBJ file it will split the mesh wherever you have a sharp edge marked, essentially splitting the mesh into many pieces. This is bad because it makes the mesh difficult to work with and has the added bonus of inverting the normals on random split pieces whenever recalculated.

    Being able to mark hard or sharp edges is pretty crucial when you have a small poly limit of 400 Tris to work with. Sure, you can bake hard edges into the normal map but that can be tricky depending on seams. Even the higher poly limit (6k) PS2 helmet creators using Blender are having issues with this problem. So today I found something in the OBJ exporter that seems to keep the mesh welded while preserving the hard edges.

    Keep in mind that if you re-import the OBJ file into Blender you will still need to use the Edge Split modifier to have the object shade correctly. However, its seems the hard edge information is in the OBJ file because it shades properly in a couple of other 3D programs right upon import. I cannot say for sure this will import the same way into Maya but I'm guessing it will.

    Below are some screenshots showing the process.

    This first pic is an exploded view to show how the Edge Split modifier separates the mesh into different shells. The modifier does not actually pull the mesh apart as shown.
    [IMG]

    This next pic shows my typical setup for marking hard edges.
    [IMG]

    In this next screenshot, with the crappy shading, I removed/deleted the Edge Split modifier (If you enter edit mode you will still see the hard marked edges with Blender's default cyan color. They have not been removed). The export options shown on the right side is how I typically export the OBJ's. Today I decided to try checking the smooth groups box without applying the Edge Split modifier.
    [IMG]

    This last pic shows how the model imports, by default, into two other 3D programs (Wings 3D and Rhino 4.0). All vertices are welded(no floating shells) and the hard edge shading is still intact. In Wings 3D you can see how the hardened edges are marked in Wings' default orange.
    [IMG]

    Cheers!
    • Like x 2
  2. HellbatMedia Member

    This is an awesome new option in blender that was added into version 2.69 (finally lol). The "smooth groups" export option creates unlimited smooth groups within the OBJ object which is good but I think Maya and 3ds max (Used by devs at SOE) work with limited smooth groups so you might want to go with "bitflag smooth groups" instead just to be sure. This option also makes the file size a little smaller.
    Also, you dont need to delete the edge split modifier before exporting. You just need to uncheck the "apply modifiers" box in the export options. Another tip is to check "include normals" so they're included in the model when you import into another 3D app, avoiding the whole recalculated normals thing.
    Just as a note, we've been told by TRay to minimize the use of smooth groups on our models because rendering them impacts performance. He said that a little bit of optimization and actually beveling these edges goes a long way.
    Nice guide, Mini. Very informative. :)
  3. Mini Member

    Ooh, good find. I saw the bitflag option there yesterday as well. I hovered over that just a minute ago and it mentions that it limits the smooth groups to a maximum of 32...usually much less. I'll have to play with that option..thanks for the info.


    Yes indeed on the uncheck "apply modifiers. As for the include normals, I usually have that checked on export...guess I forgot in the screenshot.

    In the model shown above, I exported with normals but due to the edge split, the backside always inverts on recalculation. I have no idea why but I've been able to reproduce this with other simple geometry and the edge split modifier applied.
  4. TheHumm Member

    You just solved a problem I been having for weeks. Thanks.
  5. ManMadMaverick Member

    In blender you can go Select/Sharp Edges Ctrl E/ Mark Sharp Edges. Turns hours of work into seconds

Share This Page