Vertex Normals

Vertex normals are used to define how in-game dynamic lighting affects each vertex of a model.  A vertex's normal can be thought of as an imaginary line extending out from the vertex that defines which way the vertex is facing for the purposes of lighting calculations.  Vertex normals cannot be directly edited in Blender (to the best of my knowledge), but are affected by Blender's mesh shading mode as well as the edgesplit modifier (blender.org).

Image of vertex normals as displayed in Blender's 3d view

Viewing Vertex Normals in Blender

Vertex normals may be viewed in Blender's 3D view window by turning on the Draw VNormals option in the Mesh Tools More or Mesh Tools 1 panel of Blender's editing buttons (f9):

Important Note:

The vertex normals displayed in Blender's 3d view always correspond to the smooth shaded mode.  Vertex normals as drawn on the screen in Blender are not affected by the shading mode. The lighting in Blender is affected by the shading mode, and the exported vertex normals are affected as well.  Blender hides the creation of redundant vertices behind-the-scenes, so you won't see each vertex having multiple normals when the Draw VNormals option is enabled.

Smooth vs Sold Shading

For triangles that share vertices, shading is naturally smooth on OpenGL or DirectX based hardware because the shared vertices can only contain a single vertex normal. When the solid shading mode is enabled for faces in Blender, the exporter achieves the desired shading in the standard way; by duplicating the vertices along the edges of non-coplanar solid shaded faces. Unfortunately, Blender's default shading mode for new meshes is "Solid", meaning that you'll get redundant vertices and faceted looking lighting unless you set your meshes to "Smooth".

For organic or rounded shapes, smooth shading tends to look much better, and exports with fewer redundant vertices. For boxy or faceted shapes, solid shading tends to look better.


Solid vs Smooth shading on different object types
Smooth Shading Solid Shading
Organic shapes

Image of a smooth shaded organic shape

No redundant vertices generated and lighting looks good (crappy mesh aside :-)

Faceted appearance, tons of redundant vertices

Faceted shapes Image of a faceted shape with smooth shading on all faces
No redundant vertices generated, but lighting doesn't look quite right
Image of a solid shaded faceted shape
Lighting looks right, but some redundant vertices are generated

When used judiciously, the performance and memory effects of the redundant vertices generated by solid shading (aka - hard edges) is fairly negligible. Solid shading is generally only turned on for an entire mesh when that mesh is fairly low-poly. The exporter also performs an optimization in which it looks at the face normals of adjoining faces to see if a vertex really needs to be duplicated with a new normal; shared vertices are not duplicated if two adjoining faces lie on the same plane.

Setting Smooth Shading on Meshes or Faces

  1. Select the desired mesh in object mode
  2. Click the Set Smooth button under the Link and Materials panel of the editing buttons (F9):
    Image of the Set Smooth Button in the Link and Materials panel of the editing buttons
    The selected mesh object is now smooth shaded.

Individual polygons may also be set as smooth or solid shaded by selecting them in edit mode and using the same "Set Smooth" and "Set Solid" buttons.

Setting Solid Shading on Meshes or Faces

  1. Select the desired mesh in object mode
  2. Click the Set Solid button under the Link and Materials panel of the editing buttons (F9):
    Image of the Set Solid Button in the Link and Materials panel of the editing buttons
    The selected mesh object now solid shaded.

Individual polygons may also be set as smooth or solid shaded by selecting them in edit mode and using the same "Set Smooth" and "Set Solid" buttons.

Using the Edgesplit Modifier to set individual edges as solid shaded

Solid shaded edges (aka - hard edges) can be created through use of Blender's EdgeSplit modifier. The Blender DTS exporter now supports all Blender mesh modifiers.

The edgesplit modifier works by duplicating the vertices along an affected edge. This is the same method that the exporter uses to handle solid shading on faces.

Information on how to use Blender's edge split modifier can be found here:
http://wiki.blender.org/index.php/Manual/EdgeSplit_Modifier

Note:

  • The exporter is unable to automatically apply modifiers to Skinned Meshes due to a limitation in Blender's Python API. Modifiers on skinned meshes must be applied by hand prior to export if you wish for them to take effect.

See also: