0
$\begingroup$

I would like to preface that by subdivide, I mean the one that merely adds more polygons inside a mesh without distorting a shape, this:

enter image description here

Now from what I do know about smooth-shading, when a pixel is shaded, the normal used for shading that pixel is an interpolated value of the vertex normals of the vertices that make up the triangle the pixel is part of

However, I noted that a smooth shaded cube for instance without any subdivisions looks like this:

enter image description here

This is understandable

However, for a subdivided cube:

enter image description here

A picture in object mode for more clarity:

enter image description here

This does not make sense. Why should it look any different than a normal unsubdivided cube? Let's take some point on the 2nd cube containing a new vertex as a result of subdivision, say here:

enter image description here

Let's call that point, point P. This point P has some normal Np. If we were to look at that exact point, but on the first cube instead, since the normals are linearly interpolated, the normal at that point on the first cube would be exactly identical to the normal Np in the second cube

Following the same logic, every other vertex normal on the second cube should be identical to the normals at those exact points on the first cube, generated by interpolation of vertex normals.

As such, lighting should logically remain identical on both cubes, but as we can see, there are differences in how both meshes look. Precisely what is causing both of these meshes to look different?

Shouldn't the normals at every point on both cubes be identical, since after all, there has been NO surface deformation of any kind, and since linearly interpolated normals provide a perfect accurate normal per pixel on a triangle/polygon atleast on a flat surface like that of a cube's?

$\endgroup$
3
  • $\begingroup$ You've just demonstrated your own answer! :) Before the cube is subdivided, the interpolation is across the whole face, from its corners (actually its triangulation, which explains the diagonal shadow). After subdivision, most of the interpolation is across the small co-planar faces. The 'interpolation' is between normals in the same direction, at their corners, i.e. none. Only the faces at right-angle edges of the cube are interpolated between different normals, and that doesn't show very much, $\endgroup$
    – Robin Betts
    Commented Aug 21, 2021 at 21:43
  • $\begingroup$ Could you please explain " The 'interpolation' is between normals in the same direction, at their corners, i.e. none. Only the faces at right-angle edges of the cube are interpolated between different normals, and that doesn't show very much" again? I am not able to understand what you meant exactly $\endgroup$
    – Hash
    Commented Aug 22, 2021 at 18:11
  • $\begingroup$ I've popped in an answer. Hope it makes it clearer. $\endgroup$
    – Robin Betts
    Commented Aug 22, 2021 at 20:53

2 Answers 2

3
$\begingroup$

This first illustration shows a sample of the smoothed normals across an unsubdivided, (but triangulated for rendering) cube:

enter image description here

The green vertex-normals are the average of the true geometric normals of surrounding faces. (That average can sometimes be weighted in various ways; here, it isn't.)

The smooth-shading calculates the normal at the pink point to be the (barycentric) average of the green vertex-normals at the corners of its triangle. As you can see, it's not perpendicular to the underlying geometry.

Now let's have a look at the smoothed normal of the same pink point after the cube has been subdivided...

enter image description here

Now the green vertex-normals are perpendicular to the underlying geometry, because the faces that surround them are all pointing the same way.

And so the averaged normal at the pink point is also perpendicular to its triangle.

As you can see from the shading, things go a bit awry at the edges of the cube.. the interpolated normals there are a mini-version of the first example. But the effect shows only at the edges.

If you bevel the edges of the cube, you 'ease' the normals over the right-angle between the faces, and so the smoothed normals match the underlying geometric normals more closely.

$\endgroup$
2
  • $\begingroup$ So the idea is that near the corners, the normal of the vertice takes into account all the faces it's connected to, which includes faces that face completely different direction so the interpolated normals across the surface comes out different. While in the center region of the subdivided cube, since the vertex normals are only influenced by face normals that face in the same direction, the interpolated normals across the surface are thus more accurate than the unsubdivided ones? $\endgroup$
    – Hash
    Commented Aug 23, 2021 at 16:25
  • $\begingroup$ @Hash got it. That's right. :) $\endgroup$
    – Robin Betts
    Commented Aug 23, 2021 at 17:42
3
$\begingroup$

The normals are not calculated over every connected face, only the immediately adjacent faces. You effectively proved and demonstrated this. The fact is that “show normals” does not show you all the normal vectors for every part of the face. If it did, all you would see was a giant hairball. But in that hairball, normal vectors near the edge of a face with an angled face next to it would start leaning towards the adjacent face’s true normal as one got closer to the edge.

$\endgroup$
6
  • $\begingroup$ What do you mean by immediately adjacent one? The face adjacent to the face a pixel is part of? $\endgroup$
    – Hash
    Commented Aug 21, 2021 at 20:17
  • $\begingroup$ @Hash I updated the answer a bit $\endgroup$
    – TheLabCat
    Commented Aug 21, 2021 at 20:21
  • $\begingroup$ I would like to clarify, here I am only showing vertex normals not face normals I am also still confused, what do you exactly mean by the normals only being calculated every adjacent face? $\endgroup$
    – Hash
    Commented Aug 22, 2021 at 18:10
  • $\begingroup$ @Hash the face in the middle will only base its smoothed, gradiated, point-specific normals on the faces around it. What’s more, it will only use their true normals, rather than their calculated smoothed normals. This avoids multi-dimensional recursion: if it used the calculated normals, the subdivided cube would probably look mor similar to the unsubdivided, but it would have to iterate over and over to get there as each face would require the adjacent faces’ results, which in turn would require its own results, thus every face individually requiring the result of every face. $\endgroup$
    – TheLabCat
    Commented Aug 22, 2021 at 19:26
  • $\begingroup$ Could you explain what you meant by the multidimensional recursion? Why would it involve recursion? Is it because to calculate the interpoltaed normals at some point, we find the interpolated normals on another face, which then needs interoplated normals from some other face and so on till we infinitely go thru this recursion that never quite 'returns' back to the original face we wanted to find interpolated normals of? $\endgroup$
    – Hash
    Commented Aug 23, 2021 at 16:27

You must log in to answer this question.

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