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