Two texture ing methods

Source: Internet
Author: User

Texture ing can be performed in two ways:

Ø



Load a created texture file and then apply the texture data.

Ø



The other is to calculate the texture content one by one in order, that is, we first create an "empty" texture, and then calculate the color of the texture element based on some defined parameters. In terrain rendering, this parameter is the height of the terrain.

This method is first used
D3dxcreatetexture

Create an empty texture, and then lock the top texture (because there are multiple layers of texture. Now, we start to traverse each texture element and color it. The color is based on the approximate height of the coordinate square. The idea is: the lower part of the terrain is colored as the beach, the middle part is colored as the green hill color, and the high part is colored as the snow mountains. We use the height value of the vertex in the upper left corner of the coordinate square to represent the overall height of the square.

After coloring each texture element, we can adjust the brightness of each texture element based on the incident angle when the sunlight (simulated by direction light) reaches the coordinate square corresponding to the texture element.

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.