Motion blur

Software: Away3D 4.x

Avatar
GoroMatsumoto, Sr. Member
Posted: 09 October 2013 10:15 AM   Total Posts: 166   [ # 16 ]

Hmm.

If you felt complexity on the filter class,
I recommend avoiding the 2.
Because coding a custom MaterialMethod is more complex.
Watch “getFragmentCode()” function.
https://github.com/away3d/away3d-core-fp11/blob/master/src/away3d/materials/methods/FogMethod.as

You have to understand about Away3d’s shader register pool classes too.
Not only AGAL. It’s so hard.

I don’t know whether the 1 is easier way.

   

andreahmed, Member
Posted: 09 October 2013 11:14 AM   Total Posts: 62   [ # 17 ]

I got another idea. I won’t care about both frameworks, and just start with the stage3d, and get a vertex, pixel shader works, with motion blur, as an abstract way, then add the result to away3d texture, providing the context3d,..etc.

Will just work with the first abstraction layer.

   

andreahmed, Member
Posted: 10 October 2013 09:42 AM   Total Posts: 62   [ # 18 ]

What is the mature way or the correct way for adding the motion blur, If i hate a lot of symbols, and each symbol has its own material or texture. Should I blur each symbol’s texture ?

This is scenario, but If I have another scenario, that I have all the symbols or the bitmaps are embedded in just one texture, should I add blur for the resultant big texture ? it will be slow ?

   

Avatar
GoroMatsumoto, Sr. Member
Posted: 10 October 2013 10:41 AM   Total Posts: 166   [ # 19 ]

Maybe, you should try CPU blur.
And if I’m have same problem,
I will make each reel’s texture as bitmapdata on the fly.
And blur them on CPU.

   

andreahmed, Member
Posted: 10 October 2013 11:48 AM   Total Posts: 62   [ # 20 ]

is there a way to convert the material to bitmapdata ? or converting the texture to bitmapdata?


You know, I’m sure 100% that downloading from the GPU to CPU will be really really slow.

   

Avatar
GoroMatsumoto, Sr. Member
Posted: 10 October 2013 12:43 PM   Total Posts: 166   [ # 21 ]

No no. Sorry, maybe my english was not so good.

At first, you make a bitmapdata.
And convert it to a texture and upload to GPU.

And on each frame, blur the bitmapdata, convert one, and upload.

Good luck.

   

andreahmed, Member
Posted: 10 October 2013 01:04 PM   Total Posts: 62   [ # 22 ]

yes but adding motion blur in that way, is really CPU consuming correct?
How would I change the blur dynamically, If I had to add it while bluring the bitmapdata?

   

Avatar
GoroMatsumoto, Sr. Member
Posted: 10 October 2013 01:17 PM   Total Posts: 166   [ # 23 ]

Just change blur amount.
About the performance,
you should try and confirm it by yourself.

   

andreahmed, Member
Posted: 10 October 2013 01:21 PM   Total Posts: 62   [ # 24 ]

My main problem is : I had to iterate through the bitmaps and apply filter to them, then make a big texture out of them, then model the cylinder.

So I can not add a motion blur in that case
In Each frame, I do that:
but the bitmaps should be dynamically loaded, and texture with model with them, and have gradual blur over the bitmapsdata, and that is impossible in that way, because I have to create again the last bitmaps ( symbols) that was there before bluring and upload them to texture…

TweenMax.delayedCall(4onFinish);
  function 
onFinish():void
  {
   
if ( loader[0])
   
{
    
var mesh:Mesh Mesh(loader[0].getChildAt(0));
    
    if (
Update)
    

     Update 
false;
     var 
matrix:Matrix = new Matrix();
     
     for (var 
j:int 0bitmaps.lengthj++) 
     
{
      
      blur
.blurX 10
      
blur.blurY 10
      
blur.quality BitmapFilterQuality.MEDIUM;
      
bitmaps[j].applyFilterbitmaps[j] ,new
       
Rectangle(0,0,128128),new Point(0,0),blur);
     
}
     
     
     
// draw 36 
     
var offsetx:Number 0;
     var 
offsety:int  0;
     for (var 
i2:int 0i2 2i2++) 
     
{
      
      
for (var j:int 016j++) 
      

       
       matrix
.identity();
       
matrix.translate(offsetx,offsety);
       
render.draw(bitmaps[j]matrix);
       
offsetx+=128;
      
}
      
      offsetx 
=0;
      
offsety+=129;
     
}
     
     
for (var j:int 04j++) 
     

      
      matrix
.identity();
      
matrix.translate(offsetx,offsety);
      
render.draw(bitmaps[j]matrix);
      
offsetx+=128;
     

     
     m_BlurText 
= new TextureMaterial ( new BitmapTexturerender) ) ;
     
      
mesh.material m_BlurText;
    
}
    
   }
   
    TweenMax
.delayedCall(5finish);
    
    function 
finish():void{
     mesh
.material m_finalText;
     
    
}
   
  } 
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X