
很久之前就知道PV3D的LensFlare特效但一直找不到時間測試
上網找到最早的一篇範例在http://blog.zupko.info/
但上面提供的原始碼有點老舊
好不容易找到這篇Papervision 2 Great White Lens Flares
根據此文作者提供的程式段落做一番修改後
再使用GIMP做幾個鏡頭眩光圖
這樣子PV3D的LensFlare特效就可以順利跑起來了
private function init():void {
light = new PointLight3D(true);
light.x = 0;
light.z = 100;
light.y = 400;
light.autoCalcScreenCoords=true;
view.scene.addChild(light);
//create some halos
var h:Bitmap = new Halo();
var h1:Bitmap = new Halo1();
var h2:Bitmap = new Halo2();
var flareArray:Array = [h,h2,h1 ];
lensFlare = new LensFlare(light, flareArray,300,300);
var lightLayer : ViewportLayer = view.viewport.getChildLayer(light);
lightLayer.addLayer(lensFlare);
lightLayer.layerIndex = 1;
addEventListener( Event.ENTER_FRAME, enterFrameHandler );
}
private function enterFrameHandler( event : Event ):void {
lensFlare.updateFlare(true);
view.singleRender();
}
[demo]
沒有留言:
張貼留言