Skip to content

0. Overview

Andreas Wiehn edited this page Jun 5, 2015 · 2 revisions

#Introduction

##Why Edit Normals?

Vertex Normals determine the way light interacts with the surface of a mesh. Sometimes, the structure of a mesh can be different from the shape it is trying to represent, making the mesh's shading significantly different from the desired results. Editing vertex normals allows you to adjust how the mesh is shaded, so you could, for example, create a box that is shaded like a sphere.

##Installing the Addon

Copy the custom_normals_editor folder into your addons directory and enable it using the addon manager in Blender.

##Configuring the Pie Menu Key

This addon includes a pie menu that allows the selection of the different auto-generation methods from the 3D window. This menu is optional and copies the functionality of the Auto-Generate panel for quick access.

The pie menu is configured to open by pressing Mouse Button 4 by default. To change this, go to around line 150 in init.py and change the line

kmi = km.keymap_items.new('wm.call_menu_pie', 'BUTTON4MOUSE', 'PRESS').

Check out keyslist.txt for the required codes.

##Some Examples:

###1. Tree meshes

Since it's unrealistic to expect a tree with each branch and leaf modeled in full detail to perform well in a real-time environment (for now), most tree meshes for games are created with foliage made up of many intersecting planes with alpha-masked branch textures. This approach can produce great results, but once placed in a lit environment, the shading will make it very obvious that the branches have no volume.

(default normals on tree example)

To counter this, the normals of the foliage planes can be 'bent' to change the way light interacts with them, giving the appearance of the planes being part of a larger shape. There are several ways to do this, depending on the required style and level of detail.

(bent normals on tree example - 1: spherical - 2: clusters - 3: cluster per branch - 4: blob)

###2. Grass meshes

Grass is usually modeled for games using the same techniques as tree foliage, several intersecting planes with alpha-masked textures (although some recent games have featured a more realistic approach for at least some of the grass). There are two issues with the plane-based approach that can be worked around using edited normals. The first is the same issue with flatness that tree foliage has, the other is the obvious difference in shading between the ground and intersecting grass meshes.

(grass default normals example)

The volume issue can be worked around the same way it is done for tree foliage. The difference in shading between the ground and grass is caused by the harsh difference in the normals closest to the intersection. The ideal (but probably not feasible) solution would be to perfectly match the normals of the grass meshes to the ground. A more realistic approach is making the bottom of the grass mesh's vertex normals point up, which mostly fixes this shading difference since grass meshes are generally aligned to the ground surface (idea from adsn's Transfer Vertex Normals addon).

(grass edited normals example)

###3. Modular mesh seams

The normals on edges where two modular meshes meet will almost never be aligned by default, resulting in differences in shading on the faces that contain the edges, which makes the fact that these are unconnected meshes very obvious. This can usually be worked around by hiding the seams artistically (clothing seams, decals, covering the seams with other meshes, etc), but sometimes the results can look awkward or limit the creative design and what can be done with it in a game.

(character neck seam example)

Seams can be alleviated by making sure that the vertices of these edges are aligned between the two meshes and their normals are identical. The method of doing this included in this editor can transfer the normals of a contiguous version of the meshes to the required edges (based on Vrav's Transfer Normals addon). Another way to do this I've been looking into that's not included yet is averaging the normals on offending edges.

(character neck smooth example)

###4. Fixing Bad/Inconsistent Shading

Automatically generated normals are ususally averaged, which can lead to inconsistent smoothing when a surface that should be flat is connected to faces that are at very different angles. A good example of this is a beveled cube. The edges of the cube's side faces will generally be smoothed with the corners between them, leading to a slightly rounded appearance.

(beveled cube unedited)

Tweaking the normals of the cube's side faces by setting them to point in the same direction will fix this problem.

(beveled cube edited)

There is a downside:
Edited normals will not be accounted for in most methods to create backfaces in a shader, so meshes that need to be two-sided will need manually created backfaces.

For more detailed information on vertex normals, check out http://wiki.polycount.com/wiki/VertexNormal

Next Page - Editor Modes

Clone this wiki locally