Common geometric functions, texture mapping functions and partial derivative functions in GPU programming

Source: Internet
Author: User

In GPU programming, functions are generally divided into the following types: Mathematical functions, geometric functions, texture mapping functions, partial derivative functions, debugging functions, and so on. Good use of the GPU's own function can improve the speed and efficiency of parallel programming to some extent.

in the previous section, mathematical functions have been introduced, and mathematical functions have been used to perform commonly used calculations in mathematics, such as trigonometric functions and powers. Vectors and matrix functions , which are generally overloaded to support scalar data and vectors of different lengths as input parameters. This section describes geometric functions, texture mapping functions, partial derivative functions, and debugging functions.

Geometric functions (geometric Functions)

geometric functions, as shown in the table, are used to perform calculations related to analytic geometry, such as the reflection light and the refraction light direction vectors based on the incident light vector and the vertex normal vector. The Cg language standard function library has 3 geometric functions that are often used, namely: normalize function, normalization of vectors, reflect function, calculating reflected light direction vector, refract function, and calculating refraction light direction vector. Shout loudly and ask for strong attention:
1. The vector in the coloring program is best to be normalized before use, otherwise unpredictable
Error
2. The reflect function and the refract function all have the "incident light direction vector" as the input parameter, noting that the incident light direction vectors used in these two functions are pointing from the outer to the geometric vertices; usually I

In the coloring program or in the textbook, the incident light direction vector is used as the starting point.


Geometric function table

Texture mapping function (Texture map Functions)

The following table provides the texture mapping functions in the standard library of functions. These functions are fully supported by fp40 such as Ps_2_0, ps_2_x, ARBFP1, Fp30, and profiles (fully supported). All of these functions return a four-tuple vector value.


       

Texture mapping function Table

Partial derivative function (derivative Functions)


Debug functions (Debugging function)


Common geometric functions, texture mapping functions and partial derivative functions in GPU programming

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.