ZModeler2 Lesson#2: Shading and reflections.


Till this point you have used Flat-Shading mode for an objects and wasn't really bothered about accurate shading of the meshes, since flat-shade did all the job for you. Nevertheless, mesh shading is what you have to carry about.


We have came back to vertices normals. As it was stated in basics lessons, Vertex Normal specify how this vertex reflects the light and how neighbour polygons are shaded. Take a look at the image on the right. There is an object made of three quads which reside on eight vertices. I've drawen quad's directional vectors (normals) as blue and red arrows. Take a look at the quads with blue arrows. The first one resides on vertices #1,2,3,4 and the second on vertices #5,6,7,8. Notice that normals (green lines) for vertices #1,2,7 and 8 match blue arrows. This is the most common case - vertices normals are "nearly the same" as the polygons normals they are used in. But what has happend with normals for vertices #3,4,5 and 6? Thay are all the same - but these vertices are used by polygon with "red arrow" normal, and this polygon affected vertices normals too. Now, take a look at the image below:

This is the same object observed from top (left image) and from "top front" (right image). On the left image normals for vertices #1,2,7 and 8 (only #1 and #8 are drawn on the image) point almost to the viewer and thus, these vertices reflect more light. According areas of quads are shaded brighter than the area affected by another vertices. On the right image normals for vertices #3,4,5 and 6 point to the viewer, so they give more shine to quads than other vertices' normals.

This is general normals-shading concept. Polygons, using vertices with different (even a little) normals direction, appears smoothly shaded. On the image above all three quads (both on the left and on the right image) appear smoothly shaded. This allows to use less vertices and polygons to create smoothly-shaded surfaces.

Image on the right is still the same object, but it have been changed a little. It has now ten vertices total, since it have two pairs of vertices (5,6 and 7,8) instead of old vertices #5 and #6. Notice that pair of normals goes out of such a points on the image (one normal per vertex). An important thing here to note is the rightmost quad - it has it's own four non-shared vertices, all these vertices have identical normals pointing upward, so this quad shaded with the same level of color (appears to be flat). But I would like you to notice even more important thing here too. It's a sharp edge that separates this quad from the rest of the object (an edge between points "5,6" and "7,8"). Making a sharp edge by duplicating certain vertices is quite common appropach. It will be discussed on the next page.


Besides reflecting a light, vertices normals can be used for reflecting static environment. This is commonly known as "environment mapping" or "spherical environment". The main concept of this technique is in applying additional "reflection" texture over the mesh the special way, so this texture simulates reflections of environment around the mesh. Mapping (applying of this texture) is not static (it does not require UV-mapping) - this so-called "spherical mapping" depends on point of viewing and on mesh normals. Take a look at the image:

This is a BMW from basics lessons with solid green color material and a spherical environment applied. It uses the following environment texture:

Spherical environment textures are not a subject of this lessons, you can find them anywhere. is an example. The only things to note about environment textures are:

  • It's applied additive, so it should be pretty dark.
  • Image on this texture should be flipped upside-down for Direct3D-based spherical environment.

    So, why these reflections subject have been mentioned here? It's because it's widely used in games and because it's directly related to mesh vertices normals. Environment mapping texture (this fish-eye texture shown above) stratched over the mesh vertices, depending on vertices normals. So, when adjusting normals, you should keep in mind that normals will affect reflection textures too. In certain cases, when mesh was modelled inaccurate, and normals where computed by zmodeler, this mesh can be shaded just fine, but reflections will suffer. In most of cases you should pay more attention to shading and make only minor tuning to the mesh for reflections afterwards. On the next page this will be discussed.