Omar Ahmad posted this as a note on Facebook. We think that it is important that more 3D artists understand it:

Hello, today I am going to talk about surface normal and things related to it.

What is surface normal?

The surface normal is a vector which is perpendicular to the surface at a specific point. It can be a 3d vector in a 3d space or 2d vector in a 2d space.

For example in the 2d space: The normal of a curve is the perpendicular ray to the tangent of a curve.

For example in a 3d space: The normal is the perpendicular ray to the surface at a specific point. (usually a face)

Why is it important?

Basically everything in CG world is based on the surface normal, starting from smooth shading approximation that is passed to the Catmull-Clark subdivision modifier, ending with the rendering process and BVH baking.

How can we visualize a normal?

Normal is a vector which is composed of matrices. We can visualize it using a ray with the same orientation of the vector coming out of a specific point of a face.

We can visualize normal in Blender in these ways:

• Average vertex normal.
• Independent vertex normal.
• Face normal.

### Let’s go more in-depth!

1 – Average vertex normal

This method calculates the average of the faces that share the same vertex. That means if a vertex share 3 faces F1, F2 and F3 the vector will be (F1+F2+F3)/3

Average Vertex

2- Independent vertex normal.

This method visualizes number of vectors equal the number of faces shared by a vertex.  That means, if there are 3 faces shared, there will be 3 vectors visualized with the normal independently of each face.

Independent Vertex Normal

3- Face normal.

This method visualizes a vector from each face (pretty simple).

Face Normal

Smooth shading is an approximation that hacks the vertex normal to get a smoother object. The render engine (ie: the viewport OpenGL) gets the interpolated information by approximation.

Low poly & high poly surface normal

As you can see, in this image I have a low and high poly sphere. If you noticed the normal matcap you will see that the high poly mesh has a more gradient in color than the low poly mesh. Comparing between high and low poly spheres, we can see the base idea for smooth shading the interpolating between 2 vectors to get a final vector for each point in space.

Now take a look at independent vertex normal:

Independent Vertex Surface Normal

As mentioned previously, it branched to 3 as there are 3 faces (for 3 edges junction).

BNPR note: when the vertex is connected to 4 edges, we will have 4 independent vertex normals and so on.

But look what happened when we set the smooth values:

Now you see that the branched normals are combined. A smoothed gradient is created. It is the same as blurring an image, which is the averaging method for smoothing gradient.

### Can we edit normal?

Yes, the smooth shading is considered to be a normal editing, but what if we don’t need a smooth shading in a specific portion of the model. There are several methods to do this:

• Manually face splitting.
• Edge split modifier.
• Data transform modifier.
• Blend4Web normal editor.
• Normal edit modifier.

1-Manually face splitting

Above, I have a cube with a smooth shading (Average vertex normal), and I want to change the normal of the selected face. This is pretty simple, by pressing “Y” to split the face. Now the vertex has the average of 1 face, which is the same as the face normal. It is not shaded in gradient anymore.

Smooth Cube, Split Face

As you can see above, there are extra normal lines going out in the face normal direction, which is the face we have separated.

2-Edge split modifier

Using the same cube* with smooth shading:

Smooth Cube, Edge Split Modifier

Here I used the sharp edge marks plus edge split modifier to split the face. It works like the split face method but it is indirect editing. You can also use the angle information as a factor for the split.

3-Data transform modifier

You can copy the normal from one cube to another cube.

Data Transfer Cube

Here I have a cube with smooth shading and another cube [cube.001] with the edge split modifier. With the Data transfer modifier to copy the normal between them (copy normal from left cube to right cube).

4-Blend4 web Editor

Blend4Web is a tool for interactive 3D visualization on the Internet. The developers have developed Blender for some time and Blend4Web normal editor is developed by them. It is the most effective way to directly edit normal.

Blend4Web Edited Normals

Left cube contains a split normal using the Blend4Web normal editor, right is a normal smoothing. Blend4Web has already made a tutorial on how to do this, check it out in the resource section at the end of this article.

Other uses of the normal edit tools:

Game developers use the normal editing tool in Shrub and Trees to have good shading. The shading changes according to the normal direction of the surface.

Face color variation with different directions

As you can see here, there are a lot of color variation. It is caused by the direction of the face normal with just using the Blender viewport material. This happens in all the materials in general. It is not an issue but a normal behavior for a diffuse material.

When a tree composed of a lot of faces with different orientations, there will not have smooth transition between the faces. To simulate the real shading of a tree foliage of a pine tree or a sphere for shrubs, this can be achieved by 2 ways:

• Using Data transform with a sphere or a cone as the source
• Using normal editing technique (Explained above)

Blend4Web unedited (left) and edited (right) normal tree foliage

Here we can use the radial normal edit modifier with the origin as the center of the object, with normal auto smooth enabled of course.

Sphere Normal

As you can see, I have a ball which is covered with planes (a bad simulation for a bush). The right ball is without normal editing, normals are going everywhere, resulting in bad shading. While the left ball is normal edited using a radial normal edit modifier with origin is the center of the object. With radial it means that the normals are going outward direction from the origin of the source object or from the origin of the object itself.

### Resources:

Blend4Web editor: https://www.blend4web.com/en/article/131