For the short introduction to TikZ

  source file (.tex)

For drawing surfaces of revolution (in the light)

  tutorial explaining how to use the functions below to draw surfaces of revolution

If the surface has holes (a torus for example), the result is not always acceptable. I think that a global soluiton is out of reach in TikZ; but I intend to give at least a local solution i.e. one that works for a fiven point of view.

  surfacesOfRevolution.sty : (main file) sets up the observer and light source, discretises the surface into a grid, computes visibility and shading, and provides the drawing commands

  surfacesOfRevolutionAndH.sty : an extension that clips a surface to a half-space defined by a linear inequality H > 0, making it possible to show cross-sections or to combine two surfaces that intersect

  surfacesAndCurves.sty : defines the built-in generating curves (sphere, cone, torus…​) and the parameters that control their shape