HELP PLEASE (Dec 12, 2016)......Uniform Alpha Applied to Multi-Part Container

Software: Away3D 4.x

rich, Newbie
Posted: 09 December 2016 07:38 PM   Total Posts: 17

Any help would be much appreciated….thoughts????

I have a multi-part object (root->child1,child2,child3, etc) where alpha should be applied in a uniform manner as it is in straight Flash/Flex. 

For example, In flash, if I change the root alpha, the alpha of the entire ui graph is faded as if it were a single, image where transparency were applied.

Currently, in Away, I can apply alpha to each part material, etc. but I’m not sure of a way to apply alpha in a uniform way.  One thing I’m wondering if there is a shader or “method” that would allow a pixel-level alpha application.  Or, even better, some “container/wrapper/mask” that would allow the entire graph of meshs to have a mask applied with alpha.

The attached image is what it is currently doing: bad.png (Left Img.)
What it should be doing is as follows: good.png (Right Img.)

Additionally, what I’m looking for is the “BlendModel.Layer” example from here:
http://www.zedia.net/2008/blendmodelayer-a-must-when-changing-alpha-of-a-displayobject-containing-other-displayobject/

 

   

Avatar
Fabrice Closier, Administrator
Posted: 12 December 2016 07:58 PM   Total Posts: 1265   [ # 1 ]

There is no ColorTransform on containers.

You simply need to write a recursive method to set the alphas to encountered materials. if the alphas are to be different, keep track of current alpha and build while parsing a dictionary of the current alphas of material. Which if the dictionary exist, will first restore the original alpha and then add the new value to the original.

another way to do the same is simply to keep track of each materials that you generate, or at least the group that you want to update. then when you change alpha, simply make a “updateAlphaToGroup” method and in it, you loop over your materialBase vector.

   

rich, Newbie
Posted: 12 December 2016 08:31 PM   Total Posts: 17   [ # 2 ]

Hey Fabrice,

Thanks for your response.  Whenever I set the alpha on the individual BitmapData or to the TextureMaterials, the result is the same…the overlapping section of the upper and lower object (knee) is a little darker than the corresponding parts (it seem additive).  I want the upper part to show with alpha applied without adding any of the bottom part’s pixel’s / alpha.

You may have spoken to this in your response, so my apologies if so, I’m a bit lacking in knowledge when it comes to this part of Away3d.  So when you speak of using a custom “method” do you mean a subclass of the EffectiveMethodBase such as “AlphaMaskMethod”?  If so, do you have any examples that I could refer to? 

Here is how each part of my image is constructed:
var texture:BitmapTexture = new BitmapTexture( bd,true );
material = new AdvancedTextureMaterial( texture, true );

Thanks,
Rich

   

Yann, Newbie
Posted: 12 December 2016 11:32 PM   Total Posts: 16   [ # 3 ]

hello!
I believe you want one specific blendmode “inside” your container, and another blendMode fo the rest of your scene…For example, the upper part of the transparent leg hides the lower part, but not the background… it’s going to be hard to achieve. Have you already tried to play with the “blendmode” parameter of the texturematerial class? just to see if it changes something?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X