I have managed to implement specular masking with some minor
modifications to the PhongBitmapMaterial class. It would be possible
to implement them by creating another material class (it is a fair bit
of work to implement the CompositeMaterials required to get this
effect working), but minor modifications to the existing class make it
a breeze. Basically, I have made the _specularPhongShader a child
material of a new _specularShader:CompositeMaterial. I have also added
a getter/setter for a _specularMask property that allows you to assign
a material as a mask.

You can see an example here:

http://away3d-dev.googlegroups.com/web/specularmask.swf

Use the checkbox to toggle the specular mask on and off. This is
especially useful for materials that have variable specular levels
across the surface (brand new car covered in dirt, polished stainless
steel with brushed portions, etc.). In this case the specular mask
being applied is a bitmap material with a checkerboard. However, this
technique will also support semi-transparent materials.

With some minor modifications, I think I can get the this demo working
with a single specular mask that affects specular transparency and
specular colour across the surface of the object. The current
implementation doesn't appear to be causing a big hit in terms of
performance, and I think the specular tinting won't be too much of a
hog either.

How do I go about proposing this as an addition to the future builds
of Away3D?

Thanks again for such a great engine!

Reply via email to