Int3ractive
Blog of Trong-Thanh Tran, front-end developer, Linux user
20 January 2012
Demo: Stage3D Fireworks with Flare3D
My going back to Flash to experiment on Stage3D. The animation make use of Flare3D engine. Thanks to its built-in shaders and particles components, I was able to create the fireworks and the lightning effects without much trouble. However there's still room to improve the fireworks effect with more particles.
View the demo.
15 May 2011
Bắt đầu với Molehill (Stage3D) - Phần 2
PHẦN 2. TÌM HIỂU MOLEHILL (STAGE3D) API
| Trình độ: Cao Cấp | Phần mềm | File mẫu |
| - Vững ActionScript 3 - Biết FlashDevelop - Biết Flash 3D hoặc 3D Engine | - Flash Develop 4 (tải về) - Flex SDK 4.5 r.19786 (tải về) | molehill_getting_start_p2.zip |
(TTT) Đây là bài viết giới thiệu về Molehill (Stage3D) API ở khía cạnh cơ bản của nó. Molehill API là một tập lệnh cấp thấp nên đòi hỏi bạn phải vững về ActionScript 3 và có chút kinh nghiệm về 3D (Flash) để có thể dễ dàng tiếp cận hơn.
(Dịch)Trước khi chúng ta bắt đầu, có một số thuật ngữ các bạn nên biết:
Các thuật ngữ:
- Vertex: Một điểm trong không gian 3D. Một vertex sẽ xác định đỉnh của một tam giác. Tuy nhiên trong MoleHill, vertex định nghĩa cả vị trí và màu của đỉnh.
- Matrix: Bạn dùng Matrix (ma trận) để biến đổi các Vertex. Hãy hình dung Matrix giống như là các "phương trình" để xoay, thay đổi tỉ lệ hoặc thay đổi vị trí của Vertex.
- Shader: Shader là một chương trình nhỏ dùng để xử lý Vertex. Shader có thể dùng Matrix để làm các phép biến đổi lên Vertex. (Hay nói cách khác, chương trình thực thi một phương trình lên tất cả các điểm trong 3D). Không như tôi nghĩ, Shader trong MoleHill không chỉ xử lý hoa văn và giao diện mà nó còn dùng để xử lý vị trí của các đối tượng.
06 May 2011
Bắt đầu với Molehill - Phần 1
PHẦN 1. TIẾP CẬN MOLEHILL THÔNG QUA FLASH ENGINE AWAY3D
| Trình độ: Trung Cấp | Phần mềm | File mẫu |
| - ActionScript 3 - Biết FlashDevelop - Từng sử dụng Flash 3D engine | - Flash Develop 4 (tải về) - Flex SDK 4.5 r.19786 (tải về) | molehill_getting_start_p1.zip |
I. Molehill và những câu hỏi thường gặp.
1. Molehill là gì?
Molehill là tên mã của một tập lệnh (API) cấp thấp trong Flash Player cho phép tận dụng sức mạnh của chip đồ họa (GPU) để hiển thị hình ảnh 3D phức tạp và các hiệu ứng đồ họa đòi hỏi tốc độ xử lý cực nhanh, từ đó mang lại cho người dụng trải nghiệm 3D ấn tượng trên hầu hết các máy tính và thiết bị kết nối internet.Dự kiến Molehill sẽ được phát hành chính thức trong Flash Player 11 và Adobe AIR phiên bản tiếp theo.
Ảnh: Ứng dụng demo Max Racer viết bằng engine Alternativa 3D hỗ trợ Molehill. Xem demo.
06 February 2010
Happy Vietnamese New Year 2010
It been a while I haven't done any animation/e-card for my dear friends. This year, I want to make something different to mark my mature in the Flash carear after 2 years. Here it is (click on the thumb to open the flash movie:
HAPPY VIETNAMESE NEW YEAR 2010!
WELCOME THE YEAR OF THE TIGER!
The images are loaded from my FaceBook friends list.
You can find the source code of this app here.
Update 14-June-2010: Profile picture URLs were fetched once via FaceBook API tester and stored in an embedded XML. They may be outdated over time.
23 January 2010
Quick Note on Local to Global in Papervision3D
Normally, if you want to get the scene coordinates of a child 3D object, use these properties:
However, if you want to get the screen coordinates of a local point other than the object’s original position (for e.g. side of a plane, some random points on a surface of a sphere…), then you have to deal with Matrix3D transform.
Don’t worry, you don’t need to understand what Matrix3D is because I don’t either :). Let’s use what people have concluded here:
If local to global is:
child.transform.calculateMultiply(parent.world, child.transform);
then global to local is:
child.transform.calculateMultiply(Matrix3D.inverse(parent.world), child.transform);
There are 2 things to note with above conclusion:
- I have to invert method’s arguments (from what’s originally stated in the post) to get the correct conversion. I’m using PV3D 2.1
I haven’t tried the global to local method, hence I don’t guarantee it works.The global to local transform works correctly.
So here’s how I convert any local positions to global:
- var matrix: Matrix3D = Matrix3D.IDENTITY; //a recommended way to create new Matrix3D
- matrix.n14 = localX;
- matrix.n24 = localY;
- matrix.n34 = localZ;
- matrix.calculateMultiply(child.parent.world, matrix); //child must be a DisplayObject3D
- var scenePos: Number3D = new Number3D(matrix.n14, matrix.n24, matrix.n34);
If you want to convert the rotation as well, use Matrix3D.copy() to copy all transformation info from the child object. And then after calculateMultiply(), apply the matrix to your scene object with DisplayObject3D.copyTransform().
[Vietnamese Tag – Chuyển đổi tọa độ local sang global trong Papervision3D]
16 January 2010
3D Paper Flip Effect – First Attempt
Recently, a challenge have been raised to me if I can make a similar page flip effect like the one at this page. The difference from other page flip libraries is that the page turning effect looks more 3D-like and realistic.
At first glance, the effect might look difficult to replicate. But then I realized that it may be even easier to implement from the traditional page flip effect which requires a lot of overly complicated math. Thanks to 3D engines and modifier libraries at my disposal, I’m hoping to be able to create a 3D paper and manipulate it into a page turning animation.
So if I want to bend or fold something in Flash 3D, the first thing came to my mind is using AS3DMod. However, when I look into it, the modifiers are so limited in terms of controlling interactions. For example, the Perlin modifier can makes the plane wavy like cloth or paper but there no way you can control it since Perlin noise is randomly generated. With Bend modifier, I can bend it only at one section. I can add more modifiers to bend at multiple sections but it is still too difficult to simulate the paper physically.
Here my attemp with AS3Dmod and Papervision3D (click to open the Flash demo):
So I decided to quit AS3DMod although I still thought that I might be missing something. (Somebody please prove I’m wrong with AS3DMod).
My only hope now is to access the vertices of the 3DPlane and control them with a physics simulator. Fortunately in the Flipper3Maker mentioned above, the paper is not bent from any direction; the bend lines are in parallel. So I’ve come up with the following demo:
I used a simple 2D chain simulator which I got from here (was AS2) and then apply the transform on the rows of vertices on the 3D plane. The achievement here is that I can interact with the “paper” although it doesn’t look like a page turning effect yet.
My next step is to find the right simulator for this page turning effect and I’m about to begin with Box2D.
You can find the source code of above demos here.
[Vietnamese Tag – Hiệu Ứng Lật Trang 3D – Cố Gắng Đầu Tiên]
15 February 2008
FlickrCloud: Flickr API & Papervision 3D
In a few days free from client projects, I have done some studies and made this demo. With this embeddable flash application, you can browse your and your friends' flickr public photos with a stunning 3D experience. (up to 50 latest photos) I named it FlickrCloud (Flickr + PaperCloud).
Technical info: This application is the combination of
- Flash Player 9 (Action Script 3)
- Flickr API (with the help of Adobe AS3 Flickr Library)
- Papervision3D engine.
- Original 3D effect from PaperCloud demo (included in Papervision3D classes and examples).
Try this application yourself: put these codes into your blog html
<embed src="http://www.fileden.com/files/2009/8/2/2530043/flash/FlickrCloud.swf" bgcolor="#000000" type="application/x-shockwave-flash" flashvars="" flickrid="9803330@N04" allowscriptaccess="none" align="middle" height="480" width="640" />
That flashvars thing is used to inform the application the startup user ID. Remember to replace my flickr ID (9803330@N04) with your choice of user. (Don't know your flickr ID? Log into your flickr account and look at the URL on your browser's address bar, you will find the ID that looks like mine.)
