G-buffer compression for delayed Rendering

Source: Internet
Author: User

Recently, the Renderer has stabilized and the effect has been almost done. So let's make a summary.

In the initial pursuit of progress and results, the most violent G-buffer a16r16g16b16f x 3 was adopted:

Color0 Normal. x Normal. Y Normal. Z Depth
Color1 Diffuse. r Diffuse. g Diffuse. B  
Color2 Specular. r Specular. g Specularb Specular glossy

It can be said that there is nothing special, the effect is coming out, and the performance is very bad.

So if you want to put it into practical use, you still need to optimize the performance and reduce the weight of G-buffer.

The hardest part is that the rendering style is changed, and the material information is added with emissive (4-component) and half-Lambert (3 parameters)

The RTT format is of course the fastest a8r8g8b8, but the 8bit channel can only save values in the range of [0, 1], with an accuracy of only 256

Normal can save only two parts, refer to the http://aras-p.info/texts/CompactNormalStorage.html, with method #1

Although there are deviations in theory, the results are acceptable. What I want is efficiency.

The depth 8bit cannot be saved. I tried to save it using two 8bit channels before, but it failed. The obtained value is not continuous, therefore, the RTT format is changed to r16g16f (and a channel is missing ...)

MRT does not force the same format, as long as the number of digits is the same (of course there is hardware intz what, considering the compatibility has not tried the http://aras-p.info/texts/D3D9GPUHacks.html#depth)

Here we use a technique to reconstruct position: http://blog.csdn.net/xoyojank/article/details/5294575

To transfer all the illumination computing to viewspace for computing, several GPU commands are saved.

Diffuse cannot be saved

Specular sacrifices the color and only retains the intensity and range. Two parameters are required to scale to the range [0, 1] and write to two 8bit channels.

The result of half-Lambert illumination is a UV. X (float) Addressing 1D textures. Is a bool required for this effect (write symbol, for example, + indicates yes,-indicates no)

Emissive sacrifices the color, uses the diffuse color, and compresses the intensity to write an 8bit channel.

Rimlight computing is incorporated into diffuse before writing into G-buffer, which theoretically has both errors and losses, but the effect is acceptable. After all, it is a secondary effect.

Finally, I made the G-buffer look like this:

Color0 Depth [+/-] [Lambert. u]
Color1 Diffuse. r Diffuse. g Diffuse. B Emissive
Color2 Normal. x Normal. Z Specular Specular glossy

Well, if I had to add material information, I would have cried, and there was no space to store it .....

In addition, the final output range of the synthesis is preferably HDR (a16r16g16b16f). Otherwise, the postprocess effect is aborted.

Or use rgbm (a8r8g8b8) for compression, and then the translucent element can only be combined with a blendbuffer (1/4 in size) separately, which saves a lot of bandwidth and filling rate.

Then, the refraction can be directly obtained from the G-buffer diffuse, and there is no need to make another pass for the refraction, which is tailored according to the depth.

Fog/shadowmap/ssao/softparticle can also directly use the depth information in G-buffer to reconstruct the position for calculation.

ASIDE: The material flexibility of delayed rendering is still poor, but it is quite easy for the program.

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.