23
$\begingroup$

I know what normals are, because I took physics. However, I have this question: why do they exist in blender?

The only use I've ever had for them is negative side effects. They make my mesh render funny. Why doesn't blender simply treat both sides of the mesh the same?

What were the intentions of the developers including normals in the program, and not treating both sides of the mesh as if they had the normal?

$\endgroup$
0

6 Answers 6

26
$\begingroup$

A normal is a vector in 3D-space that is perpendicular to two other vectors (determinded by two edges of a face). It is calculated by the cross prduct.

A basic use of normals is in shaders e.g. to calculate reflections

enter image description here

Imgage: https://en.wikipedia.org/wiki/Reflection_(physics)

Normals could also be used for backface culling. This is a performance optimization which allows to skip rendering of faces which will not be visible (normals pointing away from to the camera). OpenGl uses a different method for that described here.

Left image includes backfaces, the right one doesn't.

enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ Backface culling halves the number of polygons which actually get rendered. It's less of a big deal for raytracing, but if you're using blender to create 3d characters for a videogame, backface culling is an essential tool for keeping the game moving along smoothly. $\endgroup$
    – Cort Ammon
    Commented Dec 22, 2015 at 16:41
  • 3
    $\begingroup$ I don't think normals are used for backface culling. Typically, backface culling will look at the winding order of the triangle in screen space, and reject it if it's negative (or positive, if you want). This is done without ever knowing or caring about the normal. You can also do it before projection, if you want, by computing the "winding" of a tetrahedron in 3D space using the camera as the fourth point. $\endgroup$ Commented Dec 23, 2015 at 1:51
  • 1
    $\begingroup$ OpenGL definitely uses winding order for backface culling. However, normals are used extensively for lighting equations in most shaders (the entire difference between "smooth" and "flat" shading is the normal for each pixel) $\endgroup$ Commented Dec 23, 2015 at 4:48
  • $\begingroup$ @DietrichEpp Thanks, I updated my post (clearified back-face culling) $\endgroup$
    – stacker
    Commented Dec 23, 2015 at 8:06
14
$\begingroup$

More Examples

Necessarily Incomplete

  • Particles can use normals to issue particles in certain directions.
  • Freestyle can use normals for artistic elements
  • Modifiers use normals. Incomplete list of examples. Edge Split Modifier, Shrink Wrap , Displacement.
  • Selection of faces can use normals
  • Custom Transform Orientations for alignment
  • Extruding Faces on surfaces such as spheres
  • Color Smoothing uses normals
  • Texture painting can use normals
  • Color selection can be based on normals for non physics based coloring (mathematical fun inventions)

enter image description here

Normals are everywhere.

There are completely convenient and necessary.

$\endgroup$
14
$\begingroup$

In addition to the other answers, normals are also used to create effects like bump mapping and smooth shading.

(In Cycles) when a ray hits a face its reflection angle is calculated as if the face is perpendicular to the normal. (In Blender Render you aren't tracing rays so the actual process is different, but the idea is the same.) Normally, (no pun intended) the normal is orthogonal to the face, so nothing looks abnormal; but if you strategically modify the surface normals across a face you can smaller detail such as bumps or curvature.


Bump/Normal Mapping


A bump map or normal map modifies the surface normals across a flat face, thus changing the direction light reflects off the face. If this is done in an orderly manner it can make the flat face look as if it has even finer detail across its surface.

Bump map vs. normal map:

Usually a "bump map" refers to a black and white map which defines raised and lowered areas of the face. Before rendering the render engine must do some calculations on the bump map to determine the normals to fake the raised and lowered areas of the mesh.

A normal map, on the other hand, uses the RGB channels of each pixel to explicitly define the normal vector at that point. Normal maps require some special algorithms to generate, but generally give better looking results due to the ability for exact vector control.

Note: Sometimes the term "bump mapping" is used in a loose sense to refer to either of these methods.

Smooth Shading


Smooth shading smoothly interpolates the normals across a face between the face's vertex normals, creating the illusion that the face is curved.

$\endgroup$
3
  • $\begingroup$ So.. smooth shading works best when there are lot's of faces, as it provides blender a better guess about what the normals should be? $\endgroup$ Commented Dec 22, 2015 at 17:59
  • $\begingroup$ @user1833028 Basically yes. $\endgroup$
    – PGmath
    Commented Dec 22, 2015 at 18:03
  • $\begingroup$ Recommended reading:Let’s talk about normals! by @OmarAhmad $\endgroup$
    – user1853
    Commented Jan 7, 2018 at 20:53
6
$\begingroup$

In order to understand why Blender includes normal you first have to know how the lighting is calculated in rasterization process.

The most basic calculation of the amount of diffuse light a surface receives is by taking the direction of the light and the normal, and calculating their dot product. Take an example:

Let's say that the light comes from the top and the normal faces upward: in this case, as you know, the face would be fully illuminated; in mathematical terms, using Blender coordinate space we would have a normal direction vector: (0,0,1) and a light direction vector (0,0,-1).

Taking dot product (which you also should know in order to understand my answer) of those two - you would end up with value of -1. This way we know that the light is going the opposite way the normal goes. If we negate this value we get 1 and we can take it as the amount of the diffuse light the face receives.

In the other case - if you take a light direction that goes sideways(it comes from the side of the face) - that is a light direction given in a vector (1,0,0) - the dot product of this new light direction and the face normal will be equal to 0. No need to negate 0 in this case ;)

The final case is when the light is "behind" the face, or speaking in context of the example - it shines from below - that is, the light direction is given by a vector (0,0,1). In this case the dot product would yield a value of 1. Again we would need to negate it and the result would be a value of -1 as the amount of the light the surface receives.

As you know - a surface cannot receive a negative amount of light, so what we do is we clamp the result to a rage of 0 to 1.


Here is a visual representation of these cases:

Light from above and the plane with a normal:

Light from above

Light from the side and the plane with a normal:

Light from side

Light form the bottom and the plane with a normal:

Light from below


If we take this results and results of every case lies in between, and as mentioned clamp the results to a range (0 to 1) - then, in the simplest case - we could map this range to a color value in computer graphics, - that is from black to white.

Without the normal we could not determine how much light the surface receives - we could not determine if it is facing at the light source. This concerns every rendering algorithm out there.

Now quoting your question: you say you want to "treat both sides of the mesh as if they had the normal". The first thing is - we don't really have "two sides" of a mesh - we only have a single face of a triangle. And even if we had two sides of a triangle - we would have to know which side to render, as they both would lie on a single plane. It could be perhaps technically possible but inefficent - the rendering algorithm would have to determine which side to render by taking the one that faces to the camera. That's the reason why setting up normals is left to the user.

On the other side I think that it would be nice to have such a feature built in, but I guess it would be very cumbersome to implement in OpenGL - which is used to draw the 3D viewport - and in some cases would cause a performance hit (when using high poly models).

Actually you asked a pretty nice question, which made me wonder a little bit.

$\endgroup$
1
  • 1
    $\begingroup$ pro-tip lukke, crop your images to more landscape than portrait to take up less space in your answer. $\endgroup$
    – zeffii
    Commented Dec 23, 2015 at 9:59
4
$\begingroup$

Why do normals exist in blender: A normal is a property of a plane. Trying to make a plane without a normal would be like trying to take the wetness out of water. When I say plane, think polygon faces.

$\endgroup$
4
$\begingroup$

Because planes in our physical reality have a front and a back, and the purpose of 3D modelling on your computer is to simulate our physical reality.

You can't do that without normal vectors to indicate which side is front and which side is back. They are a mathematical fact. Your face is defined by its width, height and normal vector. That's how the face exists: it's the collection of properties needed to describe its form. If Blender did not "have" normals, at least internally, you would not be able to make anything.

What you're really asking is why does Blender allow you to explicitly control the normal vector. Such control is crucial for performance in video game rendering, and for competently implementing many collision detection algorithms, but has semantics that may change how your scene looks, too! You can't just treat the front and the back the same all the time. Normals may also be used to generate cool lighting effects if you make them non-perpendicular to the surface's plane.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .