BitmapMaterial Transparency Bugs

Software: Away3D 4.x

Concept Z, Sr. Member
Posted: 02 August 2011 02:19 AM   Total Posts: 124

Got wrong render results when use the transparent BitmapMaterial, i think the bug is still not fixed yet…

 Signature 
signature_image

Anyone can cook but only the fearless can be great

   

John Brookes, Moderator
Posted: 02 August 2011 02:35 PM   Total Posts: 732   [ # 1 ]

Think the method is. Post a code example here. We all go oh yeah its a bug (in theory). Then post it on Git hub.
What the sticky says wink

ps not noticed any issues

   

Avatar
theMightyAtom, Sr. Member
Posted: 02 August 2011 03:24 PM   Total Posts: 669   [ # 2 ]

Here’s the two methods I’m using, one which works but gives jagged edges (as advertised), the other giving lovely blending, but showing the backs of some faces (unlit, i.e. black) and the front of others, similar to the defunkt transparent=true.

Method 1:

BirthdaySuit = new BitmapMaterial();
skin = new SkinCloth();
skinBmd = new BitmapData(20482048true0x00000000);
skinBmd.draw(skin);
BirthdaySuit.bitmapData skinBmd;
var 
bdm:BasicDiffuseMethod = new BasicDiffuseMethod();
bdm.alphaThreshold 0.3;
BirthdaySuit.diffuseMethod bdm

result:
http://www.videometry.net/broomstick/alphaTest/face_alphathreshold.png
(transparency is around eyelashes and eyebrows)

Method 2:

BirthdaySuit = new BitmapMaterial();
skin = new SkinCloth();
skinBmd = new BitmapData(20482048true0x00000000);
skinBmd.draw(skin);
BirthdaySuit.bitmapData skinBmd;
BirthdaySuit.alphaBlending true

result:
http://www.videometry.net/broomstick/alphaTest/face_alphablending.png
(nice lashes, nice eyebrows, unfortunate gaping big holes in face)

Hopefully it’s just me, and we can all have a big lads laugh about my miserable coding skills.raspberry

   

John Brookes, Moderator
Posted: 02 August 2011 05:53 PM   Total Posts: 732   [ # 3 ]

Think it gets messed up if its a single mesh
http://www.shrewballooba.co.uk/AlphaT/
Look along the red plane, notice the yellow box is opaque, but oh the other side the black box disapears.
Seems reversed in one direction.
Thats using
BitmapMaterial(Mesh(AssetLibrary.getAsset(“pPlane1”)).material).alphaBlending = true;

   

Avatar
David Lenaerts, Administrator
Posted: 03 August 2011 12:11 PM   Total Posts: 80   [ # 4 ]

It’s not exactly a bug per sé, it’s just a problem inherent to the way blending needs to happen.

For reference:
http://www.opengl.org/wiki/Transparency_Sorting

There’s not really a way to sort per-polygon without entirely loosing the advantage of using GPU in the first place. Try to either stick to using the “alpha test” mentioned in the article (accomplished in Away3D 4 using the alphaThreshold property), or stick to (near-)convex shapes.
If you look at real games, alpha blending is pretty rare - with the exception of planar objects (water, smoke particle and other effect billboards).

   

John Brookes, Moderator
Posted: 03 August 2011 12:13 PM   Total Posts: 732   [ # 5 ]

Noticed it does the same in Maya.
Good to know smile

   

Avatar
David Lenaerts, Administrator
Posted: 05 August 2011 11:21 AM   Total Posts: 80   [ # 6 ]

Okay, I’m gonna add this topic to my “to blog about” list wink For now, in addition to what I said before, please NEVER use alpha blending unless you really really need it (again, for simple almost-convex shapes it’s okay). For the head example, why would you enable alpha blending on the entire head? Either embed the eyebrows into a texture, or separate them into a SubMesh so they can use their own material which uses alphaBlending.
It’s all about clever content creation wink

   

Avatar
theMightyAtom, Sr. Member
Posted: 05 August 2011 08:49 PM   Total Posts: 669   [ # 7 ]

Thanks David, I’ll be able to do much cleverer content creation now cheese

   

Avatar
Darcey, Moderator
Posted: 06 August 2011 08:22 PM   Total Posts: 209   [ # 8 ]

You can fix this by using an older version of Away3D 3.5.0

I have posted the problem on git hub:
https://github.com/away3d/away3d-core-fp10/issues/5

   

Avatar
theMightyAtom, Sr. Member
Posted: 07 August 2011 05:43 AM   Total Posts: 669   [ # 9 ]

Thanks Darcey, but I think you overlooked the software version of the thread.
wink

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X