HDR in physics and computer graphics

Source: Internet
Author: User

HDR technology has been widely used in offline CG rendering, games, movies, and other aspects, which can significantly improve the contrast and realism of scenes. However, there are few CG artists and figures behind the physics and mathematical principles.ProgramDevelopers are very recommended to read this article and understand the basic principles. This is not an example of how to implement HDR on a GPU.Article.

Introduction

Today, most graphics software is based on the 24-bit color and occupies 8 bits for each channel.AlgorithmEncode the color. The advantage of this approach is that it can be compatible with most display devices with CCIR-709 standards, the sRGB standard we are familiar with, with a gamma value of 2.2. However, the disadvantage of this method is also obvious. It cannot represent colors outside the sRGB range. These colors are usually very bright or dark, which causes loss of contrast and dynamic range.

We know that human eyes are the most precise cameras, and the contrast is more perceptible than any other kind of equipment-from the faint stars in the sky to the Sun's high sun, people can identify the details of the bright and dark scenes in a scenario at the same time. You must know that the contrast indicated by this brightness and darkness is quite striking. To solve this problem, we must first understand the human eye structure. Human eyes are divided into the retina and the refractive part where the photosensitive cells are located. The human eye adapts to electromagnetic waves with a wavelength of approximately -740nm, that is, visible light. There are three different cone-shaped cells and a rod-shaped cell in the eyes of ordinary people. The first one is red, with the most sensitive point around 565 nm. The second is green, with the most sensitive point around 535 nm; the third method is blue, with the most sensitive point being 445 nm. The sensitivity curves of these conical cells are roughly bell-like normal distribution. However, each cone-shaped cell not only senses the most sensitive electromagnetic waves, but also reacts to the light at other wavelengths. In fact, the feeling of Color also depends on your preferences, and even the psychological status and experience.

With the development of display technology, LCD displays become more and more popular and gradually replace CRT display. At the same time, the display hardware can generate more and more colors, and the original color standards appear more outdated. It is particularly necessary to redefine a new color standard, in addition, the old color standard space must be correctly mapped to the new color space to ensure forward compatibility.

True Problem

The simplest way is to use floating-point numbers with almost infinite precision to represent relatively limited colors-most people can only recognize about more than 10 million colors, in addition, many colors are not frequently used. Currently, we use the ieee754 standard floating point number and openexr, and are compatible with the semi-floating point formats of nvidia and ATI hardware. The disadvantages and advantages of floating point numbers are as obvious as they occupy a large volume. In real-time rendering, we recommend that you use half-floating-point numbers. The hardware can perform fast interpolation and sampling Filtering for this format. However, due to limited bandwidth, the hardware cannot handle 32-bit floating-point data.

Let's get back to the beginning and re-explore the nature of color. What is the essence of visible light? It is an electromagnetic wave within a wavelength range and an integral of all the electromagnetic wave energy in a continuous range. Of course there are pure Monochrome laser light sources in the world, but almost all of us are not in touch with monochrome, such as the sun, fluorescent lamps, incandescent lamps. The human eye regards the color of the mixed light as the color of the light of the monochrome light source. For example, the orange wavelength is about nm, which can be actually mixed by red and green light, because the monitor cannot produce a monochrome orange. The following shows a spectral rendering formula, which is essentially consistent with Gobal illumination Global illumination technology.

 

This formula implies several assumptions: 1. The wavelength of the reflected light of an object is equal to the wavelength of the incident light from the light source, and the object itself never emits light, in violation of the theory of black body radiation of quantum mechanics; 2. The incident position of the light is equal to the output position without scattering, which makes the object an ideal plane and ignores the micro-plane effect. 3. Non-polarization, diffraction, violation of the optical properties of the material. Of course, we can't be picky about it now. Today's Ray tracking Renderer, such as vray, Mental Ray, Maxwell render, and renderman, even if these real features are not fully taken into account, in the hands of many CG artists, there are also photos that can fool the eyes of ordinary people. In fact, many physical researchers have already done a lot of work and pointed out various problems. However, people in the CG industry think that many problems have been solved. For CG, people prefer to use it as an art of technology, rather than a pure technology.

Tone Mapping

Let's go back to the spectral render spectral rendering formula. If we have a spectral chart, it takes two steps to convert it to an image that can be displayed. Step 1: Use the Standard CIE observer functions observation function to convert the spectral radiances spectral radiation to the tristimulus space triplicate space cie xyz. Step 2: Convert the cie xyz value to the color space. The second step is called tone mapping, and there are three points to note:

    1. Color: what we need is a precise color that has nothing to do with the observer.
    2. Saturation: Maintain the saturation as much as possible without interference, and allow partial color drift.
    3. Feel: Try to ensure that people will still feel real when they map to a limited color range.

In terms of implementation, there are mainly the following technologies:

    • Uniformly scales the original color range to match the display range.
    • The method is the same as that of method A, but the display range must be reduced, which affects the color with low saturation or extremely high saturation.
    • Use the global histogram global image statistical chart data to scale the color accordingly.

Death in physics

Before we implement tone mapping, we must first understand what the seemingly familiar things of xyz rgb are. A simple illumination model, a monochrome light source, and an ideal scattering plane, which emits radiation in the following format:

Where p D (λ) is the diffuse reflectance scattering reflection ratio function of the wavelength. EI (λ) is the incident radiation degree calculated from the points of each light source. In this way, we can use the Standard CIE function for conversion:

Is everything ready? Far from enough. The following uses an actual example to demonstrate a feasible method.

I'm a flower

We chose 3 light sources, 2856k of Tungsten (incandescent) illum A, simulated daylight illumination illum B, and 6500k of sunlight illum D65. Analyze their emission spectra respectively.

From the figure, we can easily identify which curve is produced by tungsten. in blue, it is concentrated in a large number of long wavelength segments, that is, the red and yellow light is much separated.

Then, we analyzed the emission spectra of Macbeth blueflower macpest blue flowers under the respective functions of the three light sources.

By analyzing the spectral data, we calculated different numerical graphs under three color standards.

 

Matrix le

How can we get the nine different data types above? Use the following matrix formula:

If we need to convert under different lighting conditions, use the following formula:

Here is the linear von kries model and cmccat2000 matrix, used for color conversion under different lighting conditions. The original white point (RW, GW, BW) is obtained by multiplying the cie xyz and cmccat2000 matrices. In order to simplify our operations, the lengthy matrix multiplication formula is summarized into the following two matrices for directly converting cie xyz under B and a lighting conditions to RGB.

Greedy request

Obviously, we urgently need a texture file format that is super expressive, small in size, and irrelevant to the device. In 1985, the 32bit rgbe texture format was implemented to meet the needs of the radiation Renderer. Pixar has a 33bit log RGB format for the Reyes Renderer, which will be open-source in the future to form today's LibTIFF library. Later, the author worked in SGI and made some updates to the library, which greatly increased the scope of performance and used the RLE compression method to make the file smaller.

Only the SGI's logluv tiff encoding format covers all colors and Dynamic Ranges. The dynamic range of rgbe format is also very large, but its RGB value can only be positive, so there are some colors that cannot be expressed. The disadvantage of Pixar format lies in a small range. So people use the logluv TIFF format. Currently, many software can process this format.

Back

Is it over? Yes, it is over. Practice has proved that the third method is feasible in real-time rendering. You may wish to look for a NVIDIA ppt and related demos. You can refer to several paper articles on how to implement HDR on the GPU.

E? Cient histogram generation using scattering on GPUs

Carucci, F., 2006. HDR meets Black & White 2. Game Developers Conference 2006: d3dtutorial day, March.

most of the articles in this article are based on Greg Ward's high dynamic range imaging. The relevant image formulas are from this article. The copyright belongs to the original author.

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.