docs: function(initial_csg) {
      var csg = initial_csg.canonicalized();
      var mesh = new GL.Mesh({ normals: true, colors: true });
      var meshes = [ mesh ];
      var vertexTag2Index = {};
      var vertices = [];
      var colors = [];
      var triangles = [];
      // set to true if we want to use interpolated vertex normals
      // this creates nice round spheres but does not represent the shape of
      // the actual model
      var smoothlighting = this.solid.smooth;
      var polygons = csg.toPolygons();
      var numpolygons = polygons.length;
      for(var j = 0; j < numpolygons; j++) {
        var polygon = polygons[j];
        var color = this.solid.color;  // default color
    
        if(polygon.shared && polygon.shared.color) {
          color = polygon.shared.color;
        } else if(polygon.color) {
          color = polygon.color;
        }
  
        if (color.length < 4)
          color.push(1.); //opaque
  
        var indices = polygon.vertices.map(function(vertex) {
          var vertextag = vertex.getTag();
          var vertexindex = vertexTag2Index[vertextag];
          var prevcolor = colors[vertexindex];
          if(smoothlighting && (vertextag in vertexTag2Index) &&
            (prevcolor[0] == color[0]) &&
            (prevcolor[1] == color[1]) &&
            (prevcolor[2] == color[2])
          ) {
            vertexindex = vertexTag2Index[vertextag];
          } else {
            vertexindex = vertices.length;
            vertexTag2Index[vertextag] = vertexindex;
            vertices.push([vertex.pos.x, vertex.pos.y, vertex.pos.z]);
            colors.push(color);
          }
          return vertexindex;
        });
        for (var i = 2; i < indices.length; i++) {
          triangles.push([indices[0], indices[i - 1], indices[i]]);
        }
        // if too many vertices, start a new mesh;
        if (vertices.length > 65000) {
          // finalize the old mesh
          mesh.triangles = triangles;
          mesh.vertices = vertices;
          mesh.colors = colors;
          mesh.computeWireframe();
          mesh.computeNormals();
  
          if ( mesh.vertices.length ) {
            meshes.push(mesh);
          }
  
          // start a new mesh
          mesh = new GL.Mesh({ normals: true, colors: true });
          triangles = [];
          colors = [];
          vertices = [];
        }
      }
      // finalize last mesh
      mesh.triangles = triangles;
      mesh.vertices = vertices;
      mesh.colors = colors;
      mesh.computeWireframe();
      mesh.computeNormals();
  
      if ( mesh.vertices.length ) {
        meshes.push(mesh);
      }
  
      return meshes;
    }