Author Topic: Buffer to BitmapData?  (Read 158 times)

Dave   «   on: July 27, 2017, 05:22:38 AM »
I have an occlusion model in my scene that is used like so:

Code: [Select]
						
scene.context.setColorMask(false, false, false, false);
var containers : Vector.<Pivot3D> = occlusionNodes;

var group : Pivot3D;

for(var i:int = 0; i < containers.length; i++) {
group = containers[i];
group.draw();
}

scene.context.setColorMask(true, true, true, true);


Is it possible to get a BitmapData of this colorMask?

Ariel Nehmad   «   Reply #1 on: July 27, 2017, 07:38:25 AM »
Hi dave, try

Code: [Select]
scene.context.drawToBitmapData(bitmapData);

Dave   «   Reply #2 on: July 28, 2017, 04:10:13 AM »
Hi - thank you! I am using that, and it works however I don't seem to be able to get alpha channel? I'm no longer using that occlusion code and have just a scene with one model in it. I use drawToBitmapData to a transparent bitmapData, but get black where there is nothing. Can I get alpha there? Right now I just threshold that to get what I need, but it's an extra step I'd rather not have to take.

Ariel Nehmad   «   Reply #3 on: July 29, 2017, 12:35:39 AM »
Before drawing, maybe try to clear the context buffer with alpha = 0.0

Code: [Select]
scene.context.clear( 0.0, 0.0, 0.0, 0.0 );

or if you're using the scene's one.

Code: [Select]
scene.clearColor.w = 0.0;

Tags: