Improvement of deferred rendering in klayge 4.0 (4): GI myth

Source: Internet
Author: User

Reprinted please indicate the source is klayge Game Engine

 

The previous article solved the problem of transparent object rendering. This article will challenge another myth of real-time rendering, real-time Global Illumination (GI ).

Real-time dynamic Gi

Currently, direct lighting is becoming more and more mature in the game, and the more avant-garde game engine is no longer able to meet the diect lighting effect, and gradually begins to Try Indirect lighting. Early methods include rendering light map offline to achieve GI of static scenarios and static light sources. Then PRT appears, which can handle static scenarios and dynamic light sources. The light propagation volumes method is used to produce diffuse GI for dynamic scenarios and dynamic light sources without pre-calculation. However, its speed and quality are not flattering. Can't you?Dynamic scenarios,Dynamic Light Source,Diffuse and specularOfReal-time GiHow? Yes! Multiresolution splatting for indirect illumination (Mrsii.

In klayge 3.12, atyuwen, a team member, has implemented mrⅱ. After more than half a year of improvement, this GI method has been integrated into the new deferred rendering framework, and the performance has been greatly improved. Let's take a look at this magical GI.

The rendering process of mrⅱ is as follows (thanks to vanish for organizing this flowchart ):

First, G-buffer needs to be used as the mipmap. Then, we can detect the depth and normal break points at each layer, mark the break points in the stenpencil buffer, and obtain the stenpencil buffer as follows:

Like the previous stencel rule, the highest bit is 1, indicating that the rule is ignored. So the gray pixel can be ignored, and the black one needs to calculate the light. It can be seen that the black area is not large, and most pixel is skipped.

In addition, a reflective shadow map must be generated. Like shadow map, RSM also renders scenes from the light source perspective. In addition to depth, RSM also needs to save Normal and flux information. Sample RSM points, such as 256 points, as a virtual point light source (VPL ). Currently, the klayge uses a uniform sampling method, which will be changed to importance sampling in the future to improve the VPL distribution efficiency.

Finally, each VPL can generate a light volume based on BRDF. Use these light volume to illuminate each layer of G-buffer. The initial light volume is a hemisphere. In its vertex phase, some vertices are pulled out based on the brightness reflected in each direction to generate a strange light volume. This phase is time-consuming because it involves a lot of filling and computation, but most pixel will be blocked because stencel test is open, the number of pixels actually involved in the calculation is much smaller than the total number of pixels in G-buffer, and GI is significantly accelerated. After testing, in the current scenario, if only one layer of G-buffer (that is, no multiresolution) is used, the speed is only half of the three layers. If it is greater than three layers, the speed has not increased. Therefore, layer-3G-buffer is selected by default.

After generating Indirect lighting results for each layer, a special interpolation upsampling is required to obtain smooth results. This interpolation is described in the original paper of mrⅱ, so it is not cumbersome here.

If you just use the ordinary closest point interpolation or double line interpolation, there will be a lot of sad serrations:

Finally, add Indirect lighting to direct lighting and continue to perform the next shading pass. The final result is as follows:

Compared with the result of direct lighting, we can see that the right side and the ground are illuminated:

After mrⅱ is used, for RSM of 512 × 512, 256 VPL, and L3 G-buffer, GI only needs 1.09 Ms On gtx480 and 4.3 Ms On 9800gt. At present, there is still a lot of performance space to be mined. I expect that under the same quality, the speed will eventually reach 0.5 ms on gtx480 and Ms On 9800gt.

This GI framework not only supports reflective Indirect lighting, but also supports high-frequency reflection such as caustics, and can handle sub-surface scattering and other material effects. In Versions later than klayge, mrⅱ will continue to develop.

This article describes the Real-Time GI practice in detail, and the next article is about the improvement of post process.

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.