A Study of Shadow mapping (Shadow map) (ii)

Source: Internet
Author: User

A study of Shadow mapping (Shadow map) (ii)

The previous article introduced my more detailed study of z-cache. The reason for the derivation of the z-e function here is that we need to look for its change curve to find the extremum point, so that we can determine the ze relative to ZW distribution of the density. Fortunately, the derivative functions we find are hyperbolic functions, and the right side of our concern is monotonically increasing.

Saiyang original article, starting address: http://blog.csdn.net/gamesdev/article/details/44946763. Welcome to come to discuss the peer.

leads to the conclusion of the previous article, when

, the Guide function gets the maximum value. However, in zw∈[0,2n-1] the derivative function is monotonically increasing, and the original function ze on zw∈[0,2n-1] is monotonically decreasing. This results in 16, 24, or 32-bit depth data that uses a large portion of the range to differentiate the z-values in a small part of the perspective space, and the distant Z-values are only distinguished by a small portion of the data range, so the more distant the data, the more likely it is to cause z-fighting. So I would like to try to get a far greater number of places to allocate a larger range of Z-values what should I do?

Based on the analytic expressions and images of the derivative and the original function in the previous article, we need to have the same [0,ze] represented by the richer [0,ZW], then we need to translate the image of the function to the right. As shown in the following:

So we're going to put the extremum point (non-conductive)

Pan right. By setting:

Solving inequalities and finally getting

Inequality to the right is a constant, then the left near as large as possible or far as small or both carrot, so as to ensure more precision for further camera space position.

The shadow mapping we produce to avoid low precision, or z-fighting phenomenon, need to light and camera space near and far need to abide by the above laws. Here I take my example program to compare:

It can be seen that the correct setting of the near-far cutting surface plays a significant role in reducing z-fighting.

A Study of Shadow mapping (Shadow map) (ii)

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.