February 13, 2008 at 5:13 am
· Filed under Sandy3d, 3d, Graphics, BitmapData, Papervision3d, AS3
Uff… long time I don’t write here…
So… what I have been doing?
Actually… nothing interesting…
Then, couple days ago I started developing my own 3d engine.
I won’t make it public because it will take all my free time that I actually don’t have…
I didn’t run any benchmarks, I think it’s more heavy processing than Papervision3d.
anyway… here is it…
Permalink
December 4, 2007 at 7:22 pm
· Filed under Benchmark, Sandy3d, BitmapData, Performance, AS3
Well, I don’t know if anybody read the Thomas Pfeiffer aka Kiroukou (the Sandy3D creator and project leader) commented on my previous post.
Here’s what he said.
Indeed Sandy does a clone of the original texture, for few reasons:
- avoid an unfortunate dispose call.
- allowing to have a setTransparency method to dynamically change the transparency without changing the original bitmapdata of the user.
Concerning the lock() and unclock() are you sure it has a performance impact?
as far I know, this can’t provide any performance boost since the bitmapdata isn’t attached to the flash display list. When the object is out of stage, there’s no advantage to lock it.
But I’d be interessted to have your feedback about that, and your performance test.
About the BitmapData.clone(), he got his point.
It just don’t work for me because I’m using too many 3d Objects with different BitmapMaterial for each, so, the system memory gets too high.
But, about the setTransparency method, he is right.
About the lock and unlock methods, I runned a little benchmark test, because I got curious too how much performance boost you can get.
Here’s the two test I made. (Clicking on the flash area it will re-run the benchmark test)
Using the lock and unlock methods.
Not using the lock and unlock methods.
It’s a really simple test, just to make a benchmark test.
Actually, it’s not a situation that uses any 3d framework.
Creating a BitmapData.
Creating 1000 Bitmaps.
Applying 1000 times a BlurFilter over the BitmapData.
On my PC I get about 150ms faster with locking the BitmapData.
keita
Permalink
November 28, 2007 at 5:05 pm
· Filed under Sandy3d, BitmapData, Performance, Papervision3d, AS3
I was making some experiments with Sandy3d and Papervision3d and I realized some tips to increase the performance.
Firstly, with Sandy3d 3.0, when you create a BitmapMaterial, the BitmapData that you used to create the Material, is cloned to create the BitmapMaterial.texture.
So, one think you can do is dispose the BitmapData that you used to create the Material after instantiating it and also, if you want to update your BitmapData use the BitmapMaterial.texture directly.
Something like this:
var bmpData:BitmapData =
new BitmapData
(100,
100,
true, 0×00000000
);
var bmpMaterial:BitmapMaterial =
new BitmapMaterial
(bmpData
);
bmpData.dispose();
bmpMaterial.texture.fillRect(new Rectangle(10,10,30,30), 0xffff0000);
This will not work with Papervision3d because it uses the same BitmapData instance (in my opinion, smarter).
Now for both, Sandy3d and Papervision3d.
As you make changes on your BitmapData, it’s updated on every poligon.
So, use the BitmapData.lock() and BitmapData.unlock() when you are redrawing your BitmapData texture.
var bmpData:BitmapData =
new BitmapData
(100,
100,
false, 0×00000000
);
var bmpMaterial:BitmapMaterial =
new BitmapMaterial
(bmpData
);
redrawBitmap();
…
function redrawBitmap(){
bmpData.lock();
bmpData.fillRect(bmpData.rect, 0×00000000);
bmpData.fillRect(new Rectangle(10,10,30,30), 0xffff0000);
var blurFilter:BlurFilter = new BlurFilter(16, 16, 3);
bmpData.applyFilter(bmpData, bmpData.rect, new Point(0,0), blurFilter);
bmpData.unlock();
}
Permalink