做了幾個基于Flash平臺的3D的項目,一路走來收獲頗多。Away3D作為一個開源的Flash3D引擎,在3D頁游領域,無疑是當前OGRE在國內的地位。
翻譯出了多年前做Away3D中國社區的時候翻譯的一篇文章,以此記錄這段難忘的經歷!
什么是Away3D?(What is Away3D?)
Away3D是一個開源的,基于Flash平臺的實時3D引擎.這個項目最初是由Alexander Zadorozhny和 Rob Bateman 在2007年開始的。沒想到這一發就不可收拾。下面是一些Away3D重要的特性,在此呈現給大家。(譯注:希望大家能夠喜歡,哈哈)
Away3D is an open source, real time 3D engine for the Flash Platform. The project was started by Alexander Zadorozhny and Rob Bateman in 2007 and has been evolving non-stop ever since. Below is a list of some of the most important features of the Away3D engine.
100%開源(100% Open Source)
Away3D引擎基于Apache2.0協議開源,這表示你可以以任何目的免費使用(當然商用也是一樣的)。Away3D現在由Away Foundation管理,并且受到Adobe支持,已經成為了Adobe Flash平臺的官方API。
(譯注:既然說到這里了,我們還是欣賞一下LOGO吧,雖然大家肯定不陌生,但是文檔沒有圖,效果不是太好)
The Away3D engine is open source under the Apache 2.0 license, and is free to use for any purpose, including commercial projects. Away3D is now managed by The Away Foundation, and supported by Adobe systems as an official API for the Flash Platform.
雄厚的社區支持(A Massive Community)
(譯注:Adobe既然把away3d納入官方api,這當然是有原因的。并且,也表示away3d的后續發展應該會加速。 )
這個項目從來就沒有像這樣忙過(這是直譯,我大概能感覺到意思,但是實在沒搞懂他到底想表達什么)。在強大的Flash3D社區支持下,一群積極而NB的貢獻者,一個熱鬧的論壇,數以百計的在線例子和教程。同時,你還可以找到一些擴展資源用來在Away3D庫上使用和構建項目。你可以走“這里”進入我們的論壇,走“這里”訪問我們的github源碼庫。
The project has never been so busy. With the largest online Flash 3D community, an active set of talented contributors, a buzzing forum, hundreds of examples and tutorials online, you will find extensive resources for using and building upon the Away3D library. Visit our forums here. Visit and watch our GitHub repositories here.
數以百計的例子和教程(Hundreds of Examples and Tutorials)
Away3D的每一次發布,都搭載了一系列可下載的例子源代碼。也可以在我們的GitHub上找到。這些例子涵蓋了從基礎入門者到高級使用者的需求。 新的特性,最好的粒子效果等等。 并且提供了能夠讓你最快熟悉Away3D引擎的方案。Away3D社區同時還維護了一個教程的wiki頁面。 力在為大家提供一個能夠持續增漲并且包含多種多樣的資源和材質包。
Every release of the Away3D library ships with a downloadable set of example sources that can also be found on GitHub. These examples cover usage of the engine from beginner to advanced levels, new features, best practices etc, and provide the fastest way of getting acquainted with the engine. The Away3D community also maintains a tutorials wiki, providing an ever growing set of complete and comprehensive resource material.
易于理解的API(Comprehensive API)
在眾多有經驗的FLASH程序員的努力下,Away3D庫向大家提供了一套容易理解,使用簡單的API。它靈活的設計思路繞開了Stage3D API的復雜,同時也得到了當下Flash社區想要的效率。最終,Away3D成為了一個能夠簡單且優雅地滿足你需求的工具。
完整的文檔和引用(Class說明)
完整的文檔,請訪問“引用”章節
Developed by experienced Flash programmers, the library maintains a comprehensive, easy to use API. It’s flexible design wraps the power of the Stage3D API in a way that bypasses the low level complexities, but retains the speed and efficiency so desired by today’s Flash community. As a result, Away3D offers the tools necessary to achieve what you require in as simple and elegant a way as possible.
Full Documentation and Reference
Fully documented. Visit the reference section.
GPU加速(GPU Acceleration)
這已經是Away3D第四次輪回了。現在它利用了Flash Player 11最新的Stage3D API.可以在PC和移動設備上完整地擁有3D GPU加速能力。這表示它已經有潛力去實現震驚的視角效果,額外的物理模擬和游戲邏輯運算,每幀上百萬的三角面,以及每秒60幀的效率。
In it’s fourth incarnation, Away3D now takes advantage of Flash Player 11’s Stage3D API, enabling full 3D GPU acceleration for desktops and mobile devices. This offers the potential for stunning visual effects, extra processing for the likes of physics simulations and game logic, and scenes rendering up to a million triangles per frame, maintaining a steady 60fps performance.
強大的渲染能力(Powerful Rendering)
Away3D強大的材質系統使你不需要面對頭痛的原始Shader代碼就能夠實現一些高級渲染效果模擬。模塊化的設計方案使你可以整出(使用+聯合+創建 = 整出)一大堆光照方法。比如phong著色(馮氏著色,即 雙線性法線插值法。 具體的用Shader實現的話,就是把法線通過vs輸出到ps,在ps中做法線 dot 光照方向的運算就可以了。 因為vs到ps的向量在光柵化階段會進行插值,默認的就是雙線性插值。 再說白了,就是 逐像素光照)。點光源光照,方向光光照,級聯陰影(即 cascading shadow map。人稱 CSM 就是它了。) 法線映射,高光映射,全局光照模擬,霧效和邊緣光照。 太多太多了,枚舉不完。
The powerful material system in Away3D allows advanced shading simulations without the headache of dealing with raw shader code, implementing a rich modular system that allows you to use, combine and create a large set of illumination methods such as phong shading, point and directional lighting, cascading shadows, normal and specular mapping, global illumination, fog and rimlighting effects and much, much more.
健壯的場景圖(Robust Scenegraph)
Away3D渲染管線實現了一個高度優化的場景圖,你可以很方便地創建出一個復雜的,嵌套的,且多關卡的場景。 它內建的裁剪和剔除算法能夠確保GPU只接受你視野內需要渲染的物體。同時它也管理了CPU和GPU之間的負載平衡問題,以使我們在除場景渲染以外能夠獲得更好的效率。這也是一個健壯的渲染引擎所需具備的基本特征。
The rendering pipeline implements a highly optimised scenegraph that allows the setup of complex, nested, multi level scenes. Built in clipping and culling algorithms ensure that the GPU only receives what it needs to render the view. The balance between CPU and GPU calculations is carefully managed to get the best possible performance out of the scene, a fundamental aspect of any robust rendering engine.
后期處理效果(Post Processing Effects)
Away3D對GPU的利用當然不只是3D渲染。在那個可擴展的叫”filters”的包里,我們提供了各種各樣的令人瞠目結舌的后期處理效果。當然,你可以在你的實時渲染的場景里添加和使用它們。比如 全屏泛光,模糊,景深,運動模糊等。
The library takes advantage of the GPU even beyond 3D rendering. In the extensible filters package, there are a variety of stunning post-processing effects that are applied to the scene in realtime, such as bloom, blur, depth of field and motion blur.
對效率和生產率的平衡(Balanced Performance and Productivity)
這個引擎的核心,以及它的擴展特性,都是基于效率思的。最終的API提供了最理想化的資源和場景元素的使用方式。同時也不妨礙生產率。Away3D最原始的設計是作為復雜的應用和游戲的支持者。而它本身的框架具備可擴展的特點,也能夠確保一個應用程序開發的正常進行。
The engine’s core, as well as its extensive feature set is architected with performance in mind. The resulting API encourages optimal use of resources and scene elements, without getting in the way of productivity. Away3D is fundamentally designed to play a supporting role in complex applications and games, and the extensible nature of the framework ensures a robust application development approach.
可配置的交互性(Configurable Interactivity)
任何3D引擎都需要和它的使用者進行交互。Away3D提供了鼠標,觸屏等交互方式。提供了GPU和CPU的兩種拾取方式,以達到最好的效率。所有的事件都通過分法器方式進行處理,這使得在和3D對象交互時簡直就是小菜一碟。
Any 3D engine needs to interact with its users. Away3D supports mouse & touch interactivity, with the option for either GPU or CPU-based picking systems to get the best performance. Events are handled in a familiar dispatcher-driven way, making interactive assignment on 3D objects a breeze.
物理(Physics)
Away3D無縫集成了它自己的物理庫。AwayPhycis. 這個擴展使你可以用幾行代碼就為你的3D場景添加上物理支持。AwayPhysics 使用 Adobe XC APIs 進行加速。 并且基于NB的Bullet物理引擎。當然,那些API已經專門為Away3D封裝過了,提供了一個優化的,最貼近Away3D的物理引擎實現。
Away3D integrates seamlessly with its own physics library, AwayPhysics. This addition enables full physics support on your 3D scenes with just a few lines of code. AwayPhysics is accelerated by Adobe XC APIs and is based on the popular Bullet Physics Engine. The API wrapper is specifically designed for Away3D, providing an optimized, closely coupled physics engine implementation.
動畫支持(Animation Support)
Away3D提供了完全的骨骼動畫,頂點動畫,粒子動畫和軌跡支持。當GPU加速可用的時候,動畫系統會自動將其開啟。盡可能降低CPU的開銷。 骨骼動畫使用了一個分層結構,根據頂點的骨骼權重進行蒙皮(簡稱:蒙皮骨骼動畫). 頂點動畫使用了基于關鍵幀插值的方式來實現。粒子動畫則使用靜態或者動態參數來調整一個粒子的行為。 更多……
Away3D enjoys full support for skeleton animation, vertex animation, particle animation and path animation. GPU acceleration is implemented in the animation systems whenever possible, keeping CPU use as low as possible. Skeleton animation uses a hierarchical rig arrangement, with weighted skinning on the verticies. Vertex animation uses frame-based interpolation of individual geometry poses. Particle animation can use static or dynamic parameters for adjusting particle behaviour. And more…
粒子系統(Particle Systems)
引擎提供了一個可以高度靈活配置的基于的GPU粒子系統 API。使你可以實現成千上萬的令人激動的視角效果。
The engine supports a highly configurable GPU-based particle API providing the means for thousands of exciting visual effects.
Starling庫集成(Starling Integration)
Away3D集成了Starling,使你可以很容易地同時使用這兩個基于GPU加速的3D和2D庫。由于兩個庫都是GPU加速的,所以這可能會導致一些資源限制問題。 但是對于Away3D來說,你不用擔心這個問題。使用AWAY3D和Starling把你的2D和3D劃分到不同的層,然后開發一個100%的GPU加速的圖形程序吧。(其實,不是太懂他想說什么。上面說了會出現資源限制問題,后面又說AWAY3D不用擔心。然后又繼續說Away3D和Starling一起用。 看來,鳥文功力太淺啊。)
Away3D integrates effortlessly with the popular Starling API for 2D graphics, allowing both libraries to be used in the same project at the same time. As both libraries use the GPU for rendering, problem can arise from resource restrictions on the device. With Away3D, you won’t even have to think about these problems - layer your 2D and 3D content with Away3D and Starling and develop 100% GPU based graphics applications.
擴展的文件IO支持(Extensive File I/O Support)
Away3D并不會忽略除3D以外的內容。工作流永遠是一個中心話題。 我們不僅支持大量的文件格式,如DXF,AC3D,COLLADA,MAX3DS,MD2,MD5,OBJ。 并且,我們也開發出了我們自己的強大的,簡潔的AWD格式。以及相應的3D工具插件。 在你開發你的3D程序的時候,你就會發現AWD格式將會是一個珍貴的資源。
Away3D is not isolated from the rest of the 3D world. Workflow has always been a central topic and not only do we support a wide variety of file formats such as DXF, AC3D, Collada, Max3DS, MD2, MD5, OBJ, but we have also developed our own powerful and compact AWD format. With plugins for several 3D authoring environments, you will find the AWD format to be an invaluable resource when developing content for your Away3D applications.
Prefab3D 兄弟應用(Prefab3D Companion App)
哈哈,對工作流的支持并沒有在這里停下,Prefab3D兄弟應用提供了一些常見的工作流需要的任務,并且使用非常簡單。它有著一個非常易于理解的IDE,能夠讓你快速調整你的資源并在AWAY3D里使用。
Workflow support doesn’t stop there. The Prefab3D companion application accelerates common workflow tasks in an easy to use, comprehensive IDE for quickly adapting your content for use within Away3D. Prefab3D.
舊版本支持(Legacy Support)
當前的Away3D 4.x版本是基于Flash Player 11的Stage3D API構建的,以便能夠利用當前PC和移動設備上的圖形處理器。但是,如果你需要使用舊版本的FLASH PLAYER進行3D應用程序開發,你可以很方便地切換到老的引擎版本。開發團隊在努力地維護多個版本的API。因此,你可以找到多個Away3D版本之間的共性,并且能夠以此容易地在各個版本的API之間轉換。
更多,更多,更多
立體渲染,3D聲效,OOXX工具,數據序列化,敬請期待……
The current version of Away3D 4.x is built on the Flash Player 11’s Stage3D API to make the most of current cutting edge graphics processors on desktop and mobile systems. However, If you need to develop 3D applications for older versions of the Flash Player, you can easily switch to use previous versions of the engine. The development team have made an effort to maintain API’s across versions, so you will find similarities when using any of the Away3D versions available, helping to ease the transition.
And much, much more.
Stereoscopic rendering, 3D sound, extrusion tools, data serialisation, and the list goes on…
最后,貼幾張用Away3D做的項目圖片
文章列表