"Stage3D Study Notes" True 3D World (iii): Texture effects

Source: Internet
Author: User

Mixed mode:

Code

Examples are directly in the Stage3D guide, you can click on the keyboard of the Q, W, e these 3 keys, the replacement of mixed mode, model and texture, you can visually see the effects of different blending modes, live: Below the terrain using "context3d.setblendfactors ( Context3dblendfactor.one, Context3dblendfactor.zero); " Normal mixed mode rendering, the model above the center is rendered using a specific blending mode.

Depth Test (Z-buffer):

Using Z-buffer, the GPU will set each pixel to a place called the depth buffer, and eventually the pixels drawn to the screen will be the closest pixel to the screen, instead of using Z-buffer, the GPU will draw with the painter algorithm, which will overwrite the first drawn image.

Let's revise the example above to test:

Code

First of all, our previous example is to draw the terrain and then draw the above model, so whether we use the depth test is actually not the difference, because the model is on the top of the terrain, so we need to two drawing order reversed.

Click the "R" key to toggle whether to use the depth test. If you do not use the depth test, then the model is drawn first, the terrain is drawn, so the model is located behind the terrain, the use of depth testing will determine the distance between the pixel distance from the screen, the final rendering distance of the nearest pixel, so the model back to the top.

In addition, when we use the depth test, we will find that the mixed mode seems to have a problem, all Black blocks! In fact, the mixed mode does not have the problem, but our model is drawn first, so when mixing the color in the buffer and no color can be mixed (if the terrain is drawn first, and the color of the terrain will be mixed), so there is this problem.

Back rejection:

Used to increase rendering speed, when turned on, the unseen side is not drawn.

1 context3d.setculling (context3dtriangleface.nnone);


Increased performance:

    • Opaque textures are drawn faster;
    • Try to avoid duplication of drawing;
    • Try to avoid state changes;
    • Use a more simple shader;
    • Draw fewer meshes;

"Stage3D Study Notes" True 3D World (iii): Texture effects

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.