2012年7月26日 星期四

as3 carousel effect

flash 旋轉木馬的效果有很多方式可以實做出來,
從早期用  2D 的方式去模擬,
到後來用 pv3d or away3d 很多 3D framework 都可以辦到。

本篇文章用 flash 內建的 3D 功能來實做,

2012年7月20日 星期五

Introduction to Stage3D: Part 6

perspective projections
透視投影基本介紹及教學

右手座標系 RH:
+x is right
+y is up
-z is into the screen
順時針為正面,逆時針為背面

2012年7月16日 星期一

Introduction to Stage3D: Part 5

Stage3D 基本介紹及教學

之前的例子都是在幾何圖形上渲染上不同的顏色,
這篇介紹如何在圖形上貼上材質,
進入貼圖之前,先說明一下 UV(U,V) 座標對應,
U 水平 V 垂直,以百分比描述。

2012年7月13日 星期五

Google analytics: tracking user time spent

如何用 GA tracking 使用者載入網站(檔案)的時間

PM 常常為了客戶活動網站,使用者載入瀏覽到底會不會很慢,
搞得一個頭兩個大。
不要吵~~ GA tracking 一下就知道啦!!

Introduction to Stage3D: Part 4

Stage3D 基本介紹及教學

建立 camera,
控制 camera 旋轉
沿 Y 軸旋轉
var dx:Number = _stage.mouseX - _lastMouseX;
_mat.prependRotation((dx/_stage.stageWidth)*360, Vector3D.Y_AXIS);

2012年7月12日 星期四

Introduction to Stage3D: Part3

Stage3D 基本介紹及教學
物件透過變形與透視可以呈現出 3D 顯示效果,

Matrix3D 處理 3D 變形
m = new Matrix3D();
沿著 Y 軸旋轉
m.appendRotation(getTimer()/30, Vector3D.Y_AXIS);
沿著 X 軸旋轉
m.appendRotation(getTimer()/10, Vector3D.X_AXIS);
沿著 Z 軸方向平移 2
m.appendTranslation(0, 0, 2);

Introduction to Stage3D: Part 2

Stage3D 基本介紹及教學
總結一下上篇 Stage3D 的流程
  1. 取得 context3D
  2. 設定 viewport
  3. 建立頂點"緩衝區"/定義頂點資料/上傳頂點資料
  4. 建立索引"緩衝區"/定義索引資料/上傳索引資料
  5. 設定暫存器
  6. 建立頂點及片段著色器程式
  7. 上傳 AGAL bytecode
  8. 顯示結果於螢幕/drawTriangles and present.

2012年7月10日 星期二

Introduction to Stage3D: Part 1

Stage3D 基本介紹及教學
Stage3D 簡單講就是提供 API 讓 Flash 可以使用 GPU 進行 3D 硬體加速以提升效能,

架構示意圖
   GPU   
OpenGL or DirectX
  Stage3D  

顯示的順序如下,
Stage(最上層為傳統的 flash 顯示層)
Stage3D[2]
Stage3D[1]
Stage3D[0]
StageVideo