Cube shading algorithm implementation