devs question on materials 3.6

Software: Away3D 3.x

Avatar
Choons, Sr. Member
Posted: 07 August 2011 04:43 AM   Total Posts: 281

Hi guys,

This one is likely a devs question, but anyone who knows please provide input. So I’m looking at PhongBitmapMaterial and CompositeMaterial. I see that PhongBitmapMaterial extends CompositeMaterial. I also see that PBM sets up a TransformBitmapMaterial on the bitmapData object passed in the constructor, and adds an additional CompositeMaterial _phongShader object that contains a AmbientShader and a DiffusePhongShader. If a specular value is set, yet another layer is added directly to the base CompositeMaterial layer.

So there’s

addMaterial(_textureMaterial);
addMaterial(_phongShader);

and possibly

addMaterial(_specularPhongShader);

My question is do those shader layers make shading possible since they are “on top” in terms of coming last in the materials array of CompositeMaterial?

For instance, if I wrote my code in a way that I had a base CompositeMaterial and I added BitmapMaterials and TransformBitmapMaterials to it and then always made sure the top material layers were the same shader layers that PhongBitmapMaterial uses, would that give me shading as kind of an overlay to all the underlying material layers?

   

Avatar
Choons, Sr. Member
Posted: 08 August 2011 01:09 AM   Total Posts: 281   [ # 1 ]

I can confirm this does work after all. Actually it apparently doesn’t matter if the shaders be “on top” just as long as they are there in the CompositeMaterial. So I’ve managed to come up with what I’d call CompositePhongMaterial. The shaders just get added once as their own materials, and any TransformBitmapMaterials or simple BitmapMaterials added to the base compositematerial get the benefit of shading automatically. cheese

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X