Ngui using depth testing for novice boot masks

Source: Internet
Author: User

The principle of implementation: in fact, the rendering queue is rendered first, and then the ztest is used to change the rendering occlusion relationship.

Ps:depth testing: Depth test, also called depth buffer. Only objects closest to the observer will be drawn. A depth of z, the smaller the value , indicates the closer to the observer , the greater the value represents the farther away from the Observer .

Specific procedures:

1, modify Ngui unlit-transparent colored Shader, change zwrite to ON.

2, create 3 panel, respectively, called Gameobject, Mask, cutout, respectively, create a Sprite,

3, the Panel's rendering mode to explicit, the render queue is changed to Gameobject, 3002 (Mask), 3001 (cutout), this step will be rendered according to Gameobject->cutout-> Mask in the order of rendering.

4, adjust their z-axis: Gameobject for 300,mask for 200,cutout for 100. This step causes the occlusion of the rendering to change, causing the cutout to block mask. Let's set the opacity of the sprite below mask to 1. The last magical thing came up!

Ngui using depth testing for novice boot masks

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.