D3d deep test and Alpha hybrid

Source: Internet
Author: User

1. depth test a) depth buffer: A memory buffer for the depth information of each pixel on the screen. d3d determines whether to draw the current pixel by comparing the depth of the currently drawn pixel point and the depth value of the corresponding depth buffer point. b) d3dpresent_parameters. autodepthstencilformat = d3dfmt_d16 indicates that the depth value is enabled by 16-bit binary: pdevice-> setrenderstate (d3drs_zenable, true); the depth test function: d3drs_zfunc:
D3dcmp_never Always returns false
D3dcmp_less (commonly used) Returns true if it is less than the corresponding value of the depth buffer.
D3dcmp_equal Equal
D3dcmp_lessequal Less than or equal
D3dcmp_greater Greater
D3dcmp_notequal Not equal
D3dcmp_greaterequal Greater than or equal
D3dcmp_always Always returns true
Update Buffer: Keep the depth buffer unchanged or use the depth value of the current pixel to update pdevice-> setrenderstate (d3drs_zwriteenable, true); 2. alpha hybrid a) Principle: color = (rgbsrc * ksrc) OP (rgbdst * kdst) the most common method: color = (rgbsrc * alphasrc) + (rgbdst * (1-alphasrc) b) Application Enabling: pdevice-> setrenderstate (d3drs_alphablendenable, true );
Blend mode Factor Description
D3dblend_zero (0, 0, 0, 0)
D3dblend_one (1, 1, 1, 1)
D3dblend_srccolor (RS, GS, BS,)
D3dblend_invsrccolor (1-rs, 1-gs, 1-bs, 1-)
D3dblend_srcalpha (As,)
D3dblend_invsrcalpha (1-as, 1-as, 1-as, 1-)
D3dblend_destalpha (AD, AD)
D3dblend_invdestalpha (1-ad, 1-ad, 1-ad, 1-AD)
D3dblend_destcolor (Rd, Gd, BD, AD)
D3dblend_invdestcolor (1-rd, 1-gd, 1-bd, 1-AD)
D3dblend_srcalphasat (F, 1); F = min (AS, 1-AD)
Alpha hybrid method
D3dblendop_add Add the source computing result to the color buffer Calculation Result
D3dblendop_subtract Source computing result minus color buffer Calculation Result
D3dblendop_revsubtract Color buffer calculation result minus source Calculation Result
D3dblendop_min Min (source calculation result, color buffer calculation result)
D3dblendop_max Max (source computing result, color buffer calculation result)
Color = (rgbsrc * alphasrc) + (rgbdst * (1-alphasrc) setting example: pdevice-> setrenderstate (d3drs_srcblend, expiration); pdevice-> setrenderstate (d3drs_destblend, d3dblend_invsrcalpha); pdevice-> setrenderstate (d3dblendop, d3dblendop_add); (default value, optional) 3. alpha test A) The principle is based on the Alpha test conditions to determine whether to draw the current pixel. Color buffering is not required, so the speed is faster than that of Alpha mixing. b) Application Enabling: pdevice-> setrenderstate (d3drs_alphatestenable, true); Alpha test function d3dcmp_func enumeration; default value: d3dcmp_always reference value: pdevice-> setrenderstate (d3drs_alpharef, 0x00000081 );

 

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.