3D programming: Texture Addressing Modes

Source: Internet
Author: User
Tags integer range

Texture addressing Modes

You may have noticed the assignment of Samplerstate object Members Addressu = wrap and ADDRESSV = Wrap in texturemapping.fx. This is the texture addressing mode, and when the texture coordinates are out of range [0, 1], you can control how they should be displayed. Direct3D supports four kinds of texture addressing modes: Wrap,mirror,clamp,border.

Wrap

In wrap addressing mode, the texture is treated as a vertex coordinates duplicate mapping in parts other than the range [0, 1]. For example, to map a texture to a quadrilateral, the Uvs coordinate of the quadrilateral is (0.0,0.0), (3.0,0.0), (0.0,3.0), (3.3,3.3), and the result of the mapping is repeated 3 times in the direction of the UV two axes. Figure 5.8 illustrates this situation.

Figure 5.8 A Textured Quad in wrap texture address mode. (Texture by Brian maricle.)

Attention:

In Figure 5.8, the black border around the texture map is part of the actual texture, not created during the wrap addressing process. The black border is only marked with an integer boundary for wrap addressing.

Mirror

The mirror addressing mode is very similar to the wrap addressing mode, where the adjacent textures are mirrored rather than repeated at the integer boundary. The result of using the mirror addressing pattern in the same texture quadrilateral is shown in Figure 5.9.

Figure 5.9 A Textured Quad in mirror texture address mode. (Texture by Brian maricle.)

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/extra/

Related Article

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.