context3D.drawToBitmap and alpha blending

Software: Away3D 4.x

cauliflower, Newbie
Posted: 21 August 2012 11:11 AM   Total Posts: 7

hi!

i am capturing a webcam video and draw it to the background of my View3D instance. Then I have various meshes in my Scene3D to which i apply TextureMaterials with different alpha values. in “live view” alpha blending seems to work perfectly well. however, as soon as i take a snapshot by calling context3D.drawToBitmap(...), blending settings seem to vary. my transparent meshes in the snapshot look different as in the “live view” on the stage. there is still some transparency, but the blending method seems to differ.

anyone has any ideas how to fix that problem?

thanks in advance,
j.

 

   

parele, Jr. Member
Posted: 21 August 2012 12:00 PM   Total Posts: 43   [ # 1 ]

Just by looking at the picture, I’m taking a guess here but could it be the light shading?
for instance in a 3d scene different lighting helps better angles, your bitmap capture doesn’t capture the lighting…. just a guess

   

cauliflower, Newbie
Posted: 21 August 2012 12:03 PM   Total Posts: 7   [ # 2 ]

i don’t think its the lighting as all non-transparent meshes render correctly in the bitmap.
in case it really has something to do with lighting, how could i fix the problem of not capturing the lighting in the snapshot?

   

parele, Jr. Member
Posted: 21 August 2012 12:19 PM   Total Posts: 43   [ # 3 ]

looking at it the picture again i realized the glasses seem to not render correctly compared to the live view, maybe try a different method of capturing the bitmap , I have used Blit-mask in the bast as this has different functions capturing is one of them, but it captured transparency fine just an idea.

sorry i cant be any use to you Im only an uneducated novice.

   

cauliflower, Newbie
Posted: 21 August 2012 12:32 PM   Total Posts: 7   [ # 4 ]

as far as i can see BlitMask only works with DisplayObjects. Stage3D content is not part of flash’s display list and cannot be drawn like normal DisplayObjects.

the only means of capturing Stage3D content is calling context3D.drawToBitmap(...). am i correct?

   

cauliflower, Newbie
Posted: 21 August 2012 01:34 PM   Total Posts: 7   [ # 5 ]

i found out what is happening! something really strange is going on.

as i’ve said, i have got transparent meshes in front of the opaque view.background (which is always opaque anyway). when i call context3D.drawToBitmap(...) i get a bitmap data that is transparent in those places where the transparent meshes are in the live scene, although the background behind it is opaque and i expected the bitmap data to be opaue there too. in fact that would be the correct output!
when i then make a bitmap from the bitmap data and add it to the display list on top of a white background i get the effect shown in my attached image.

   

parele, Jr. Member
Posted: 21 August 2012 01:42 PM   Total Posts: 43   [ # 6 ]

its good to see you worked it out, im stuck on the VideoMaterial

   

Richard Olsson, Administrator
Posted: 22 August 2012 07:19 AM   Total Posts: 1192   [ # 7 ]

Are you using Context3D.drawToBitmapData() directly? You should be using View3D.renderer.queueSnapshot() instead, and I’m surprised accessing the drawToBitmapData() directly even works. See if changing to queueSnapshot() works better. Otherwise, if you believe this is a bug in Away3D, please file a bug report at http://github.com/away3d/away3d-core-fp11/issues

   

cauliflower, Newbie
Posted: 22 August 2012 10:09 AM   Total Posts: 7   [ # 8 ]

i am using View3D.renderer.queueSnapshot(). however this method calls context3D.drawToBitmap(..) in the end. I don’t think its an Away3D bug as I tried to call drawToBitmap(..) directly (i had to do some additional programming to make drawToBitmap(...) work) as well which causes the same problem. so i guess its a bug in the drawToBitmap implementation

   

Richard Olsson, Administrator
Posted: 22 August 2012 10:12 AM   Total Posts: 1192   [ # 9 ]

That’s not necessarily true. It could be a backbuffer configuration issue. Please file a bug anyway and we’ll just close it if we do end up concluding that we can’t do anything about it.

   

cauliflower, Newbie
Posted: 22 August 2012 10:15 AM   Total Posts: 7   [ # 10 ]

i currently don’t have a github account, which i actually need to post an issue

   

Richard Olsson, Administrator
Posted: 22 August 2012 10:32 AM   Total Posts: 1192   [ # 11 ]

Ok. I filed it for you: https://github.com/away3d/away3d-core-fp11/issues/397

   

Avatar
Alexander Seifert, Moderator
Posted: 22 August 2012 07:30 PM   Total Posts: 129   [ # 12 ]

cauliflower,

are you using Flash 11.4 Beta by any chance?
There was a bug reported in drawToBitmap with that Beta version that looks exactly like yours. It was reported to have been fixed with 11.4 Release, which was pushed online yesterday.
Who knows, maybe updating to 11.4 fixes it even if you were using 11.3 all along.

 Signature 
signature_image

http://www.deltastrike.org

   

Manuel L., Member
Posted: 26 November 2012 03:28 PM   Total Posts: 99   [ # 13 ]

problem stil exists, doesnt it?
when i do:

view.renderer.swapBackBuffer false;
view.render();   view.stage3DProxy.context3D.drawToBitmapData(bm.bitmapData);
view.renderer.swapBackBuffer true

it works, but textures with alphaBlending are looking bad.

when using:

view.render();
view.renderer.queueSnapshot(bm.bitmapData); 

nothing is drawntobitmap.


any ideas?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X