On the problem of floating-point precision

Source: Internet
Author: User
Tags float double

Float double number of precision, their own original also do not care, but this big six months down unexpectedly found on this issue on a somersault.

Summarize down the Write renderer program:

1. Calculate the various transformation matrices on the CPU side as far as possible to double the type of data, and finally to the GPU and then to float.

2. If the numerical deviation is too large, it is recommended to convert to a local coordinate system for various calculations and eventually to the final coordinate system.

3. The high accuracy set in the vertex shader is really small compared to the medium performance, but the effect is good.

4. Sometimes passing the time variable to the shader will increase with the opening of the program, pay attention to the precision at this time, take the necessary measures, such as the method of taking surplus.

On the problem of floating-point precision

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.