Vertex Normal

Game artists can manually alter the vertex normals to change the way an in-game mesh is lit, how it renders a reflection, how the fresnel falloff looks, etc. Basically any lighting effect that uses vertex normals can be tweaked by changing the model's vertex normals.

Some game engines do not import edited vertex normals. For example UDK has been updated to support custom vertex normals via FBX, but your game engine may not support it.

What Is a Vertex Normal?

See the MSDN article Face and Vertex Normal Vectors.

Model Seams

Game models are often cut apart into different segments, for example to allow a player to customize their character by swapping out different clothing models.

When a contiguous mesh is cut apart, the vertex normals along the edge usually change. Vertex normals are usually calculated automatically by the modeling software, to average out the local surface curvature. However this causes a shading seam along the cut, because the two models now have different vertex normals along their shared edge.

To help hide this artifact, the seams between the pieces are usually cut along natural seams, like the belt line, shoulders, neck, wrists. This doesn't hide all of the seams though.

Bent vertex normals can be used to hide these seams completely, by manually averaging the two models' edges together.

Foliage Shading

Foliage meshes in game are usually made using flat planes with a transparent texture containing a bunch of leaves (or grass blades). These textures are used instead of modeling each leaf or blade of grass discretely, because they would slow the framerate too much. Also the increased vertex count uses much more memory.

Flat planes generally do not shade very well when lit. To counteract this, the vertex normals can be bent to influence the shading, helping to hide the flatness of the geometry.

Create the backfacing polygons manually, before editing the vertex normals. If you let a game engine create backfaces automatically, the engine has to generate new polygons so it has to figure out where the new normals will point, resetting them all in the process. If you want to import edited vertex normals, you must explicitly create the backfaces yourself.

TreeMakerScript_plus_NormalThiefScript.gif

Foliage shading is improved by bending the vertex normals. The model in Max 2010 format (textures copyright SpeedTree).
Image by Eric Chadwick

Tree_Normals.gif

A comparison of different flat geometry types, with and without bent normals.
Top row uses "crossing planes", bottom row uses "tri planes".
Left to right: wireframe, default normals, "global" normals using Normal Thief, and clump-based normals.
Image by Eric Chadwick

tree_shading_examples.jpg

Foliage shading examples compared, with and without VertexColor.
Image by Eric Chadwick

  • {i} Note: This technique only works in a game engine that supports edited vertex normals. You have to test your asset pipeline to see.

Editing Normals in 3ds Max

Vertex normals can be manually bent in 3ds Max by using the Edit Normals modifier. See the 3ds Max 2011 online help.

Edited vertex normals are somewhat fragile in 3ds Max, they can be lost easily:

Vertex normals can also be modified by using Smoothing Groups, as long as the normals have not been edited by the Edit Normals modifier beforehand. See the tutorial Smoothing Groups in 3ds Max by Ben 'poopinmymouth' Mathis.

Slide Normal Thief MAXScript

SlideNormalThief by the studio Slide London is a 3ds Max MAXScript tool that projects vertex normals from one model to another, automating what would otherwise be a tedious manual process.

SlideNormalThief_UI.png

Interface for the SlideNormalThief MAXScript.
Script by Slide London

The script is based on a much-slower script called NormalThief.ms written by Mauricio B. Gehling.

The Reference Object is the model you wish to copy vertex normals from, and the Target Object is the model that will get its normals bent to match. The two models should be superimposed on one another, the normals on the Target will be bent to match the nearest normals on the Reference. This is similar to the way NormalMap projection works, the copying is based off location in 3D space. The vertex counts of the two models don't need to match, but both models need to have an Edit Normals modifier applied.

AverageNormal MAXScript

AverageNormal by Mathieu 'zOffTy' Jacquin is a 3ds Max MAXScript tool that averages all the vertex normals for the selected faces, so they all point the same direction.

GetVertNormalsFromFace MAXScript

GetVertNormalsFromFace by Enrico 'SyncViewS' Gullotti is a 3ds Max MAXScript tool that aligns all the vertex normals for the selected faces so they point perpendicular to their polygons. In other words, the same direction as the face normal would be facing. This is similar to the mig Normal Tools option "Fillet Outside".

Once installed the script will be under the category Normal Tools, named Get Vert Normals from Faces. It works on Editable Poly objects only, and that must be the active modifier in the modifier stack. If an Edit Normals Modifier is not present, the script will add one right above Editable Poly. It should not mess with Smoothing Groups at all.

Go into Face sub-object level, make a face selection and run the script. Every time a normal is modified by the script, it is made Explicit to retain the modifications. At the end the script will switch back to the base Editable Poly modifier and re-enter Face sub-object level (even if other modifiers are present in the stack). If you want to revert back to the original default normals, add an Edit Normals Modifier and reset the normals.

See the Polycount forum thread Editing vertex normals in Max, got scripts?.

Exporting Edited Normals

Edited vertex normals can be exported from 3ds Max with some file formats:

File Format

Supports Edited Normals?

Notes

3DS

no

ASE

yes

enable "Mesh Normals"

CGF (CryEngine)

?

Collada

no

FBX

yes

enable "Split per-vertex normals" (may change the vertex count)

OBJ

yes

enable "Normals"

PSK (Unreal Engine)

no

supports smoothing groups, but only by duplicating vertices

WRL (VRML)

no

Editing Normals in Maya

Vertex normals can be adjusted in Maya by using the Normals tools in the Polygons menu (Maya 2011 online help).

Vertex normals can also be baked from one model to another by using Transfer Attributes.

maya_transferattributes.jpg

"Transfer Attributes" in Maya can be used to copy vertex normals from a dome to a tree.
Select the dome, then the tree, then choose Mesh > Transfer Attributes, and enable only Vertex Normals.
Image by 'callebo'

mig Normal Tools

The mig Normal Tools is a collection of MEL scripts for editing vertex normals in Maya.

migNormalToolsUI.png

Interface for the mig Normals Tools MEL scripts.
Scripts by Migugi

FaceNRMtoVert

"passerby" wrote a melscript that does a similar function as the GetVertNormalsFromFace maxscript.

   1 global proc FaceNRMtoVert() {
   2 
   3 
   4     string $Fs[] = `filterExpand -sm 34`;
   5     select -cl;
   6     for ($F in $Fs) {
   7         select -r $F;
   8         string $normals[] = `polyInfo -faceNormals`;
   9         string $buffer[];
  10         tokenize $normals[0] $buffer;
  11         
  12         float $plane[3];
  13         $plane[0] = $buffer[2];
  14         $plane[1] = $buffer[3];
  15         $plane[2] = $buffer[4];  
  16         PolySelectConvert 3;
  17         polyNormalPerVertex -xyz $plane[0] $plane[1] $plane[2];
  18         }
  19 }
  20 

For more info see the Polycount forum thread GetVertNormalsFromFace script for maya.

Editing Normals in Modo

chai_bentnormals.jpg

Baking normals in modo, using the pipelineIO plugin.
Image by Ariel Chai

Normal Mapping

Vertex normals have a strong influence on tangent-space normal maps. Some game engines require a bit more geometry near areas that have a lot of change in angle (hard corners, etc.) otherwise the vertex normals fight with the normal map and create shading errors. Careful topology can minimize or avoid these errors altogether.


CategoryCharacterModeling CategoryEnvironmentModeling CategoryTextureTechnique CategoryEnvironmentFoliage

VertexNormal (last edited 2013-09-20 06:51:40 by EricChadwick)