Shadow Map (3), shadowmap

Source: Internet
Author: User

Shadow Map (3), shadowmap
Study on Shadow Map (III)

Recently, I have suffered a lot from my own projects. The key point is to implement Shadow Map ). In order to achieve the goal, I have read a lot of relevant information on the Internet and some cases. It took me a month to achieve this effect.

The effect of shadow ing has been described in the upcoming Qt 3D release, in KDAB, Shadow Mappingin Qt3D 2.0 implements Shadow ing on the Qt 3D framework. However, at that time, this effect was assumed that the target machine supports the OpenGL 3.0 specification. Currently, most devices, at least now, can only support OpenGL ES2.0. Therefore, this article cannot provide a good reference, so I went to other related tutorials to see if I can implement the shadow ing effect under OpenGL ES 2.0. Fortunately, there is such valuable information on the network. On the code project website, there is a good article, although it is based on Android, written in Java, but it can display the effect of shadow ing well. The most important thing is that Android basically supports OpenGL ES 2.0, so it is written based on OpenGL ES 2.0, it provides us with a good reference. Original article: Shadow Mappingwith Android OpenGL ES 2. In addition, the article references other links. The article "Tutorial 16: Shadow ing" starts from the problem and studies the essence of Shadow ing, which has a high reference value.

To implement shadow ing based on OpenGL ES 2.0, we must overcome these three technical difficulties:

1. proficient in FBO operations. Frame caching FBO requires skillful control, because FBO can quickly write a deep image into a video memory and then render it as a texture to a real scenario.

2. Master the usage of the coloring tool. Since OpenGL ES 2.0 only allows the use of a shader to render it, it requires a high level of proficiency in writing the shader.

3. Master the operation of splitting float deep data into vec4 and then merging vec4 into float. This has become one of the industry's most proficient skills. You can search for "how to pack float into RGBA" on the Internet and get a lot of useful answers.

After reading the Shadow Mappingwith Android OpenGL ES 2 and the source code several times, I transplanted the test scenario with Qt. Below is:


Source code: here

 

Related Article

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.