OpenGL ES 2.0 Fog

Source: Internet
Author: User

The use of fog in the scene not only improves realism, but also optimizes performance in specific situations. In particular, when the object is far enough away from the camera, the fog is strong enough to see only the fog and not see the object, it is not necessary to the object coloring detailed calculation, which can greatly improve rendering efficiency.

There are many mathematical models of fog

Linear Model:

F=max (min (end-dist)/(End-start), 1.0), 0.0)
  • F is the atomization factor, the value range is 0.0~1.0 (0 means the fog is very thick, only see fog)
  • The dist is the distance from the camera that the slice element is currently being drawn.
  • End represents a specific distance value, and the atomization factor is 0 when the distance from the camera exceeds end
  • Start represents a specific distance value, and the atomization factor is 1 when the distance between the element and the camera is less than start

Nonlinear Calculation formula:

F=1.0-smoothstep (Start,end,dist)

OpenGL ES 2.0 Fog

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.