Flash 10 betaのインストールと最新機能の使い方

Flash10のインストールと今回の目玉機能の一つGPU機能の紹介です。

Flash10のすごさはこちらのムービーからどうぞ(下部コンテンツ
http://labs.adobe.com/technologies/flashplayer10/demos/

既存のFlashをアンインストールする方法

まずはアンインストーラーを使って既存のFlashをアンインストールします。
http://labs.adobe.com/downloads/flashplayer10_ax.html
アンインストールが終わったら、Flash10Beta(ActiveX版)をダウンロードしてインストールします。
「Download ActiveX Control for Windows Internet Explorer (EXE, 1.78 MB) 」

そして、Flash10Beta(Windows版)もインストールします。
http://labs.adobe.com/downloads/flashplayer10.html

以上でFlash10のインストールが完了です。
Flash10のデモページはこちら(うまく表示できればOK
デモページ
http://labs.adobe.com/technologies/flashplayer10/demos/
http://labs.adobe.com/technologies/flashplayer10/demos/pixelbender/
#pixelbenderのページで何ができるかは下記参照

Adobe Pixel Bender Toolkitの使い方

こんなことがGPUを使用してできるようになります。

ソフトをダウンロード

Adobe Pixel Bender Toolkitをダウンロードします。こちらのソフトはFlashでエフェクトを実行できるように書きだすことができます。
ダウンロードはこちらから
ページ下部にWindows版のダウンロードがあります。
http://labs.adobe.com/wiki/index.php/Pixel_Bender_Toolkit

インストール

ダウンロードしたファイルをダブルクリックでインストールします。

起動

スタート⇒プログラム⇒Pixel Bender Toolkitと表示されますので、こちらでプログラムを実行することができます。

簡単な使いかた


下にプログラムを書いていきます。
Runボタンを押すと左上にプレビューが右にプログラムの設定パラメーターが表示されます。

画像ファイルの読み込み

File⇒Load Image 1

フィルターの作成

ウィンドウの下半分にプログラムソースを書きます。
サンプルソースはこちらにあります。
http://labs.adobe.com/wiki/index.php/Pixel_Bender_Toolkit

<languageVersion : 1.0;>
kernel NewFilter
<   namespace : "Your Namespace";
    vendor : "Your Vendor";
    version : 1;
    description : "your description";
>{
        parameter float size
    <
        minValue: float(1);
        maxValue: float(300);
        defaultValue: float(20);
        description: "size";
    >;
    // rot1: rotation matrix, 18 degrees
    // rot1r: reverse rotation, -18 degrees
    // base1: rotation base point (somewhere far enough from origin)
    const float2x2 rot1 = float2x2(0.951,0.309,-0.309,0.951);
    const float2x2 rot1r = float2x2(0.951,-0.309,0.309,0.951);
    const float2 base1= float2(2400,-100);
    // rot2: rotation matrix, 30 degrees
    // rot2r: reverse rotation, -30 degrees
    // base2: base point
    const float2x2 rot2 = float2x2(0.866,0.5,-0.5,0.866); // 30 degress
    const float2x2 rot2r = float2x2(0.866,-0.5,0.5,0.866);
    const float2 base2= float2(-100,2400);
    input image4 src;
    output pixel4 dst;
    void evaluatePixel()
    {
        // Crystallize, pseudo Voronoi-diagram using three nearby points,
        // calculated from 'randomly' placed and rotated rectangular grids
        // 1st grid and point
        float div=size;
        float2 newP= base1 + rot1r*div*( floor( rot1*(outCoord()-base1)/div ) +0.5);
        // 2nd grid
        div= 21.0/20.0*size; // factor 21, I picked some number that has no common denominators with the default size 20
        float2 p= base2 + rot2r*div*( floor( rot2*(outCoord()-base2)/div  ) +0.5);
        // comparing distance to the 1st sample point
        newP =  length(p-outCoord()) < length(newP-outCoord()) ? p : newP;
        // 3rd grid
        div= 19.0/20.0*size;
        p= div*( floor( outCoord()/div  ) +0.5);
        // comparing distance
        newP =  length(p-outCoord()) < length(newP-outCoord()) ? p : newP;
        // the new color is picked from the nearist point
        dst = sampleNearest(src,newP);
    }
}

フィルターをFlash10用に書き出し

File⇒Export ... for FlashFlashで使えるようなファイルに書き出します
#注意)デスクトップにはなんか吐き出せなかったのでCドライブ直下とかオススメ

Flash10でマイフィルターを読み込み

デモサイトに飛んで、Addボタンで先ほど作成した.pbjファイルを読み込ませます。
http://labs.adobe.com/technologies/flashplayer10/demos/pixelbender/
こちらにセットを用意しました。
http://moeten.info/flex/etc/pbj/pbj.zip
こんな感じ

フィルター参考リンク

screenshot