1 0 Tag Archives: processing

Attention Everyone… (as3steer, papersteer, r4 visualiser updates)

UPDATE: This release has been superseded by a new release. Please see this post.

Update:  I found a memory leak in the AS3Steer branch and uploaded a quick fix. The branch also contains an example now.  If anyone wants to have a visual look into it, please check out the google repository. This will also show how differently Opensteer handles Flocking compared to other flocking algorithms.

I had to no idea what to name this post :P . Yes, I’ve been away again. My job has really taken me away from my personal interests. Nevertheless, there are people on the web that motivate me to get back into my work and update it. I have so much to write and I don’t know what to write first about…

Well to start off, I missed to write about some wonderful news on the web and that was the release of Processing getting out to BETA. I believe, I always loved processing even before Flash or Action script came into my consideration. If you do not know what processing is, I recommend you read Daniel Shiffman’s newly published book about Processing. It is worth the time and your hard earned money (highly recommended).

Further up, I have had many of my personal projects begging to be shared and uploaded. I am highly endowed to the people on the internet helping the community with their precious time. Thank you everyone…

I have uploaded a working copy of PaperSteer to the Google Repository. The core of library has been checked a million times by me, so it shoudl work without any issues. I have branched PaperSteer:

AS3Steer
This version is no nonsense heart of the OpenSteer library. This version is purely actionscript. It is optimized and not a direct port of its ancestor. I have removed the annotation, the plugins, and drawing classes as well as many amounts of non understandable code, just so that anyone who picks up OpenSteer for Actionscript can work with it. People have been asking me for an example of how to use the library with ActionScript. Well, I did not think it was that difficult, but here it is anyway.

PaperSteer
Now this version is a direct port of its ancestor. I am kind of happy that I managed to port the (not so much easy to understand) opensteer library in its originality. Here are the updates in big points:

- Flash Player 10 support.
- There are heavy optimizations there that WILL speed it up. These optimizations include:

Type casting
Function reductions

Typed Arrays and what not…

- Plugins are there now for anyone’s reference and YES they are working
- The drawing routine has been re written entirely, but is buggy and I am working on it. You’ll immediately notice it.
I call this revision a BETA. If you have not gone through the papersteer repository yet, I recommend you may give it a try.

So, that’s about it for PaperSteer. I have some more goodies to share ;) .

I have had an enormous response for my R4 – Music Visualizer. People have been searching and asking for its sources. I remember, I promised to share the sources once I was finished with it. But frankly I left it midway as I had other things to do. Even then, below is the current shape of how it looks like. And here are the sources ;) . Go make crazy stuff.

I made a 3D version of the Boids algorithm for Papervision3D as well. This is only to help people who may want to program this behavior in PV3D. You can replace those cones with actual Bird DAE’s and it’ll be more than you expect it to be. The sources here.

Next up are my naughty friends from nowhere. I just love them. You will too. Sources here

Am I forgetting something? Oh yeah, I have a download section now. People keep asking me where they can download certain stuff or libs that were posted earlier on the blog. For a hint, I have fixed:

Vector3D class
Why use it when Adobe has a Vector3D class built into Flash 10? Well, go see for yourself. I have spent too much a time to make this the ultimate Vector3D class there can be :) .

The Colors Class
I missed the XNA and AS2 Colors class so much that I created this nifty class to help out in my color cycles. It has many colors to choose from and it helps you convert between RGB, Vector and Hex values.

There are other utility classes in the Tabinda.net utils package. Pretty useful stuff if you ask me. Go check all of it out. Whew! I think that’d to for today.

Read full story »

Birds Flocking Behavior

UPDATE: I have released a complete working port of Opensteer for ActionScript 3. Please see this post.

When I was working on the paperwork for this website, I promised that I will share source code and tutorials for people. I have been pretty active working with many projects lately, and I rarely find time to practice my interests. There are so many great examples and pieces of art out there that I take inspirations from. Much of it involves working with Visual Algorithms and I get to have a great time learning them and re implementing them to my pleasure. This serves me education and releasing them in a new form will eventually serve the community.

This time it is the famous Birds Flocking Behavior Algorithm using Boids. I converted it to Action Script 3. This algorithm can be very useful in areas of visual programming and games. Also, I have been busy working with PaperVision 3D for quite some time. I’ll release a PV3D version of this Algorithm soon. So keep an eye out for that too.

The source code is attached below and if you have questions, do ask. Also, if you need to study this algorithm, you may search around the internet and you’ll find many articles about it.

Regards,
M.H.A.Q.S.

flocksimulation.zip

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 »