1 0 Tag Archives: fast

R4 – PV3D Music Visualizer (WIP)

Update: I have uploaded the source for the visualizer and a new version in this post.

The past month has been lazy and utterly boring. However, I still managed to work on two projects. I put the PaperKing3D project aside and did not have the energy to complete it. i did finish working off from an alpha version of my PV3D music visualizer. I call it the R4-Visualizer. You can take a look at it below:

And don’t forget to press the SPACEBAR to see the other modes ;) .

I will release a source once I am finished with it completely. I have worked on Opensteer as well and the plugins are now there. I will be uploading the sources for opensteer soon. However, I am still working on it and it is NOT working whatsoever, simply because I have not written the code for that :P . You can also download the Visualizer above from here and to use it, just put an mp3 file named “sound” next to it and it will work great. Oh, and before I forget, I made a simple wallpaper out of the fantastic Visualizer, you can download it from here.

Regards,
MHAQS

Read full story »

Pixel Based Operations in Flash and Processing

Recently, I have been working on many pixel level projects with Flash. My experience with these projects was somewhat disappointing when it came to Flash’s rendering of pixel based effects. A normal pixel based operation in Processing would not take more than 10% of your CPU, where Flash would take up to 50% of your CPU. Some functions such as ‘set vertex/point/pixel(position)’ (available in many graphic APIs these days) seem to be missing in Flash and are only available for a specific class called the BitmapData class. Performing pixel manipulations on this class can render things fast but still not fast enough. I hope Flash CS4 brings its attention towards this.

Overall, Processing is very efficient than Flash regarding pixel based operations. I have gone through many article systems made for Flash and their performance stays best to heavy CPU usage even with the use of AS3. For example, Flint, is a very good particle system but suffers with the same problems. Although, it is fairly obvious from the way Flash was designed that pixel level operations were not given a priority but I feel this takes a big chunk of users right out of Flash’s community.

Take the following example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import flash.display.Bitmap;
import flash.display.BitmapData;
 
var myBitmapData:BitmapData = new BitmapData(500,500, true, 0xffffff);
 
var myBitmapImage:Bitmap = new Bitmap(myBitmapData);
myBitmapImage.cacheAsBitmap = true;
myBitmapImage.smoothing = true;
addChild(myBitmapImage);
 
function DrawNoise(e:Event):void
{
for (var i:int = 0; i < 10000; i++)
{
var pcolor:uint = 0x50000000;
myBitmapData.setPixel32(Math.random() * 500,Math.random() * 500,pcolor);
}
}
this.addEventListener(Event.ENTER_FRAME,DrawNoise);

Run this program in Flash AS3 and you’ll notice how much CPU is used running such a simple example. Creating sprites would take that meter to 75% at times. Run the same example in Processing:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void setup()
{
size(500,500,P3D);
}
 
void draw()
{
stroke(0,5);
 
beginShape(POINTS);
 
for (int i = 0; i < 10000; i++)
{
vertex(random(500),random(500));
}
endShape();
}

The difference should be very obvious. If you have seen Flash CS4 features and the Quake Demo running on AS4, you might feel happy to think that Flash CS4 would pay much attention to the rendering engine currently used by Flash. Mostly in all cases, I give Processing an edge over many aspects of graphics routines that Flash lacks for the time being. If you’re into Particle based systems, Flash is not the tool for you.

M.H.A.Q.S.

Read full story »