I created this using only mathematical transform matrices.

The perspective uses an affine transform, the rotation uses purely rotational tranforms.

Shading is a ratio of the 3D surface area and the projected surface area.

I make minimal use of a library called sylvester for matrix multiplication

[ ]
x>>
y>>
@
z