January 23, 2010 at 3:29 pm
· Filed under English, book, unity3d

I don’t read tutorial books. For learning new I simply start building something and learn by try and fail –method. Because of my human brains when I’m enjoining I’m motivated and consequently learn easily.
I also get bored. Change must be constant and therefor I decided to shift the learning pattern when Mr. Rohit Shetty from Packt Publishing asked me to do a book review.
Read the rest of this entry »
Permalink
December 13, 2009 at 8:14 pm
· Filed under AS3.0, English, Experimentals, flash

Modified an egg from Mandelbrot set. Few running numbers will sculpture it endlessly.

Trapped Julia set.
I know people who ones get into fractals and never came back. I hope I’m not one of those.
Permalink
December 6, 2009 at 2:34 pm
· Filed under AS3.0, English, flash, tips

(Warning! this will be technical mumbojumbo)
In real time computer graphics one thing has given headaches to artist for years: Z-sorting (iow. Z-buffering). Everything goes great until you need to sort objects on screen. It simply eats your CPU. In AS3 this is a huge bottle neck. Yeah the drawing is rather slow but sorting is even more slow. If the challenge is demanding you just need to be equally smart.
As you may have noticed in my works the z-sorting doesn’t seems to be very big issue. For example the GameOfLife3D rolls 13824 particles and does dozen other stuff as well. In worst case just the sort can take up to 40ms in every frame.
When creating an engine of 3D the handling and z-sorting of objects should not thought as separated blocks. To gain performance every piece need to work together. The perfect symbiosis has to be found to serve all step of the system.
Read the rest of this entry »
Permalink
November 28, 2009 at 1:11 pm
· Filed under AS3.0, English, Experimentals, flash

Here you see 1000 particles connecting each other if they travel close enough.

Abstract form of connections.

Combine 3D sphere into dimension two by connections.

Connections in 3 dimensions.
Optimizing is everything. More you can optimize more powerful your tools become and you can do more. I never get tired of researching more ways to optimize.
First level of optimization is to get current code to run as efficient as possible by cutting off all unnecessary method calls and maths. Also strict typing and bitwise solutions need to be thought.
Second level is to think about the concept. Like in these demos if all objects check their distance with all objects the cpu will freeze. The solution is to split the scene into grid and push objects into those blocks according their coordinates. With that the distance check can be crop to affect only objects that are near.
Third level is something that I haven’t reached yet so don’t know anything about it yet.. :)
Permalink
November 26, 2009 at 4:43 pm
· Filed under AS3.0, English, flash, tips
Time to time a developer has to ask from Self: “is this really the fastest way to do it?”
After some investigation in most cases the result is “no it wasn’t”. Here’s an example:
I have used (a little modified version of) the Andre Michelle’s port from Bresenhams line algorithm and always thought it would be the fastest way to draw a line on BitmapData in Flash.
I was playing with lines and asked my self the previous question. After some Googling I found this Extremely Fast Line Algorithm (EFLA) written by Po-Han Lin. I gave it a try and ported it to as3. By default it was way faster then the Bresenhams version, but after some AS3 specific optimizations it came out TWO times faster and here it is for you:
private function efla
(x:
int, y:
int, x2:
int, y2:
int,
color:uint
):
void
{
var shortLen:
int = y2-y;
var longLen:
int = x2-x;
if((shortLen ^ (shortLen >> 31)) – (shortLen >> 31) > (longLen ^ (longLen >> 31)) – (longLen >> 31))
{
shortLen ^= longLen;
longLen ^= shortLen;
shortLen ^= longLen;
var yLonger:Boolean = true;
}
else
{
yLonger = false;
}
var inc:int = longLen < 0 ? -1 : 1;
var multDiff:Number = longLen == 0 ? shortLen : shortLen / longLen;
if (yLonger)
{
for (var i:int = 0; i != longLen; i += inc)
{
this.bit.setPixel(x + i*multDiff, y+i, color);
}
}
else
{
for (i = 0; i != longLen; i += inc)
{
this.bit.setPixel(x+i, y+i*multDiff, color);
}
}
}
Permalink
November 19, 2009 at 8:53 pm
· Filed under AS3.0, English, Experimentals, evoCunningParticleEngine, flash

Gravitation
max =
10;
gravity = .006;
dx = -pa.x;
dy = -pa.y;
dz = -pa.z;
dist = Math.sqrt(dx*dx + dy*dy + dz*dz);
dsg = dist * dist * gravity;
pa.vx += dx / dsg;
pa.vy += dy / dsg;
pa.vz += dz / dsg;
pa.vx = (pa.vx > max) ? max : ( (pa.vx < -max) ? -max : pa.vx );
pa.vy = (pa.vy > max) ? max : ( (pa.vy < -max) ? -max : pa.vy );
pa.vz = (pa.vz > max) ? max : ( (pa.vz < -max) ? -max : pa.vz );
pa.x += pa.vx;
pa.y += pa.vy;
pa.z += pa.vz;
Permalink
November 10, 2009 at 10:43 pm
· Filed under AS3.0, English, Experimentals, evoCunningParticleEngine, flash

I created this math last Spring for one project that didn’t finished then and has taken a new path now so this elegant loop has become available. I cannot think of better way to show it than combine it with the most intriguing being on Earth, the Blue Whale.
Make sure you have a head sets and your volume is set to high since Blue Whale has very low voice. A lot of his song is under our ability to hear. Never the less you can still feel it inside your head and deep in your stomach. That sound can be heard over 1200 kilometers away. These fellows can sing through oceans to each other!
Wikipedia:
“Source level of sounds made by Blue Whales are between 155 and 188 decibels when measured relative to a reference pressure of one micropascal at one metre. All Blue Whale groups make calls at a fundamental frequency of between 10 and 40 Hz, and the lowest frequency sound a human can typically perceive is 20 Hz. Blue Whale calls last between ten and thirty seconds. Blue Whales off the coast of Sri Lanka have been repeatedly recorded making “songs” of four notes duration lasting about two minutes each.”
Permalink
November 9, 2009 at 8:56 pm
· Filed under AS3.0, Experimentals, evoCunningParticleEngine, flash

I was inspired by this video and song by John Boswell to watch the Carl Sagan’s Cosmos series from the seventies. What a pedagogue this man was and still is!
Here’s my art contribution to honor him.
I think the song is master piece after knowing the raw material Mr. Boswell used. Check out his stuff at colorpulsemusic.com. By the way it’s a whale song.. If you are wondering what Sagan is trying to sing at the beginning.
The visual synchronization is made by using only soundChannel.left- ja rightPeak. You may click on it to activate the explosion.
Ohh and here are the code for creating sphere that has it’s points correctly randomly separated.
var u:
Number =
Math.
random();
var v:
Number =
Math.
random();
z = -1 + 2 * u;
var z2:Number = Math.sqrt(1.0 – z * z);
var phi:Number = (2. * Math.PI) * v;
x = z2 * Math.cos(phi);
y = z2 * Math.sin(phi);
Permalink
November 2, 2009 at 6:59 pm
· Filed under AS3.0, English, Experimentals, evoCunningParticleEngine, flash
I have wanted to do this right after I did it in 2d almost a year ago. The task wasn’t easy since there is exponentially more of everything and that cost cpu.
Well.. “If you wish to make an apple pie from scratch, you must first create the universe.” – said Carl Sagan and that meant study on optimizing the as3.
Here are the rules:
1. Every dot know their neighbours at up, down, left, right, back and forward.
2. Ones their Boolean ‘active’ is true they scale up and add random value to their property ‘hot’.
3. If random value is greater then their hot value they set their neighbours active to true.
4. All dot’s ‘hot’ and ’scale’ value drops during time.
Click on them to active one random dot. Realize that what you are seeing are reactions created by change in constant system.

12×12x12 = 1728 particles

15×15x15 = 3376 particles

20×20x20 = 8000 particles
For you with fast cpu:

24×24x24 = 13824 particles
Permalink
October 24, 2009 at 11:53 pm
· Filed under AS3.0, English, Experimentals, flash

It’s an image zoomer of my creation.
I was inspired by masters Lifeforce by ASD and Masagin by Farbrausch
I think I’ll play more with it later.
Permalink