An Implemention of realtime Gobal illumination

Source: Internet
Author: User
Tags vpls

The "effect" of CG images is the most important. As for the technology used to achieve this effect, everything is transparent to the audience. Even Pixar thinks that only one bounce indirect illumination is sufficient for building a realistic and credible illumination effect. I think you will have a new understanding of realtime Gobal illumination. I have achieved a true and trusted indirect illumination effect. Compared with the Mental Ray attached to 3dsmax, I don't have to hide the shadow. I think my image quality is better. Provide my demo download, but there is a small bug :-) hope you can help me to take a look.

Splatting indirect illumination (ⅱ) is the simplest indirect illumination method for implementing indirect illumination. It integrates shadow ing and defered shading. Most of them use the reflective shadow map (RSM) technology. Although the technology is very simple, there is no exaggerated calculation amount of realtime raytracing, and there is no limitation of realtime radiosity, it is a very suitable for real-time renderingProgramEspecially the game technology, used to achieve a realistic and credible indirect illumination Indirect lighting effect, combined with the existing local illuminationAlgorithmFor example, IBL lighting and ambient occlusion can fully realize the rendering quality at the film level. This is mentioned in Pixar's design philosophy.

The second is derived from the RSM algorithm. Therefore, before implementing the second, you need to explain the RSM. RSM consists of four render targets (RT): Depth component, World Space coordinates, World Space normal, and flux. The first three are very popular. You can directly bind the floating point texture to the framebufferobject and output it in the fragment shader. The last flux needs to be explained.

In the RSM idea, every point that appears in the depth map of the light view contributes to the indirect illumination effect of the scene, which is calledPixel light. For each pixel light, we can first imagine that it is infinitely small, so the light intensity it emits In the ω direction is,

 

Similarly, for verticesXAnd its VectorsNThe contribution of pixel light to its illumination is,

Then, we can think that the illumination of each point in a scenario can be obtained by integrating the contribution of these pixel light,

For glossy objects, if we use a illumination model similar to Phong,

For the original RSM algorithm, it takes a lot of time to collect all the gather pixel points from the RSM texture for calculation. Therefore, the improved method is adopted in the second method for sampling. Here we will not do the processing first, using hammersley point set distribution. For example, the number of samples is 64,

 

 

The following preparation begins implementation.

1. First, we will render the entire scene from lightview to three rendertargets: World position, world normal, and flux.

2. Then we prepare the defering shading rendertarget, that is, the parameters required for illumination calculation, such as world position, world normal, diffuse, specular, and shininess, from the camera Rendering scenario.

3. Use the point set to sample the texture obtained in [1] and then output it to the same RT in [1.

4. In the final rendering, use the data in [2] and [3] for illumination calculation.

There are several tips in this article. The first one is how to quickly generate the RTS. The answer is of course the MRT. I used gl_rgba_float16_ati as the attachment of FBO. Compared with gl_rgba32f_arb, The fp16 format ensures sufficient accuracy. The most important thing is that the hardware can perform gl_linear filtering, while the fp32 hardware only supports nearest filtering. Using two floating point textures on my 7300go, there is almost no difference in the effect, and through memory monitoring we can know that fp32 makes everything huge.

Here, only one VPL is used for rendering and the effect of local illumination is obvious. The right side is the result of using 64 VPLS.

Here we use the Mental Ray rendering of 3dsmax. We used a spotlight and didn't enable GI, because the figure obtained by photon mapping after GI was opened was terrible and we were not patient to adjust the parameters.

 

Export the entire 3DS scenario. This is the result of real-time rendering. A spot texture is used only to play :-). Similarly, no shadow is rendered.

 

This is a scenario that is rendered after 128 VPLS is used. To simplify computing, I regard spotlight as a point light.

In this classic Cornel box, the statue of the Virgin Mary and the Holy Child is standing, and the red and green diffuse sides are on the right side of the statue. The statue reflects the effects of the two diffuse colors, the ceiling is also light red and green. If the shadow and ambient occlusion and Ibl are added, the effect will be more perfect. Here I have successfully implemented indirect illumination, and most importantly, everything is real-time.

The demo can be downloaded here, but there is a small bug. After rendering a few frames, the screen will be black. I don't know if it is a buffer switching problem or something else. I am not very clear about it, if you want to check the program, please check it out. If you have any results, contact me. Thank you!

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.