How to create some crazy materials with Away3D?

Away3D offers the CompositeMaterial class that allows to combine different material layers into one, using different compositing modes. (Note that this applies to Away3D 3.4; in version 2.4, the concept is split so that you have a class BitmapMaterialContainer additionally, which is only for cached materials, that is those that are not changed once applied.)

In my experiments I found that one can get some surreal, crazy materials by combining a texture with a “shade” in strange ways:

var textureMaterial : BitmapFileMaterial = new BitmapFileMaterial(imageUri, {precision: 0, repeat: true, smooth: true, blendMode: BlendMode.NORMAL});

var shadeMaterial1 : PhongColorMaterial = new PhongColorMaterial(0xffffff, {shininess: 5, specular: 0.5, alpha: 1, blendMode: BlendMode.DIFFERENCE});

var shadeMaterial2 : PhongColorMaterial = new PhongColorMaterial(0xffffff, {shininess: 5, specular: 0.5, alpha: 1, blendMode: BlendMode.LIGHTEN});

var crazyMaterial1 : CompositeMaterial = new CompositeMaterial({alpha: 1, color: 0xFFFFFF});

crazyMaterial1.addMaterial(textureMaterial);

crazyMaterial1.addMaterial(shadeMaterial1);

var crazyMaterial1 : CompositeMaterial = new CompositeMaterial({alpha: 1, color: 0xFFFFFF});

crazyMaterial1.addMaterial(textureMaterial);

crazyMaterial1.addMaterial(shadeMaterial2);


Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.