Difference between revisions of "VertexNormal"

From polycount
Jump to: navigation, search
(CategoryEnvironmentFoliage)
(3ds Max: colors)
(44 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<!-- ## page was renamed from Vertex Normal -->
+
Vertex normals are invisible lines pointing out of a 3D model's surface, at each vertex. The game compares these normals against a light's direction. If the light is directly facing a normal, the surface is brightest there. When a normal is facing away from a light, the surface doesn't get lit by it.
= 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. Any lighting effect that uses vertex normals can be tweaked by changing the model's vertex normals.
  
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. Check your engine's documentation, or try a quick test.
 
+
Some game engines do not import edited vertex normals. For example UDK has been updated to support [http://udn.epicgames.com/Three/ContentBlog.html#Explicit%20Normal%20Support custom vertex normals via FBX], but your game engine may not support it.
+
  
 
== What Is a Vertex Normal? ==
 
== What Is a Vertex Normal? ==
See the MSDN article [http://msdn.microsoft.com/en-us/library/bb324491%28VS.85%29.aspx Face and Vertex Normal Vectors].
+
[https://web.archive.org/web/20150716000012/http://frostsoft.blogspot.com/2012/01/what-are-vertex-normals.html FrostSoft: WHAT ARE VERTEX NORMALS (VNT documentation)]
 +
 
 +
[[image:FrostSoft_doc-3.png|left|frame|Image by [https://web.archive.org/web/20150716000012/http://frostsoft.blogspot.com/2012/01/what-are-vertex-normals.html FrostSoft].]]<br clear="all"/>
  
 
== Model Seams ==
 
== Model Seams ==
Line 19: Line 19:
 
Bent vertex normals can be used to hide these seams completely, by manually averaging the two models' edges together.  
 
Bent vertex normals can be used to hide these seams completely, by manually averaging the two models' edges together.  
  
== Foliage Shading ==
+
== Smoother Shading ==
Foliage meshes in game are usually made using flat planes with a [[Opacity Map|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.
+
See [[Face weighted normals]].
  
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.
+
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. <br>From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]<br>Image by [http://deadlineproof.com/ Paolo Oliverio]]]
  
{| border="1" cellpadding="2" cellspacing="0"
+
== Normal Mapping ==
|-
+
Vertex normals have a strong influence on tangent-space [[Normal map]]s. 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 [http://polycount.com/discussion/68173 fight with the normal map] and create shading errors. Careful [[Topology]] can minimize or avoid these errors altogether.
|}
+
  
{| border="1" cellpadding="2" cellspacing="0"
+
== Editing Normals ==
 +
 
 +
=== 3ds Max ===
 +
Vertex normals can be manually bent in 3ds Max by using the Edit Normals modifier. See the [http://docs.autodesk.com/3DSMAX/13/ENU/Autodesk%203ds%20Max%202011%20Help/files/WSf742dab04106313366400bf6112a1cea097-7f65.htm 3ds Max 2011 online help].
 +
 
 +
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 [[Smoothing_Groups#Tutorials|Smoothing Groups Tutorial]] by [http://poopinmymouth.com Ben "poopinmymouth" Mathis].
 +
 
 +
Edited vertex normals are somewhat fragile in 3ds Max, they can be lost easily:
 +
* <span style="color:green">If you use Editable Poly, activate Attach, and attach another model, the vertex normals will be kept. <span style="color:orange">However Editable Mesh - Attach will reset the normals.
 +
* <span style="color:green">If you Attach multiple meshes together, make sure each has at least one edited normal. <span style="color:orange">Meshes without edited normals will have their vertex normals jumbled.
 +
* <span style="color:green">If you Attach models that have been rotated, make sure to use Reset Xforms on them first. <span style="color:orange">Attaching a rotated model to another will skew all its edited normals.
 +
* <span style="color:orange">If you use Detach to make a new Object, the detached object's vertex normals will be reset.
 +
* <span style="color:orange">If you use Detach to create a new Element in the same object, the detached element's vertex normals will be reset.
 +
* <span style="color:green">If you add an Edit Normals modifier and make the normals Explicit, then go below it in the modifier stack and Detach as an Element, the normals will be preserved. This works with Editable Mesh, Edit Mesh, Editable Poly, and Edit Poly.
 +
 
 +
=== Exporting Edited Normals ===
 +
Edited vertex normals can be exported from 3ds Max with some file formats:
 +
 
 +
{| border="1"
 +
|  '''File Format'''
 +
|  '''Supports Edited Normals?'''
 +
|-
 +
| 3DS
 +
|style="color:red;"| no
 +
|-
 +
| ASE
 +
|style="color:green;"| yes
 +
|-
 +
|  CGF (CryEngine)
 +
|style="color:yellow;"| ?
 +
|-
 +
| DAE (Collada)
 +
|style="color:green;"| yes
 +
|-
 +
| FBX
 +
|style="color:green;"| yes
 +
|-
 +
| OBJ
 +
|style="color:green;"| yes
 +
|-
 +
| PSK (Unreal Engine)
 +
|style="color:red;"| no
 
|-
 
|-
 +
| WRL (VRML)
 +
|style="color:red;"| no
 
|}
 
|}
  
{| border="1" cellpadding="2" cellspacing="0"
+
 
 +
=== 3ds Max Tools ===
 +
These are in order by date, older tools towards the bottom.
 +
 
 +
 
 +
==== Normal Tools (WallWorm) ====
 +
2017
 +
 
 +
[http://dev.wallworm.com/topic/68/normal_tools.html Normal Tools] by [http://shawnolson.net/ Shawn Olson] is a set of tools integrated into the existing Edit Normals modifier as a new rollout. [http://polycount.com/discussion/138523/normal-tools-for-max-released Normal Tools for Max Released] Polycount Forum thread.
 +
 
 +
{| border="1"
 +
|[[image:normaltools.png]]
 
|-
 
|-
 +
|Normal Tools interface in 3ds Max 2017.
 
|}
 
|}
  
* [http://wypierpapier.blogspot.com/2010/02/vertex-normal-tutorial.html Vertex Normal tutorial] by [http://wypierpapier.blogspot.com/ 'gutekfiutek']<<BR>> This is a blog post in Polish that explains in pictures how vertex normals can be used for better foliage shading ([http://translate.googleusercontent.com/translate_c?hl=en&ie=UTF-8&sl=pl&tl=en&u=http://wypierpapier.blogspot.com/2010/02/vertex-normal-tutorial.html&prev=_t&rurl=translate.google.com&twu=1&usg=ALkJrhiAwMTQRdRZ8uQcN3n4w1XypaFsVQ translation by Google here]). He used this technique to great effect in his [http://wypierpapier.blogspot.com/2010/03/polished-landscapes-m-mod.html Polished Landscapes Mod] for Mount & Blade.
 
  
 +
==== Face Weighted Normals MAXScript ====
 +
2015
  
<pre><nowiki>#!wiki green/solid
+
[[file:Modeling_FaceWeightedNormals.ms.zip|Face Weighted Normals]] by [http://www.juantwo.com/ Juan 'monster' Martinez] is a 3ds Max MAXScript tool that selectively aligns the vertex normals for the largest polygons on a mesh. This means the smaller polygons act as the transition areas because usually the smaller polygons are thin bevels.  
{i} Note: This technique only works in a game engine that supports edited vertex normals. You have to test your asset pipeline to see.
+
</nowiki></pre>
+
  
 +
See the Polycount Forum thread [http://polycount.com/discussion/comment/2230470/#Comment_2230470 Skew you buddy! Making sense of skewed normal map details.]
  
== Editing Normals in 3ds Max ==
 
Vertex normals can be manually bent in 3ds Max by using the Edit Normals modifier. See the [http://docs.autodesk.com/3DSMAX/13/ENU/Autodesk%203ds%20Max%202011%20Help/files/WSf742dab04106313366400bf6112a1cea097-7f65.htm 3ds Max 2011 online help].
 
  
Edited vertex normals are somewhat fragile in 3ds Max, they can be lost easily:
+
==== Noors Normal Thief MAXScript ====
* If you take an Editable Mesh model, activate Attach, and try to attach an Editable Poly to it, the vertex normals of the Poly model will be reset. However using Attach in an Editable Poly model will work fine.
+
2014
* If you Attach multiple meshes together, make sure each has at least one edited normal. Meshes without edited normals will have their vertex normals jumbled.
+
* If you Attach models that have been rotated, make sure to use Reset Xforms on them first. Attaching a rotated model to another will skew all its edited normals.
+
* If you use Detach to make a new object, the detached object's vertex normals will be reset.
+
* If you use Detach to create a new element in the same object, the detached element's vertex normals will be reset.
+
  
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 [[../3DTutorials/Smoothing Groups in 3DSMax|Smoothing Groups in 3ds Max]] by [[poopinmymouth|Ben 'poopinmymouth' Mathis]].
+
[https://dl.dropboxusercontent.com/u/13762052/polycount/NoorsNormalThief.ms NoorsNormalThief.ms] by [http://polycount.com/profile/Noors "Noors"] is a 3ds Max MAXScript tool that projects vertex normals from one model to another, automating what would otherwise be a tedious manual process. See the Polycount Forum thread [http://polycount.com/discussion/138828/ive-made-a-faster-normalthief I've made a faster NormalThief].
  
<span id="Slide_Normal_Thief"></span>
+
The script is based on [http://www.scriptspot.com/3ds-max/scripts/normal-thief NormalThief.ms] written by [http://br.linkedin.com/pub/mauricio-b-gehling/1b/9b6/5b6 Mauricio B. Gehling], and on [http://slidelondon.com/_downloads/SlideNormalThief/SlideTools-SlideNormalThief.rar SlideNormalThief.rar] by [http://slidelondon.com/ Slide London].
=== Slide Normal Thief MAXScript ===
+
[http://slidelondon.com/_downloads/SlideNormalThief/SlideTools-SlideNormalThief.rar SlideNormalThief] by the studio [http://slidelondon.com/ 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.  
+
  
{| border="1" cellpadding="2" cellspacing="0"
+
 
 +
==== Weighted Vertex Normals ====
 +
2014
 +
 
 +
[https://github.com/ByteHazard/wnormals Weighted Vertex Normals] MAXScript by [https://github.com/ByteHazard Martijn Buijs].
 +
 
 +
This MaxScript generates Weighted Vertex Normals for any arbitrary geometry.
 +
 
 +
'Weighting' of vertex normals means that each face normal contribution is
 +
scaled by a property of the triangle. This script uses the triangle surface area
 +
and corner angle as influences. The result of this is that a small triangle will
 +
have less influence on shading of its larger neighbor. Likewise, the neighbor
 +
will have larger influence on the shading of the smaller neighbor.
 +
 
 +
This effect is typically most visible on chamfered boxes, but enhances all types
 +
of geometry. All geometry with proper weighted vertex normals is mathematically
 +
guaranteed to produce more aesthetically appealing shading than the default
 +
3dsmax generated vertex normals.
 +
 
 +
{| border="1"
 +
|[[image:wnormals.png]]
 
|-
 
|-
 +
|Image by [https://github.com/ByteHazard Martijn Buijs].
 
|}
 
|}
  
The script is based on a much-slower script called [http://www.scriptspot.com/3ds-max/scripts/normal-thief NormalThief.ms] written by [http://br.linkedin.com/pub/mauricio-b-gehling/1b/9b6/5b6 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.
+
==== Vertex Normals Stitcher ====
 +
2013
  
{| border="1" cellpadding="2" cellspacing="0"
+
[http://www.scriptspot.com/3ds-max/scripts/vertex-normals-stitcher Vertex Normals Stitcher | ScriptSpot]
 +
 
 +
This script averages vertex normals at the borders (Open Edges). It allows you to smooth surfaces after separating their vertices/edges/faces. For example after detaching faces or splitting edges. It still keeps hard edges if the object has multiple smoothing groups.
 +
 
 +
 
 +
==== Slide Normal Thief MAXScript ====
 +
2010
 +
 
 +
[http://slidelondon.com/_downloads/SlideNormalThief/SlideTools-SlideNormalThief.rar SlideNormalThief.rar] by [http://slidelondon.com/ 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.
 +
 
 +
{| border="1"
 +
|[[image:SlideNormalThief_UI.png]]
 
|-
 
|-
 +
|Interface for the SlideNormalThief MAXScript. Script by [http://slidelondon.com/ Slide London].
 
|}
 
|}
  
In the example above, the red shape was a box with a single smoothing group applied, some edges cuts into it, and the vertices moved around some. The tool seems to work well when modeling roughly the shape of the canopy, and using a single smoothing group... modeling a shape that looks like how you want the tree's normals to point.
+
The script is based on a much-slower script called [http://www.scriptspot.com/3ds-max/scripts/normal-thief NormalThief.ms] written by [http://br.linkedin.com/pub/mauricio-b-gehling/1b/9b6/5b6 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 ===
+
==== GetVertNormalsFromFaces MAXScript ====
[[attachment:AverageNormal.mcr|AverageNormal]] by [http://mathieujacquin.free.fr/ 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.
+
2010
  
<span id="SetNormals_MAXScript"></span>
+
[[file:GetVertNormalsFromFace_0_2.ms.zip|GetVertNormalsFromFaces]] by [http://www.illusioncatalyst.com/ 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|mig Normal Tools]] option "Fillet Outside".
=== [[GetVertNormalsFromFace]] MAXScript ===
+
[[attachment:GetVertNormalsFromFace_0_2.ms|GetVertNormalsFromFace]] by [http://www.illusioncatalyst.com/ 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|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.  
 
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.  
Line 85: Line 165:
 
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.  
 
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 [http://www.polycount.com/forum/showthread.php?t=75753 Editing vertex normals in Max, got scripts?].
+
See the Polycount Forum thread [http://polycount.com/discussion/comment/1199836/#Comment_1199836 Editing vertex normals in Max, got scripts?].
  
=== Exporting Edited Normals ===
+
{| border="1"
Edited vertex normals can be exported from 3ds Max with some file formats:
+
|[[image:GetVertNormalsFromFaces.jpg]]
 
+
{| border="1" cellpadding="2" cellspacing="0"
+
| '''File Format'''
+
|  '''Supports Edited Normals?'''
+
 
|-
 
|-
|<class="red none">| 3DS
+
|What GetVertNormalsFromFaces does.
|  no
+
|-
+
|<class="green none">| ASE
+
|  yes
+
|-
+
|  CGF (CryEngine)
+
|  ?
+
|-
+
|<class="red none">| Collada
+
|  no
+
|-
+
|<class="green none">| FBX
+
|  yes
+
|-
+
|<class="green none">| OBJ
+
|  yes
+
|-
+
|<class="red none">| PSK (Unreal Engine)
+
|  no
+
|-
+
|<class="red none">| WRL (VRML)
+
|  no
+
 
|}
 
|}
  
== Editing Normals in Maya ==
+
 
 +
==== AverageNormal MAXScript ====
 +
2010
 +
 
 +
[[file:AverageNormal.mcr.zip|AverageNormal]] by [http://mathieujacquin.free.fr/ Mathieu 'zOffTy' Jacquin] is a 3ds Max MAXScript tool that averages all the vertex normals for the selected coplanar faces, so they their normals all point in the same direction.
 +
 
 +
 
 +
==== Normal Thief MAXScript ====
 +
2004
 +
 
 +
[http://www.scriptspot.com/3ds-max/scripts/normal-thief NormalThief.ms] by [http://br.linkedin.com/pub/mauricio-b-gehling/1b/9b6/5b6 Mauricio B. Gehling] is a 3ds Max MAXScript tool that projects vertex normals from one model to another, automating what would otherwise be a tedious manual process.
 +
 
 +
Faster versions of this script have since been made, see [[VertexNormal#Slide_Normal_Thief_MAXScript]] and [[VertexNormal#Noors_Normal_Thief_MAXScript]].
 +
 
 +
 
 +
=== Cinema 4D ===
 +
* [http://frostsoft.blogspot.com/2012/01/vertex-normal-tool-plugin.html FrostSoft: VERTEX NORMAL TOOL PLUGIN] allows the editing of vertex normals in Cinema 4D.
 +
 
 +
[[image:FrostSoft_VNT_banner.png|left|frame|Vertex Normal Tool plugin for Cinema 4D. Image by [http://frostsoft.blogspot.com/2012/01/what-are-vertex-normals.html FrostSoft].]]<br clear="all"/>
 +
 
 +
* [https://skinprops.com/addnormals.php Add Normals plugin] explicitly creates the Normals Tag for each vertex, allowing the export (but not editing) of explicit normals.
 +
 
 +
* [http://polycount.com/discussion/60571 Cinema 4d tips and tricks thread] from the Polycount Forums.
 +
 
 +
* [http://www.okino.com/conv/imp_c4d_selective.htm CINEMA 4D Import Conversion System by Okino Computer Graphics] has in-depth information about vertex normal support in Cinema 4D
 +
 
 +
 
 +
=== Maya ===
 
Vertex normals can be adjusted in Maya by using the [http://download.autodesk.com/us/maya/2011help/files/Editing_polygons_Edit_the_vertex_normals_to_affect_polygon_shading.htm Normals tools in the Polygons menu] (Maya 2011 online help).  
 
Vertex normals can be adjusted in Maya by using the [http://download.autodesk.com/us/maya/2011help/files/Editing_polygons_Edit_the_vertex_normals_to_affect_polygon_shading.htm Normals tools in the Polygons menu] (Maya 2011 online help).  
  
 +
 +
==== Transfer Attributes ====
 
Vertex normals can also be baked from one model to another by using [http://download.autodesk.com/us/maya/2011help/files/Mesh__Transfer_Attributes.htm Transfer Attributes].
 
Vertex normals can also be baked from one model to another by using [http://download.autodesk.com/us/maya/2011help/files/Mesh__Transfer_Attributes.htm Transfer Attributes].
  
=== mig Normal Tools ===
+
{| border="1"
The [http://migugi.net/mel/normalTools/ mig Normal Tools] is a collection of MEL scripts for editing vertex normals in Maya.  
+
|[[image:maya_transferattributes.jpg]]
 +
|-
 +
|"Transfer Attributes" in Maya can be used to copy vertex normals from a dome to a tree.<br/>Select the dome, then the tree, then choose Mesh > Transfer Attributes, and enable only Vertex Normals.<br/>Image by [http://polycount.com/profile/callebo 'callebo'].
 +
|}
  
{| border="1" cellpadding="2" cellspacing="0"
+
 
 +
==== FaceNRMtoVert ====
 +
[http://polycount.com/profile/passerby "passerby"] wrote a melscript that does a similar function as the [[#SetNormals_MAXScript|GetVertNormalsFromFace]] maxscript.
 +
 
 +
 
 +
<pre><nowiki>#!highlight csharp
 +
global proc FaceNRMtoVert() {
 +
 
 +
 
 +
    string $Fs[] = `filterExpand -sm 34`;
 +
    select -cl;
 +
    for ($F in $Fs) {
 +
        select -r $F;
 +
        string $normals[] = `polyInfo -faceNormals`;
 +
        string $buffer[];
 +
        tokenize $normals[0] $buffer;
 +
       
 +
        float $plane[3];
 +
        $plane[0] = $buffer[2];
 +
        $plane[1] = $buffer[3];
 +
        $plane[2] = $buffer[4]; 
 +
        PolySelectConvert 3;
 +
        polyNormalPerVertex -xyz $plane[0] $plane[1] $plane[2];
 +
        }
 +
}
 +
</nowiki></pre>
 +
 
 +
 
 +
For more info see the Polycount forum thread [http://polycount.com/discussion/comment/1584696/#Comment_1584696 GetVertNormalsFromFace script for maya].
 +
 
 +
 
 +
==== froTools Orient Constraint Normals ====
 +
 
 +
* [http://www.froyok.fr/blog/2012-12-frotools-3-2-new-enhanced-ui-and-tools froTools 3.2 : new enhanced UI and tools]
 +
 
 +
 
 +
==== mig Normal Tools ====
 +
The [http://cmcproductions.co.uk/files/migNormalTools.mel mig Normal Tools] is a collection of MEL scripts for editing vertex normals in Maya.
 +
 
 +
{| border="1"
 +
|[[image:migNormalToolsUI.png]]
 
|-
 
|-
 +
|Interface for the mig Normals Tools MEL scripts. Scripts by [http://migugi.net/ Mika Göös].
 
|}
 
|}
  
== Normal Mapping ==
+
=== Modo ===
Vertex normals have a strong influence on tangent-space [[NormalMap|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 [http://boards.polycount.net/showthread.php?t=68173 fight with the normal map] and create shading errors. Careful [[Topology|topology]] can minimize or avoid these errors altogether.
+
{| border="1"
 +
|[[image:chai_bentnormals.jpg]]
 +
|-
 +
|Baking normals in modo, using the [http://forums.luxology.com/topic.aspx?f=37&t=41509 pipelineIO plugin].<br/> Image by [http://www.svartberg.com/ Ariel Chai].
 +
|}
 +
 
 +
== More Information ==
 +
* [[Foliage]]
 +
* [[Foliage Vertex Color]]
 +
* [[Normal map]]
 +
* [[Smoothing Groups]]
 +
* [[Vertex color]]
  
 
----
 
----
 
[[Category:CharacterModeling]] [[Category:EnvironmentModeling]] [[Category:TextureTechnique]] [[Category:EnvironmentFoliage]]
 
[[Category:CharacterModeling]] [[Category:EnvironmentModeling]] [[Category:TextureTechnique]] [[Category:EnvironmentFoliage]]

Revision as of 14:35, 30 September 2017

Vertex normals are invisible lines pointing out of a 3D model's surface, at each vertex. The game compares these normals against a light's direction. If the light is directly facing a normal, the surface is brightest there. When a normal is facing away from a light, the surface doesn't get lit by it.

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. 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. Check your engine's documentation, or try a quick test.

What Is a Vertex Normal?

FrostSoft: WHAT ARE VERTEX NORMALS (VNT documentation)

Image by FrostSoft.

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.

Smoother Shading

See Face weighted normals.

Bending normals on bevelled models.
From the tutorial Shading techniques Superspecular soft edges
Image by Paolo Oliverio

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.

Editing Normals

3ds Max

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

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 Smoothing Groups Tutorial by Ben "poopinmymouth" Mathis.

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

  • If you use Editable Poly, activate Attach, and attach another model, the vertex normals will be kept. However Editable Mesh - Attach will reset the normals.
  • If you Attach multiple meshes together, make sure each has at least one edited normal. Meshes without edited normals will have their vertex normals jumbled.
  • If you Attach models that have been rotated, make sure to use Reset Xforms on them first. Attaching a rotated model to another will skew all its edited normals.
  • If you use Detach to make a new Object, the detached object's vertex normals will be reset.
  • If you use Detach to create a new Element in the same object, the detached element's vertex normals will be reset.
  • If you add an Edit Normals modifier and make the normals Explicit, then go below it in the modifier stack and Detach as an Element, the normals will be preserved. This works with Editable Mesh, Edit Mesh, Editable Poly, and Edit Poly.

Exporting Edited Normals

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

File Format Supports Edited Normals?
3DS no
ASE yes
CGF (CryEngine)  ?
DAE (Collada) yes
FBX yes
OBJ yes
PSK (Unreal Engine) no
WRL (VRML) no


3ds Max Tools

These are in order by date, older tools towards the bottom.


Normal Tools (WallWorm)

2017

Normal Tools by Shawn Olson is a set of tools integrated into the existing Edit Normals modifier as a new rollout. Normal Tools for Max Released Polycount Forum thread.

Normaltools.png
Normal Tools interface in 3ds Max 2017.


Face Weighted Normals MAXScript

2015

Face Weighted Normals by Juan 'monster' Martinez is a 3ds Max MAXScript tool that selectively aligns the vertex normals for the largest polygons on a mesh. This means the smaller polygons act as the transition areas because usually the smaller polygons are thin bevels.

See the Polycount Forum thread Skew you buddy! Making sense of skewed normal map details.


Noors Normal Thief MAXScript

2014

NoorsNormalThief.ms by "Noors" is a 3ds Max MAXScript tool that projects vertex normals from one model to another, automating what would otherwise be a tedious manual process. See the Polycount Forum thread I've made a faster NormalThief.

The script is based on NormalThief.ms written by Mauricio B. Gehling, and on SlideNormalThief.rar by Slide London.


Weighted Vertex Normals

2014

Weighted Vertex Normals MAXScript by Martijn Buijs.

This MaxScript generates Weighted Vertex Normals for any arbitrary geometry.

'Weighting' of vertex normals means that each face normal contribution is scaled by a property of the triangle. This script uses the triangle surface area and corner angle as influences. The result of this is that a small triangle will have less influence on shading of its larger neighbor. Likewise, the neighbor will have larger influence on the shading of the smaller neighbor.

This effect is typically most visible on chamfered boxes, but enhances all types of geometry. All geometry with proper weighted vertex normals is mathematically guaranteed to produce more aesthetically appealing shading than the default 3dsmax generated vertex normals.

Wnormals.png
Image by Martijn Buijs.


Vertex Normals Stitcher

2013

Vertex Normals Stitcher | ScriptSpot

This script averages vertex normals at the borders (Open Edges). It allows you to smooth surfaces after separating their vertices/edges/faces. For example after detaching faces or splitting edges. It still keeps hard edges if the object has multiple smoothing groups.


Slide Normal Thief MAXScript

2010

SlideNormalThief.rar by 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.


GetVertNormalsFromFaces MAXScript

2010

File:GetVertNormalsFromFace 0 2.ms.zip 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?.

GetVertNormalsFromFaces.jpg
What GetVertNormalsFromFaces does.


AverageNormal MAXScript

2010

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


Normal Thief MAXScript

2004

NormalThief.ms by Mauricio B. Gehling is a 3ds Max MAXScript tool that projects vertex normals from one model to another, automating what would otherwise be a tedious manual process.

Faster versions of this script have since been made, see VertexNormal#Slide_Normal_Thief_MAXScript and VertexNormal#Noors_Normal_Thief_MAXScript.


Cinema 4D

Vertex Normal Tool plugin for Cinema 4D. Image by FrostSoft.

  • Add Normals plugin explicitly creates the Normals Tag for each vertex, allowing the export (but not editing) of explicit normals.


Maya

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


Transfer Attributes

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'.


FaceNRMtoVert

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


#!highlight csharp
global proc FaceNRMtoVert() {


    string $Fs[] = `filterExpand -sm 34`;
    select -cl;
    for ($F in $Fs) {
        select -r $F;
        string $normals[] = `polyInfo -faceNormals`;
        string $buffer[];
        tokenize $normals[0] $buffer;
        
        float $plane[3];
        $plane[0] = $buffer[2];
        $plane[1] = $buffer[3];
        $plane[2] = $buffer[4];  
        PolySelectConvert 3;
        polyNormalPerVertex -xyz $plane[0] $plane[1] $plane[2];
        }
}


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


froTools Orient Constraint Normals


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 Mika Göös.

Modo

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

More Information


Personal tools
Namespaces

Variants
Actions
Navigation
Tools