The task is to create a 3D shape of a board-like object, but it must be possible to have triangular and rectangular shapes removed from the corners, and to have round holes “drilled” through the object. It must also be possible to have textures on the object, and they can be different for the board’s edges and faces. There are many approaches for something like this. Here is a discussion of their pros and cons, using the Away3D 2.4 which is currently the latest version for Flash 9.

The best alternative, chosen from the ones presented below, seems currently “Multiple SkinExtrude meshes”.

  1. Multiple SkinExtrude meshes. Here, one uses class away3d.extrusions.SkinExtrude to create separate meshes for the outer edge and the top and bottom surface. A cylinder primitive without top and bottom and with inverted faces is used for each hole. To create the circle lines for the hole boundaries, cylinders with zero height and without top and bottom can be used to evaluate the coordinates. The textures are applied by using the SkinExtrude.material property on the individual meshes. The faces of the hole meshes have to be inverted, to be visible from the inside only. In the end, all meshes are grouped in one ObjectContainer3D. With more than one round hole in the board this variant is difficult, but possible by zero-width hole connections, or better by combining multiple rectangular plane shapes for the top and bottom surfaces, each with only one hole.
  2. One SkinExtrude mesh. Here, one uses SkinExtrude to create the board shape in one operation. SkinExtrude expects a two-dimensional array, where the contained arrays each become a “line” of connected vertexes, and in addition each point is connected to the corresponding point of the previous and next line so that a grid is created. This allows to create the object in one SkinExtrusion, by giving it the following “line” arrays, in this order: circle on top
    face, outer shape of top face, outer shape of bottom face, circle on
    bottom face. This alternative has the difficulty how to apply different materials to the triangular faces of the mesh; this is possible in principle, as the API docs on SkinExtrude.material say: “Individual material settings on faces, segments and billboards will override this setting.”. However, getting the right faces is the problem.
  3. Elevation class. Using the Elevation class, letting it work on a dynamically created black and white bitmap and removing the zero-height triangles after the elevation is created. Problem: it has only a fixed raster for creating vertexes, so one would need a dense raster, i.e. many polygons, for getting the circle hole round enough. Which is a huge performance problem.
  4. ElevationModifier or NormalUVModifier class. This is better than using the Elevation class because it is not necessary to remove any zero-height triangles afterwards. But the problem is the same: this needs a very fine raster (many polygons) to allow for round holes.
  5. Creating from triangles. It is possible to create the object as a self-built Mesh, made from triangle Face objects and perhaps combined using classes Merge and Weld. This is however the alternative that needs the most own calculations, it does not profit at all from Away3D extrusions or primitives. Especially creating the triangles on the top and bottom surfaces is a problem. It could be solved by using a new type of primitive that looks like an inverted cylinder, without top and bottom, but with a square attached to each side, comparable to how its done with an U.S. doctorate hat, but with holes.
  6. Moving an “inverted cylinder” in a pre-built object. Possible, but only with one hole. The object could be created using a 3D modeling tool.
  7. Using TextExtrude on Flash-generated vector graphics. Using the wumedia.parsers.vector.VectorShapes class from the swfvector library included in Away3D 2.4 it should be possible to add Flash 2D objects to the scene. This would be done in analogy to how the VectorText class is used in TextField3D. These shapes would represent the top and bottom surfaces. Then, the edges could be created by SkinExtrude on a path, or by applying TextExtrude to this shape. However, the VectorShapes objects are “irregular” shapes, not made up from triangles [source] and therefore not (yet) closely integrated with the rest of the library. For example, it’s currently impossible to add texture materials to such objects [source], but this is needed here.

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>