Is is possible to Set View Background transparent

Software: Away3D 4.x

cosophy, Newbie
Posted: 26 July 2011 12:44 PM   Total Posts: 5

Hi,

when rendering ,the backgound is black by default. and you can set
view.backgroundColor to change the color of background. But can I make it transparant so I can paste it to the 2D scene.

   

Avatar
theMightyAtom, Sr. Member
Posted: 26 July 2011 01:43 PM   Total Posts: 669   [ # 1 ]

The short answer is no.

The bit longer answer is, maybe in the future (there is a Stage3D.transparent flag, that dosen’t appear to do anything in the current player)

The “I can’t wait” answer is you could take a snap shot from your 3D scene, key out the background, and have it as a Bitmap in Flash.
I havn’t tried doing that yet, not sure if the overhead is too big for animation, but I intend to give it a go sometime.

Alternatively, and the way I do it at the moment, is to make a “background” (Plane primitive) in the 3D scene where you can show images and video, with your objects on top.
You just need to keep the plane at a fixed point infront of your camera, and facing into the camera.

It’s been suggested a couple of times that a backgroundImage feature could be added to Away3D 4.0. Hope so smile

   

cosophy, Newbie
Posted: 26 July 2011 02:34 PM   Total Posts: 5   [ # 2 ]

For optimization, I was thinking about convert the view to a Bitmap at advance, then use 2D bitmap to display the 3D object.
But I think I can use bitmap.draw() or copyPixel() to get information from View3D into a bitmap, no? And then filter some background color like blue color.

   

Avatar
David Lenaerts, Administrator
Posted: 26 July 2011 03:03 PM   Total Posts: 80   [ # 3 ]

I figured the Stage3D::transparent property didn’t work since the View3D’s backbuffer was always cleared with alpha 1. So I added a backgroundAlpha property (that automatically sets the correct transparent value on Stage3D). However, it still doesn’t seem to affect things (maybe it will still show StageVideo behind it). Ah well, at least we’re future proof with that wink

   

Avatar
theMightyAtom, Sr. Member
Posted: 27 July 2011 10:24 AM   Total Posts: 669   [ # 4 ]

Here’s a (dis)proof of concept for placing Molehill content above Flash content.

http://videometry.net/broomstick/transparentMolehill/

source:
http://videometry.net/broomstick/transparentMolehill/transparentbg.as

The framebuffer is swiped from Away3D every frame using
_view.renderer.context.drawToBitmapData(outputBmd)

The background (bright green) is then removed.
That way you have your 3D scene as a Bitmap that’s part of the normal flash display list and can be placed on top of editable content (text field in this example) and other filters applied (e.g. Glow)

As the example demonstrates, doing this every frame is just too heavy, but the technique can be used for other things, for example to build reflection maps automatically from a scene.

For now I’d recommend placing your 2D content on a Plane in your 3D scene if possible. Fully hardware accelerated Augment Reality (Molehill over HD video) will just have to wait…

Props to Quasimodo for the Chroma Key filter:
http://code.google.com/p/quasimondolibs/source/browse/trunk/quasimondolibs/com/quasimondo/shaders/DifferenceKey.pbk

Cheers!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X