Efficient and realistic cloud rendering algorithm "Go"

Source: Internet
Author: User

Original link: http://www.cnblogs.com/effulgent/archive/2008/10/06/1305029.html

Original:

Realistic and Fast Cloud Rendering
Ninianewang
Microsoftcorporation (nowatgoogleinc.)
[Email protected]
november11,2003

Recently on the Internet to see a lot of cloud rendering, but a lot of people to share the experience of knowledge, I do not very much agree with this idea, is belong to other people's knowledge, their own fortunate to learn to be able to share. Needless to say, the method described in this article is the method used by Microsoft Flight Simulator 2004, and the implementation of cloud in Crysis, of course, there are more improvements in Crysis. Thank my former colleague for providing the original paper.

The clouds of the evening

The cloud is an important element of the outdoor scene, this article will describe the use of particles to give a texture to myopia in various forms of cloud, and even in the case of dark clouds can also be very ideal operating efficiency, in the light shading we give the art of the greatest control, the use of art resources to obtain the ideal lighting effect, Rather than the traditional use of simple lighting models to calculate, so that the final effect controllability will be stronger. We will also talk about simulating the effects of cloud clustering and dispersion.

real clouds can make the outdoor scene wonderful, especially in the interactive realism of the application is particularly important, good cloud system must be able to present various forms of density, and all directions are real clouds, our system must meet the following requirements: 1. Must be efficient, the platform is widely used 2. To be good Simulate the lighting effects of clouds 3. Clouds need to move.

Traditional Cloud Technology
Many techniques are used to model, animate, and render clouds. For example, the most traditional body rendering, using the noise generated by the program to interfere with the texture of an ellipsoid, and the color calculation is based on real atmospheric conditions, the biggest drawback is not controllable, whether it is the shape of noise generated or shading effect, and then the body rendering itself with the polygon 3D or some difference, 2 people together more troublesome.

If you are interested in body rendering clouds, please refer to: http://www.vrvis.at/via/resources/course-volgraphics-2004/
Course Notes "Real-time Volume Graphics", Course #28, Siggraph 2004
If you are interested in purely physical simulations, please refer to: "Real-time Cloud Simulation and Rendering" by Mark Jason Harris

How do we model clouds?

We use 5-400 Sprite Alpha blends to render a single cloud, and all sprites face the camera when rendered, aggregating together to form a volume with a 3D distribution. Then we need to follow the camera distance to render them back and forth, but how do we build these sprites? We chose a way to give the final effect a better controllability, the traditional way of generating programs, especially to expose the control of many of the equation parameters to make the artist painfully, and can not see both gains. We have written a 3ds-max plug-in, it can let the art through a series of square boxes to approximate the overall shape of a cloud, the artist can also specify the number of sprites generated later, so as to control the cloud's shade, but also set the size range of generating sprites, the resulting sprites are mostly squares, Of course, it will also use a few narrow rectangles to simulate cloud international see the most misty part, usually a 16 square kilometer of the sky will use 20-200 boxes to describe the cloud layman, and each box according to the clouds will eventually generate 1-100 sprites. When exporting, the plug-in will be based on the box range, cloud density and other parameters to generate a series of Elf center points, and then the plug-in will traverse the wizard, the distance is too close to eliminate the energy, so as to improve efficiency, we found that this threshold is specified in the 1/3 elf size in the ordinary cloud can be satisfied with the effect, Dense clouds use the 1/5~1/6 size. When exporting, we need to include the following information: Sprite position, size (length width), rotation (increase randomness), texture, and coloring information (detailed later).

What textures do we use?

We use a combination of (different quantity ratios, different rendering parameters, rotational twisting, stretching) above 16 kinds of cloud textures to simulate a variety of different clouds, the figure of 32 with an alpha channel. For example, using more than a 4th texture to simulate the flat bottom of the cloud, And the first row of the other 3 kinds of fog-like texture used to simulate the blue-gray color of the thin cloud, the bottom two rows of the full swell of the texture is used to simulate the accumulation of clouds, the remaining texture in all types of clouds are applied. To simulate as many clouds as possible with a limited 16 textures, we need to do more transformations , the general cloud we make it random within the 0~360 range, while the flat bottom of the rain clouds is generally used-5~5度.

What do we need to do to fly in the clouds?

Our system will provide a real experience for the camera to travel through the clouds, and when the camera passes through the genie, the genie disappears from the field of view, which usually achieves a perfect result, but if the camera is morphing through the clouds, there may be some visually uncoordinated mutations. When we realized this solution for the first time, we let the genie always face the camera plane as the bulletin board, so that the sprite's boundary will not be clearly felt during the motion of the camera, when there is a great disadvantage, when the camera is very close to the elf, the sprite rotation will be very obvious, in order to solve this problem, We decided that when the camera distance is less than half the elf radius of the Sprite, it will no longer rotate the sprite, this can be a good solution to the previously mentioned sprite rotation problem, but also introduced a new problem, if the sprite rotation is locked, if the camera rotation to observe the wizard, the spirit of the boundary will be more obvious at this time, Finally, we decided to adjust the sprite's transparency based on the angle between the camera's viewing direction and the direction of the sprite lock.

How does the cloud become extinct?

The natural generation and extinction of the cloud will greatly increase the authenticity, here we control the level of the sprite Alpha to complete the evolution of the cloud, we use the position of the sprite in the cloud to determine the degree of transparency of the vertex, when the cloud formed, we first only render in the cloud half a radius of the sprite, as time passes, Gradually reduce their transparency, and when transparency reaches a threshold, we begin to render sprites that are half the radius away. The process of the disappearance of clouds in contrast, when the sprite is almost half the radius of the total transparent, beginning to increase the radius of half of the sprite's transparency, it should be noted that the more outside the sprite use a larger transparency changes.

How does the cloud do light coloring?
Our coloring model is dominated by two control factors, skylight and sunlight.

Simulation of Skylight
In reality, when light passes through the clouds, it is scattered and absorbed by the particles of the cloud, usually in the uniform skylight conditions, the clouds will appear on the Baixia dark appearance, in order to simulate this effect, the artist first defines 5 color levels, each color level consists of an RGBA color and height.

Artists can use different brightness levels to simulate different types of clouds. The method of use is shown in the original. The artist also needs to define a percentage level to simulate the intensity of the skylight at different times of the day, such as the Sky's strongest at noon, and the light at night. The final calculation process is as follows: first must complete the bulletin board rotation, let them face the camera, and according to the distance between the wizard and the camera to lock the sprite to the relevant angle, for each sprite vertex, we take its height component, use it in the height level to interpolate the skylight color, and then use the current game time, Interpolation is worth the current skylight percentage level, multiplying the two to get the vertex's current time of the skylight color.

Simulation of the Sun

The sun will cast the direction light into the clouds in the sky, especially in the dawn and dusk, and the changing sun will make the clouds more vivid, and we'll now simulate the clouds facing the sun and the light to the part of the sun. But we do not simulate clouds, clouds themselves, and clouds and other objects in the scene between the occlusion and projection effect. The artist then specifies the shading group in 3DSMAX, usually 1~30 a group of sprites, each box has a user attribute to specify that the box produces the shader group that the sprite belongs to, and each group is used to simulate the tightly clustered clusters of real clouds, when we are coloring a vertex, We first calculate the vector of the center of the shaded group to this vertex, and then calculate the vector of the center of the shaded group to the sun, normalize them, make a dot product, get a value between [-1, 1], and now we want to map this value to [Cmin, Cmax], [-1, 0] to [Cmin , cmed], [0, 1] maps to [Cmed, Cmax]. So the unit cloud cluster from the Ming to the dark there is a smooth transition, and cmin cmed Cmax are brightness percentages, by the artist specified, the artist will also specify the day of the Sun change t0->c0 t1->c1, given a time, the vertex color calculated as:

C_sun = Func_map (V0*V1) * (A * C0 + (1–a) * C1) A = (t1–t)/(T1–T0)

The final color is:

C_vertex = (C_sky + c_sun) * C_tex * alpha_morph

How do I optimize performance?
The main two aspects, one time vertex position calculation and coloring calculation, the second time GPU pixel fill rate. The article mentions the use of vertex information pre-calculation and octagonal ring proxy texture, which is no longer detailed here, please refer to the original text.

Limit

Our cloud system is because of the volume distribution of the elves, so very not suitable for the plane cloud, if you want to do altocumulus and other very flat clouds, You can use the texture plane directly. Because all the particles are then rendered before the forward order, so that the correct rendering effect, but when the camera moves, it is likely to lead to changes in the rendering order, which can be visually altered by some perceptible changes, especially in the solar component of the heavier dawn and dusk, but this problem is not serious enough to Must be resolved to the point. There are other things that don't make sense, such as the cloud seen by the camera in the middle of the cloud is more transparent than it is outside, because half the elves are behind the camera, and that's not the case. When the camera looks down behind the clouds, because the elves are locked vertically, we will see a large expanse of cloud-free space, and a suggested solution is to add an extra atomization to the world to enhance the cloud concentration when the camera enters the center of the cloud. So far we have no animation of the cloud, the reality of the cloud will generally be distorted with the flow of air, we can rotate and move the cloud in the sprite to imitate the effect of wind disturbance, we can also clear some of the sprite to change the shape of the cloud, and so on, because our clouds do not simulate the scattering of light, The cloud itself does not project and does not produce projections for other objects, and it is wrong to use a relative angle to the sun to estimate that the light is based on the distance and density of the sun passing through the clouds, so that we do not get some real-world results, such as observing the solar energy behind the clouds to see the light edge of the cloud.

Efficient and realistic cloud rendering algorithm "Go"

Related Article

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.