Lighting

# Lighting

Lighting is often called "shading" and gives "depth" to what would otherwise be a flat colored object.

If all triangles have a white color and we do not perform lighting or "shading" then the entire model will be drawn as a white object with no depth, all we will see is a silhouette outline of the object.

If we perform a single lighting calculation for each triangle then the formula is:

(triangle color) x (lighting) = (resulting color)

The result is a new color for the triangle. This method is called "flat shading" because the entire triangle is shaded with one single color resulting in a "flat looking" triangle. This was one of the first methods used in early generation 3D graphics systems when computer speeds were much slower than today.

Today modern systems can now easily perform 3 x lighting calculations per triangle, one for each point or "vertex" on the triangle. If we perform 3 x lighting calculations for each triangle then the formula is:

(triangle color at point 1) x (lighting) = (resulting color at point 1)

(triangle color at point 2) x (lighting) = (resulting color at point 2)

(triangle color at point 3) x (lighting) = (resulting color at point 3)

The result is 3 x colors for each triangle and this method is called "smooth shading" because the 3 x colors are smoothly blended between each of the 3 x points on the triangle.

# Normals

A triangle, specified as 3 x points and a single color, gives us no lighting information.

What we can do, using the 3 points, is calculate the perpendicular to the triangle surface. This calculated "direction" or "ray" perpendicular to the triangle surface is called a "surface normal". We can then use this "normal" to calculate "flat shading" as discussed above.

"Normals" are necessary to simulate lighting and shading. "Surface normals" indicate the direction light bounces off a surface. For example, a table top would have a "surface normal" pointing straight up.

Modern system perform "smooth shading". That is, triangles usually have one "normal" per vertex (one "normal" for every point on the triangle).

# Normals are Invisible

We usually do not see "normals", they are "invisible"... but we can see evidence of them by the lighting applied to 3D models.

In our example below, we can display these "invisible normals" as coloured lines or "hairs" sticking out from the 3D model.

# 3D Kit Builder

To remove the paint and show the "normals" in our example 3D Kit Builder model use the following Display options:

 Display Effect Setting Wireframe OFF Texture (Paint) OFF Transparency OFF Lighting OFF Lighting Normals ON Reflection OFF Mirroring ON Points OFF Triangles ON Lines OFF

### Lighting "Normals" are usually invisible

If we "turn off" lighting on our example 3D model it loses its depth, all we see is a flat silhouette of the object...

 Display Effect Setting Lighting OFF Lighting Normals OFF

### No Lighting

If we "turn on" lighting we can see the big difference between the single colour 3D model (above) and the same 3D model (below) with smooth shading.

 Display Effect Setting Lighting ON Lighting Normals ON

### Smooth Lighting

Also note that a new shading calculation is performed every time the 3D model is drawn to the screen or the viewing position changes. This is because the way light bounces off each surface changes as we rotate the object or move around it.

# Special Effects

"Normals" can also be useful for other special effects such as calculating reflection effects, for defining sharp edges, and they are sometimes used to define shape or form, and perform smoothing or subdivision of surfaces.

A special kind of Texture images can have "normals" information instead of color. This allows an Artist to paint surface features like cracks and scars directly onto a triangle surfaces increasing the visual level of detail.

Flat

Surface
Normals

Lines, Line Segments
and Rays

Subdivision
Surface

Paint

Transparency