The result is:

  • In Away3D 2.4 you can get only Phong shading by using a CompositeMaterial with two layers, one being a TransformBitmapMaterial, and one a white or gray PhongColorMaterial for the shade. You can not get the faster flat shading, because WhiteShadingBitmapMaterial does not implement ILayerMaterial.
  • In Away3D 2.3 you can get both Phong shading and flat shading by using a CompositeMaterial again, with two layers, one being a TransformBitmapMaterial, the other being a white or gray PhongColorMaterial or a white or gray WhiteShadingBitmapMaterial.

Detailed discussion of possible ways and why they are possible or not:

WhiteShadingBitmapFileMaterial modification for Away3D 2.4. This would enable flat shading together with bitmap transformation in Away3D 2.4, but it is quite some effort. So the better alternative would be to switch to Away3D 3.5 and proceed as above. But, for an outline: this needs the implementation of WhiteShadingBitmapFileMaterial as an extension of BitmapFileMaterial (which again is a TransformBitmapMaterial, enabling bitmap transformations). Another option would be to extend BitmapFileMaterial to include flat shading; which could be quite a complex thing. And another option would be extending WhiteShadingBitmapMaterial to include bitmap transformation abilities. Which could be the simpler alternative.

Using BitmapMaterialContainer / CompositeMaterial. Works, with the limitations stated above. The idea is to combine the current BitmapFileMaterial with an overlayed, semi-transparent or otherwise composited white shaded material. In Away3D this cannot be a WhiteShadingBitmapMaterial, as this class does not implement ILayerMaterial which is needed to be used for BitmapMaterialContainer. In Away3D 3.5 however, the corresponding CompositeMaterial operates on BitmapMaterial objects, so that using WhiteShadingBitmapMaterial as a composite layer becomes possible. It seems that such a composite material solution has also a good performance for not-too-complex scenes. Some hints to parameters that influence compositing:

  • BitmapMaterial#alpha and / or #blendMode attributes
  • BitmapMaterialContainter#transparent

Using a pre-made composite material like a Phong or Dot3 shading material. Using such a material on its own does not help here, as these materials do not allow texture bitmap transformations in either Away3D 2.4 or 3.5.

Leave a reply

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