How to Improve Soften/Smooth Shading


#1

Are you looking for a solution to shading errors?

You can improve the shading by offsetting edges to even out the shading.

Before:

After:

Disclaimer: It doesn’t always work perfectly (especially when geometry gets complex), but it definitely improves the shading. Sometimes it just requires finding the right edges to offset and the right edges to draw to smooth out the shading when the model gets complex. I just learned this little trick recently and wish I knew about it sooner, so I figured I’d share to help other people.

Soften Smooth Tip.skp (91.6 KB)


#2

You’ll get a better looking result if you hide the offset edges instead of softening/smoothing them.

This is an old technique. Been around for many years.


#3

I can’t tell the difference. Why do hidden offset edges look better than softened offset edges?

And for the sake of the tutorial, I improved the shading with an edge offset.
57%20PM

Offset%203


#4


#5

Wow! Great result! I can’t figure out how to do it though. I softened one offset edge & hid the other, but both still look the same. What am I doing wrong?
%3F

Problem.skp (101.5 KB)


#6

People may be wondering why the appearance changes based on numbers and locations of edges, and how to predict the result. The visual behavior is a result of SketchUp’s native rendering using Phong Shading (or a very similar technique). The following drawing illustrates the basic concept:


In rendering, the apparent brightness of a patch on a surface or face depends largely on the angle between the patch and the direction of light coming from an illumination source (there can be many other factors as well). In simple flat shading with a light source at infinity (for simplicity), the angle between a patch and the light is constant across the entire surface, and therefore the brightness is constant. On a true curved surface the angle between a little patch and the light source varies across the surface as the curvature changes, yielding a continual variation in apparent surface brightness.

Phong shading generates an approximation of how a curved surface would appear by “faking” or simulating the local angle of the true flat surface at different locations on the surface. The local angle of the surface is determined based on the local “surface normal” - a line that is perpendicular (or normal in mathematics) to the surface.

In the diagram, the arrows represent the generated surface normals. The short line segment at the tail of the arrow represents the corresponding simulated surface angle. Note how the surface normals tilt as you consider different patches of a surface. In Phong Shading the software calculates the true surface normals of two adjacent flat surfaces, and determines the average of those two normals. Then for every point on the surface the software interpolates what is the simulated local normal by blending between the surface’s true normal and the average with its neighbor, based on distance from the neighbor. Points very close to an edge of the surface tend to interpolate very closely to the average. Points near the center of the surface (and thus far from edges) tend to interpolate to the true normal.

If you squint and look at the short line segments at the bases of all the arrows, you can imagine what the simulated curved surface would be. The domed shapes on the right represent the idealized profile that would be indicated by all the normals.

It may be apparent by now that doing this shading trick between a large surface and a small neighbor has visual problems. The simulated curvature across the large surface must occur more gradually compared to the small surface. The resulting broad gradient of brightness doesn’t meet our mental expectations of the large surface next to its small neighbor. This can be improved by simply breaking the large surface into multiple coplanar regions. The surface-normal interpolation thus operates across a shorter distance, yielding a tighter gradient. The large central region of the top surface is rendered with simulated surface normals that match the true normal of the entire flat surface, because the neighbor of the large central region (i.e., the narrow border produced by subdividing the top surface) have identical true normals. The Phong interpolation degenerates to just the true normal.


#7

Thank you for the great explanation of SketchUp’s soften/smooth shading! I figured out that adding squares to the corners of the edge offset evens out the smoothing.

I was trying diagonals, but they don’t even out the shading properly because phong shading averages the normals between neighboring faces. If you add a face instead of the diagonal (as pictured above), then it averages normals with the corner, rather than the perpendicular faces.

Thanks again for the explanation. It’s helped a lot.