blog.omine.net

Posts tagged with “3d”


Flash Player 10 Cover Flow

May 17th, 2008

A beta version of Flash Player 10 (codename Astro) was released this week, along with a new build of the free Flex SDK 3 that allows developers to test the new Flash Player capabilities.

The following demo is a simple implementation of Cover Flow that takes advantage of the 2.5D API — all DisplayObjects now have x, y, and z properties (position, rotation, scale).

Use the arrow keys to navigate:


I developed a Cover Flow clone with Papervision3D 1.5 for the Quatro Arquitetura website a few months ago, and adapting it to the new FP10 API was really easy. Download the source code. You’ll also need Tweener.

PV3D ribbons

April 13th, 2008

This week I worked on converting last week’s Particles and trails code to 3 dimensions, using the Effects branch of Papervision3D.

The final SWF runs smoothly at 30fps on my computer, and initially uses about 5MB of memory as measured by System.totalMemory. The biggest challenge in this project was fixing a memory leak that occurred whenever a ribbon was removed from the scene. If you run into this problem when removing a DisplayObject3D, remember to:

public function destroy():void
{
    geometry.faces = [];
    geometry.vertices = [];
    material.unregisterObject(this);
}

Each ribbon has 3 life phases:

  1. Growth: the ribbon grows until it reaches 120 vertices;
  2. Stability: the ribbon keeps moving but older faces and vertices are removed, keeping vertex count equal to 120;
  3. Removal: the ribbon stops moving and 2 vertices and 2 faces are removed frame by frame until it reaches zero vertices and zero faces.

The applied material is a simple FlatShadeMaterial with a moving light source. Finally, a BitmapLayerEffect with BlurFilter was applied and the viewport.blendMode was set to BlendMode.ADD.

View animation (move mouse to change camera rotation)