Delay in snapshotting render buffer?

Software: Away3D 4.x

Mr Margaret Scratcher, Sr. Member
Posted: 04 April 2014 03:01 PM   Total Posts: 344

Hi there,

I’m trying to fake blurring/ muting the background to focus on a selected object by moving the object to a new scene, queuing a snapshot, writing the bitmapdata to a bitmaop, which I then blur and darken before switching to the other scene and using the blurred/darkened bitmapdata as the background for the view.

The machanics of it work, however there seems to be a delay in the snapshot, so that the scene has already switched by the time I the bitmap data gets snapshotted…

This is part of the as:

private function fadeBGout():void
     {
      trace 
("fading out bg");
      var 
stageBMD:BitmapData = new BitmapData(view.widthview.height);
      
view.renderer.queueSnapshot(stageBMD);
      
view.scene mainScene;
      
stageBitmap = new Bitmap(stageBMD);
      
stageMC = new MovieClip();
      
stageMC.addChild(stageBitmap);
      
      var 
targetHeight:int 256;
      var 
targetWidth:int 256;
      
trace ("stageMC width is " stageMC.width);
      
trace ("stageMC hieght is " stageMC.height);
      
      
stageMC.scaleX targetWidth stageMC.width;
      
stageMC.scaleY targetHeight stageMC.height;
      
      
updateViewBG true;
      
trace ("stageMC width is now" stageMC.width);
      
trace ("stageMC hieght is now" stageMC.height);
      
      
//just to test...
      
addChild(stageMC);
      
      
FilterShortcuts.init();
      
      
Tweener.addTween(stageMC{_Blur_blurX20_Blur_blurY20_Blur_quality:2time:.5transition:"linear"onComplete: function():void {updateViewBG false}} );
      
      
     

 

   

Avatar
theMightyAtom, Sr. Member
Posted: 04 April 2014 08:02 PM   Total Posts: 669   [ # 1 ]

When are you calling render?
stageBMD should get the next view.render after you set this all up.

   

Mr Margaret Scratcher, Sr. Member
Posted: 05 April 2014 02:03 PM   Total Posts: 344   [ # 2 ]
theMightyAtom - 04 April 2014 08:02 PM

When are you calling render?
stageBMD should get the next view.render after you set this all up.

Well that’s what i thought, but even if I do view.render and then call the function that swps the scenes I get a snapshot of the new scene rather than my desired initial scene..

I’ll try to break it down into a basic exmple to show you, and no doubt in doing so I’ll realise where I’m being silly and solve my own problen smile

   

Avatar
theMightyAtom, Sr. Member
Posted: 05 April 2014 04:32 PM   Total Posts: 669   [ # 3 ]

smile

I’d check out the depthOfField effect too. I’ve been studying it to try that AmbientOcclusion filter, and it actually works really well.
You can specify an object and have the depth set to make that object in focus (or just the depth). Maybe with a combination of blur and materials you could avoid the big workaround?

Cheers!

   

Mr Margaret Scratcher, Sr. Member
Posted: 05 April 2014 10:59 PM   Total Posts: 344   [ # 4 ]

Ha, well as I was typing my initial question I started to write something along the lines of ‘to get a depth of field effect’ and immediately though ‘Ahhh you dick just use the depthOfField filter’ but then tried it and got a black screen. However I didn’t pass it an object to focus on, so maybe that’s it. I was also probably running Flashdevelop in Virtualbox (rather than booted into windows) which seems to suffer with some weird graphics issues - eg skyboxes are all broken, I get weird results snapshotting the render buffer..

 

   

beers, Member
Posted: 06 April 2014 12:35 AM   Total Posts: 53   [ # 5 ]

Note that Filters dont work if you’re using layered/stacked view3Ds. You get a black screen on the bottom layers. just thought i’d throw that out there from my own experience.

Maybe they’ll fix that in a future release but who knows.

beers

   

Avatar
theMightyAtom, Sr. Member
Posted: 06 April 2014 09:32 AM   Total Posts: 669   [ # 6 ]

I had trouble getting good results with the DOF filter to start with.
I made this test scene to find the sweet spot
http://videometry.net/away3d/dof/

   

Mr Margaret Scratcher, Sr. Member
Posted: 07 April 2014 05:35 PM   Total Posts: 344   [ # 7 ]

So yeah, DOF kind of does what I’m after, I might look into tinkering with the filter to get it to de-saturate and darken too..

PS love the Phony Disco Mania!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X