"Stage3D Study Notes" True 3D World (i): Perspective matrix

Source: Internet
Author: User

If you crossing follow my study notes all the way to see, will certainly spit my groove, what is this 3D ah? The whole thing is to use the GPU to draw a bunch of 2D images, indeed, we have been using the orthogonal matrix GPU acceleration to achieve the 2D world display, not true 3D, but it is because of the previous study we achieve true 3D world of learning will be more relaxed, The following notes let us truly enter the 3D world!

To add, this part of our study notes is based on the book "The Adobe Flash one Stage3D (Molehill) Game Programming Beginner's Guide".

Get into our theme, do you remember the previous 2D implementation we are implemented by a transformation matrix called orthogonal matrix, the orthogonal matrix can make 3D space ignore near large and small rules, in addition to the Starling specifically for 2D design orthogonal matrix, Some of the 2D background 3D characters on the market currently use a more complex orthogonal matrix for page tours. So, if there is an orthogonal matrix, is there another matrix that can achieve closer to the reality of the near-large and small rules? Of course, this is the theme of our chapter and the core foundation of the true 3D world--perspective matrix.

To understand and implement a perspective matrix for stage3d the Adobe official web site has an article to read: the use of Stage3D and perspective projection, the implementation of the perspective matrix is more complex, Fortunately, Adobe has provided us with a class perspectivematrix3d that can be used immediately, and can be found in Adobe articles for download links.

Note: Our subsequent 3D World builds are based on the perspective matrix Perspectivematrix3d class provided by Adobe.

Similar to the 2D implementation, we also start by drawing a picture, but the difference is that the picture we are drawing is a non-thickness patch that exists in the 3D world, we will let it rotate and move randomly, and observe the real 3D world that can be realized by observing the perspective matrix.

Let's look at the demo:

Code

Detailed comments have been added to the code, so let's look at a little bit different from the 2D implementation:

    1. We use the perspective Matrix class Perspectivematrix3d, but the usage is consistent with the previous orthogonal matrix, which is initialized first and then added to the Model transformation matrix;
    2. New support for Camera matrix _cameramatrix is added to simulate camera position;

In addition to the 2 points above, we can actually find no difference from the previous code for drawing 2D images, and finally, the most important thing is to read the perspective Matrix article provided by Adobe to understand that the perspective matrix is the basis for starting a true 3D matrix.

"Stage3D Study Notes" True 3D World (i): Perspective matrix

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.