[ZZ] Hdr&tonemapping

Source: Internet
Author: User

http://blog.csdn.net/toughbro/article/details/6745207

Float Game Storage Photo Blogimage

HDR

High dynamic range.

Many program friends (including me) are seeing and learning this concept from DXSDK, and are starting to learn more about the process of a complete set of HDR sample:

    • Render scene at float render target
      • Many of the games on the console use RGBM and other encodings to save memory and bandwidth
    • Calculate Brightness by Down sample
      • Treyarch is cook to the scene data, save this down sample process
    • A correction to the scene based on brightness (tone mapping) is finally output to a RGB8 render target
But as the game industry's picture level began to develop to the film level, we need to have a better understanding of HDR, to further the game like the film Quality promotion, which is also in recent years GDC and Siggraph have a first-line studio in the push HDR-related technologies, such as naughty DOG10 filmic tone mapping,11 year Crytek Siggraph in physically based HDR and so on. First look at the concept:
    • The <tone mapping> paper in Dynamic Range:reinhard defines: The ratio of the highest brightness to the lowest brightness in a scene is the dynamic range.
    • Low dynamic Range: This is the case of image storage media (printing paper, photos, computer screens, etc.) limited precision, resulting in a range can not completely record the brightness information of a scene, only a limited number of records, such as the game is common in the rgba8 on the rendering, The portion of each channel greater than 1 is intercepted to 1.
    • High Dynamic Range: imaging, an image technology that allows an image to represent a greater (greater) dynamic than the previous technology (Lowdynamicrange) Range
      • This makes it possible to depict a scene more accurately and realistically.
Further, the existence of HDR in the image storage and expression medium accuracy is limited, which is why the game engine big guy is the CG and the film quality, rather than the same as the reality: because the storage media here, can not be the same as the reality, CG is the upper limit. In practical applications, we have also seen that HDR in addition to the range on the force, in the precision can also be better, such as the portrayal of dark scenes, can be corrected to the brightness can fully display the dark details. tonemapping&exposureadjustmentHere, in addition to the correct mathematical brightness calculation, to take into account the characteristics of the retina of the human eye, such as the previous gamma is a retinal characteristics, redistribution of luminance information, so that the human eye in the limited display accuracy to obtain the maximum amount of information. The retina has two typical features, which are addressed by tone mapping and exposure adjustment:
    • Automatically corrects light and shade according to brightness: let us see things at night can be more clear, a light eye to rectify a will come back
    • Local adaptability: The more classic graphs are:
Here we encounter two problems, each with two solutions:
    • Exposure Problem---Resolved: exposure adjustment. and photography when the principle of exposure, daylight exposure is shorter, night exposure longer, programming time is to calculate the average brightness of the render target, and then corrected, so that the desert day and jungle night can be in the game in the Rgba8 on a good embodiment. In Hable's paper, this is a category of dealing problems between different scenarios.
    • The process of compression inevitably involves the redistribution of luminance values, how to get better as possible without distortion of the screen this solution is tone mapping
Actually also have this exposure adjustment and to tone mapping, in fact or separate better, because these concepts are from the camera technology, exposure is exposure, tone mapping is tone mapping.

Reinhardtonemapping

Tone mapping aspects of the more famous Reinhard brother:

Reinhard Home

http://www.cs.ucf.edu/~reinhard/cdrom/

Paper Link:

Http://www.cs.ucf.edu/~reinhard/cdrom/tonemap.pdf

What's tone mapping doing?

Dxsdk inside also said, originally is the concept of photography, solve how to put the scene of a large range of brightness values in a limited range of storage space (photo, printer ...) ), to achieve a favorite result.

This is a "let people like the result", it is a subjective meaning of things, there is no absolute standard, nor say what is absolutely right and wrong, according to the game type and developers, players taste, big can choose their favorite results, tonemapping is to achieve this result of the method just.

Tonemapping related research is developed from photographic technology, but digital imaging has a better advantage than photographic wash photos, can further develop:

First identify and define some concepts:

    • Zone: The brightness level of the storage space such a concept, such as print only 11 zone
    • Middle Grey: The brightness in the middle
    • Dynamic range: Refers to the ratio of the highest brightness to the lowest brightness in the scene
      • This is the most academic definition, specifically the photographer will generally pursue the details of the range can be discerned
    • Key: A numeric value that describes the brightness of the entire scene
    • Dodging and burning: to reduce the brightness of things to dodging, the low brightness of the part of the light to burning
Luminance MappingThe first is to map the scene brightness to image, this step is luminance mapping:luminance calculation: This calculation uses the log. Step 1:simplestresult = x/(1+x); In the simplest case, encode any large brightness to between 0 and 1. Although the effect is not so good, but it is also a luminance mapping. Step2:more controll (white) defines the brightness on the screen that represents pure whiteness.dodging and burningGenerally speaking, like DXSDK inside is a full-screen unified a measure of correction, this is also possible, but Reinhard this inside said sometimes this is not very good, such as the whole scene is very bright, inside part of a very dark situation (such as a tree under the background of light), full-screen unified correction (that is dodging and burning), the effect is not good. This can be done in a smaller area for dodging and burning to further enhance the contrast of the local, can be achieved in some cases of "like". The basic idea here is to collect information such as brightness in a scale to do further calculation, operator is also many. Basically know that this is enough. filmictonemappingThe presentation:http://cmpmedia.vo.llnwd.net/o1/vault/gdc10/slides/hable_john_ of hable who worked at Naughty Dog on GDC10. Uncharted2_hdrlighting.pptx later he said in his blog more details: (even more important, the content of the PPT but see there will be a lot of confusion about the place) http://filmicgames.com/archives/75

Tone mapping is a primitive color to the target color mapping process, different functions present some different features, here are some, look at the comparison:

PPT in a few more contrast, here directly summarize the benefits of filmic tone mapping:

    • A more "brittle" transition to a dark color
    • More Soft Highlights
    • The match on input color is also closer to linear
In the end, hable this operator in the CG industry because it looks better in practical applications. This is also a lot of movies in the use of operator, its mapping curve such as: to achieve similar filmic tone mapping of mapping when the general is to put the mapping relationship in texture, and then sample texture, But there are cows who put mapping into a formula, Hable also added parameters can let the fine arts tune: [CPP]View Plaincopyprint? < param name= "wmode" value= "Transparent" >
    1. A = Shoulder Strength
    2. B = Linear Strength
    3. C = Linear Angle
    4. D = Toe Strength
    5. E = Toe Numerator
    6. F = Toe Denominator
    7. note:e/f = Toe Angle
    8. Linearwhite = Linear White point Value
    9. F (x) = ((x* (a*x+c*b) +d*e)/(x* (A*X+B) +d*f))-E/F;
    10. Finalcolor = f (linearcolor)/F (linearwhite)
In the specific code to see Hable blog better: [CPP]View Plaincopyprint?
  1. float A = 0.15;
  2. float B = 0.50;
  3. float C = 0.10;
  4. float D = 0.20;
  5. float E = 0.02;
  6. float F = 0.30;
  7. float W = 11.2;
  8. FLOAT3 Uncharted2tonemap (FLOAT3 x)
  9. {
  10. Return ((x* (a*x+c*b) +d*e)/(x* (A*X+B) +d*f))-e/f;
  11. }
  12. Float4 Ps_main (float2 texcoord:texcoord0): COLOR
  13. {
  14. FLOAT3 Texcolor = tex2d (Texture0, Texcoord);
  15. Texcolor *= 16; //hardcoded Exposure adjustment
  16. float exposurebias = 2.0f;
  17. FLOAT3 Curr = Uncharted2tonemap (Exposurebias*texcolor);
  18. FLOAT3 Whitescale = 1.0f/uncharted2tonemap (W);
  19. FLOAT3 color = Curr*whitescale;
  20. FLOAT3 Retcolor = POW (color,1/2.2);
  21. return Float4 (retcolor,1);
  22. }


[ZZ] Hdr&tonemapping

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.