Simulating atomic model of metal by Box2DFlash

July 14th, 2009  |  Published in Uncategorized

Click images above to enlarge.

Impressed by the video here, I tried to simulate the atomic model of metal in Flash using Box2DFlash.

What is done in the program is just put a lot of spheres in the area randomly, and then let the physics engine to solve all the collisions. When all the atoms stop moving, a single still of the metal structure will be formed.

The atoms are only drawn on the screen when it is sleeping (ie. no movement). It can save some time from not rendering them in each frame.

caution: The browser will freeze for a few seconds after “start” is pressed. And it takes several minutes to an hour to finish (when sleep count == atom count).

http://get.adobe.com/flashplayer

source

Tags: , ,

PV3D + Async-threading = Async Render Engine

June 7th, 2009  |  Published in Uncategorized

Recently I need to write a 3D tool to help making a installation artwork. I know I should use Maya, Processing or anything like that, but in order to get the least risk, I used my most experienced language, AS3.

Since I need to render A LOT of stuff (~400,000 objects), instantly I faced the performance issue. As you can imagine, even if I could generate all the objects in 15 seconds, the rendering process must excess the Flash Player’s  execution time limit.

So I try to make my own async render engine with the help of async-threading. I extended BasicRenderEngine to AsyncBasicRenderEngine. The class even has a showBusyCursor property that let you optionally show the busy cursor on rendering.

But note that this is only a proof-of-concept and actually has little help of preventing freeze-screen. It is because I only distribute the individual 3D object’s rendering to frames but leaving the sorting, filtering, post-process code unchanged. Also, the RenderStatistics returned by renderScene/renderLayers will contain only wrong data until the RENDER_DONE event is dispatched.

One last thing, Flash’s drawing algorithm seems affecting the async rendering performance too. So I do not add the viewport to stage. Instead, once RENDER_DONE, I draw the viewport on a Bitmap on stage.

http://get.adobe.com/flashplayer

source

Tags: , ,

Vector Sound Wave Morphing

May 20th, 2009  |  Published in Uncategorized

This my my final project for the course “Interactivity I”. For this final project, my aim is to explore the vector nature of sound wave while making a tool to let people create their own waveform which can then be saved for other use.

The waveform in the program consists of 10 control points. The first point and the last point are fixed at zero so that the wave can be looped smoothly to form a sound wave. The controls points can be adjusted by dragging or by using keyboard. The points are assigned with keys labeled near them, which are number keys (+shift to move points up instead of down). I recommend using the keyboard as you may adjust multiple points at the same time (which feels like using multitouch surface 8-) ).

Degrafa is used to construct the wave form. I choose to use cubic bezier curve as it is easier for me to implement the algorithm (with the still-in-beta AdvancedCubicBezier which available via SVN).

The 3D cylinder is made by Flash Player 10′s 3D API. It looks quite nice as similar to landscapes.

Sound is synthesized dynamically in real-time (with some delay… okay? ;-) ). If you hear some “clicks” or “pops”, try to export the sound first by clicking on the export button at the bottom-right corner (it will be in wav format, encoded by the WavEncoder from popforge) .

If you hear nothing, you may try to increase the buffer size or use the export function.

http://get.adobe.com/flashplayer

source

Tags: , , , ,