A thunderstorm cloud real-time simulation method based on cloud image

By using a real-time simulation method for thunderstorm clouds based on cloud maps, the problem of insufficient rendering of complex cloud layers in existing technologies has been solved. This method enables fast, real-time simulation of tornado-like thunderstorm clouds on a large global scale, improving cloud rendering effects and reducing resource consumption.

CN115906477BActive Publication Date: 2026-03-20HANGZHOU DIANZI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-21
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing technologies are not good at rendering volumetric clouds in simulated extreme weather scenarios, especially complex thunderstorm clouds, making it difficult to achieve efficient and real-time rendering.

Method used

A real-time simulation method for thunderstorm clouds based on cloud maps is adopted. By constructing a large-world cloud space, the effective rendering length of pixel rays is calculated. By combining two-dimensional cloud maps, three-dimensional noise textures and position-density functions, the sampling point density is calculated, and a vortex field is constructed for motion control. Finally, the cloud color is rendered by combining a lighting model.

Benefits of technology

It enables the rapid, real-time generation of tornado-like thunderstorm clouds on a large global scale, improves the rendering effect of complex cloud layers, facilitates the adjustment of cloud shapes, and reduces resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115906477B_ABST
    Figure CN115906477B_ABST
Patent Text Reader

Abstract

A thunderstorm cloud real-time simulation method based on cloud chart comprises the following steps: step S1: obtaining a pixel point ray direction, constructing a large world cloud layer space, and calculating the effective rendering length of the pixel point ray; step S2: based on a two-dimensional cloud chart texture, a three-dimensional noise texture and a position-density function, calculating the bulk density of the volume cloud in the pixel point ray direction to obtain a thunderstorm cloud shape; step S3: constructing a vortex field, calculating the centripetal force received by the cloud body during movement, offsetting the cloud chart sampling UV to realize the movement control of the thunderstorm cloud; and step S4: according to the light position, the light color, the cloud body preset color and the sampling point density, the cloud body color in the pixel point ray direction is obtained by combining the light transmission model; the thunderstorm cloud real-time simulation method based on the cloud chart can quickly and real-timely generate a tornado type thunderstorm cloud in a large world range, and to a certain extent, solves the simulation problem of a complex volume cloud.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of virtual reality, in particular to a thunderstorm cloud real-time simulation method based on a cloud map, which is used for simulating a tornado-type thunderstorm cloud. BACKGROUND

[0002] In a virtual scene, the simulation of volumetric clouds can significantly improve the realism and picture coordination of outdoor scenes. At present, the related volumetric cloud simulation technology is mainly aimed at ordinary stratocumulus and cumulus clouds, and the cloud layer shape is relatively simple, which is not good for the performance of extreme weather scenes, so a rendering technology for complex cloud layers needs to be proposed to solve this problem. SUMMARY

[0003] In order to solve the problems of the prior art, the present application provides a thunderstorm cloud real-time simulation method based on a cloud map, which realizes the simulation of a tornado-type thunderstorm cloud in a large world, so as to improve the picture performance of volumetric clouds in extreme weather scenes.

[0004] To achieve the above purpose, the present application provides the following technical scheme:

[0005] A thunderstorm cloud real-time simulation method based on a cloud map, the method comprising the following steps:

[0006] Step S1: obtaining a pixel ray direction, constructing a large world cloud layer space, and calculating the effective rendering length of the pixel ray; the starting point of the pixel ray is the camera position, and the direction vector of the pixel ray direction is the pixel position minus the camera position;

[0007] Step S2 obtains a thunderstorm cloud shape:

[0008] Step S21: obtaining a two-dimensional cloud map texture, a group of basic three-dimensional noise texture maps, and a group of detailed three-dimensional noise texture maps;

[0009] Step S22: within the range of the effective rendering length, in a ray stepping manner, based on the two-dimensional cloud map texture, the basic three-dimensional noise texture maps and the detailed three-dimensional noise texture maps obtained in step S21, the sampling point density is calculated by a position-density function;

[0010] Step S23: based on the pixel ray direction, the sampling point density of the ray direction is accumulated as the total density of the pixel; Step S3: constructing a vortex field, calculating the centripetal force received by the cloud body during the movement, and offsetting the cloud map sampling UV to realize the movement control of the thunderstorm cloud;

[0011] Step S4: according to the light position, the light color, the cloud body preset color, and the sampling point density, the cloud body color in the pixel ray direction is obtained by a light transmission model.

[0012] Further, the step S1 specifically comprises:

[0013] Step S11: obtaining the pixel point ray direction, presetting the earth center position, the earth radius, the low cloud layer position height, and the high cloud layer position height;

[0014] Step S12: adding the earth radius to the height of the position where the low cloud layer is located as the low cloud layer spherical radius, constructing a low cloud layer hemisphere with the earth center position as the center, and recording it as No. 1 hemisphere; adding the earth radius to the high cloud layer position height as the high cloud layer spherical radius, constructing a high cloud layer hemisphere with the earth center position as the center, and recording it as No. 2 hemisphere; and taking the region between the two hemispheres as a large world cloud layer space;

[0015] Step S13: dividing the camera position into three cases of on the ground, in the cloud layer, and outside the cloud layer, respectively calculating the intersection points of the pixel point ray and the low cloud layer hemisphere and the high cloud layer hemisphere, and recording them as p1 and p2 respectively, the length of the pixel point ray passing through the low cloud layer hemisphere as y1, the distance of the pixel point ray passing through the high cloud layer hemisphere as y2, and the effective rendering length of the pixel point ray according to the intersection condition; when the camera position is on the ground, the starting point of rendering is p1, and the effective rendering length is y2-y1;

[0016] When the camera position is in the cloud layer, the starting point of rendering is the camera position, if the ray has an intersection point with the No. 1 hemisphere, the effective rendering length is y1, and if there is no intersection point, the effective rendering length is y2;

[0017] When the camera position is outside the cloud layer, the starting point of rendering is p2, if the ray has an intersection point with the No. 1 hemisphere, the effective rendering length is the distance between the two points p1 and p2, and if there is no intersection point, the effective rendering length is y2.

[0018] Further, the calculation of the sampling point density in the step S22 comprises the following steps:

[0019] obtaining the cloud layer type density based on the position-density function, obtaining the noise density based on the three-dimensional noise texture, and obtaining the cloud layer distribution density based on the two-dimensional cloud chart;

[0020] The calculation of the cloud layer type density comprises the following steps,

[0021] The first part is the calculation of the type cloud layer density at the sampling point, different types of cloud layers are considered respectively, the cloud layer type is determined by its position, according to the cloud layer distribution in nature, the height of 1500m-2500m is set as the range of stratus cloud, the height of 1500m-4000m is set as the range of cumulus cloud, and the height of 1500m-8000m is set as the range of thunderstorm cloud. The position-density function is a mapping relationship between the position of the sampling point and the density.

[0022] For stratocumulus and cumulus, the position-density function is only related to the height position, the density decreases from the middle position to both sides of the cloud layer,

[0023] For thunderstorm, in the horizontal direction, the density increases from the middle position to the outside, in the vertical direction, the density increases from the bottom to the top;

[0024] For stratocumulus and cumulus, the position-density function sets the feathering boundary, first calculate the proportion of the height of the sampling point in the height of the type cloud layer, the calculation method is the height position of the sampling point minus the height position of the bottom of the type cloud layer and then divided by the height of the type cloud layer, set the proportion as heightFraction, the input of the position-density function is heightFraction, set the bottom height of the type cloud layer as cloudMin, the top height of the type cloud layer as cloudMax, the feathering value as value, map the proportion of heightFraction in the interval [cloudMin, cloudMin+value] to the cloud type proportion interval [0,1], set the value as a, map the proportion of heightFraction in the interval [cloudMax-value, cloudMax] to the interval [1,0], set the value as b, multiply the values of a and b, that is, the density of the type cloud layer at the sampling point is obtained;

[0025] The second part is to obtain the proportion of the cloud type at the sampling point;

[0026] The proportion of the cloud type at the sampling point is obtained through the B channel of the cloud texture, then the type cloud density values calculated by the first part for stratocumulus, cumulus and thunderstorm are weighted and summed with the corresponding proportions, and the final cloud type density is obtained;

[0027] The noise density is obtained by sampling the three-dimensional noise texture;

[0028] The cloud distribution density is obtained by sampling the two-dimensional cloud texture map;

[0029] The cloud distribution density defines the outline shape of the cloud body, which is the extension of the cloud in height, obtaining a column;

[0030] The basic shape of the cloud body is obtained through the Perlin-Worley noise in the R channel of the three-dimensional noise texture, and the details of the cloud body are enriched through the Worley noise in the GBA three channels of the three-dimensional noise texture; the cloud body is further modified using the detail three-dimensional noise texture map;

[0031] The density value of the sampling point is the product of the cloud type density, the noise density and the cloud distribution density.

[0032] Further, the step S3 specifically comprises:

[0033] Step S31: In the horizontal direction, the centripetal force generated by the vortex field affecting the cloud body is calculated according to the XZ plane position of the sampling point by Newton's law of motion.

[0034] Step S32: The height position of the sampling point is mapped to the height proportion Y in the cloud layer.

[0035] Step S33: In the vertical direction, the centripetal force obtained in step S31 is added with a weight according to the Y calculated in step S32, so that the rotation speed of the thunderstorm cloud has differences in height.

[0036] Step S34: The centripetal force is decomposed, and the XZ plane position of the sampling point is updated, so as to offset the cloud map texture sampling UV.

[0037] Further, the step S4 specifically comprises:

[0038] Step S41: Obtain the light source position, the preset color of the middle and edge of the cloud layer, the light intensity, and the preset absorption rate of the cloud body;

[0039] Step S42: Calculate the light of a single sampling point, and step sampling from the sampling point to the light source direction, and accumulate the light value of each interval as the current sampling point light value;

[0040] Step S43: Based on the density of each sampling point in the ray direction of the pixel point, the light of the sampling point, and the light transmission calculation of the cloud body in the ray direction of the pixel point.

[0041] The light transmission model is composed of Beer's law, Beer-Power law and double Henyey-Greenstein phase function.

[0042] Compared with the prior art, the beneficial effects of the present application are:

[0043] (1) The present application can quickly and real-time generate a tornado-like thunderstorm cloud in a large world, which solves the simulation problem of complex volumetric clouds to a certain extent, and the introduction of the cloud map can conveniently define the cloud range and type, which is beneficial to the creator to quickly set the cloud of the virtual environment.

[0044] (2) The present application improves the position-density function of stratocumulus, takes the cloud boundary range as the feathering value, and can more conveniently adjust the cloud shape of stratocumulus under the premise of realizing thunderstorm cloud simulation.

[0045] (3) The resource consumption of the application is low, pre-made three-dimensional noise texture is used, real-time generation is not needed, the memory occupancy of noise at runtime is reduced, and the layering of the cloud layer is reduced by using blue noise to adjust the starting point of the step. BRIEF DESCRIPTION OF DRAWINGS

[0046] In order to more clearly illustrate the objects, technical solutions and advantages of the present application, the drawings used in the embodiments will be briefly introduced as follows:

[0047] Figure 1 A thunderstorm cloud real-time simulation method based on a cloud image

[0048] Figure 2 A schematic diagram for constructing a large-world cloud layer space and calculating the effective rendering length of a pixel point ray, for the case of a camera on the ground.

[0049] Figure 3 A three-dimensional Perlin noise generation schematic diagram. DETAILED DESCRIPTION

[0050] The embodiments of the present application will be described below by means of specific examples in combination with the drawings, and those skilled in the art can quickly understand the effects of the present application through the content of the description. The content in the drawings is only for more clearly illustrating the embodiments and cannot be understood as limiting the present application.

[0051] The embodiments of the present application provide a thunderstorm cloud real-time simulation method based on a cloud image, as shown in Figure 1 , comprising:

[0052] Step S1: acquiring a pixel point ray direction, constructing a large-world cloud layer space, and calculating the effective rendering length of the pixel point ray;

[0053] Step S2: calculating the bulk cloud density of the pixel point ray direction based on the cloud image, three-dimensional noise, and position-density function, to obtain the shape of the thunderstorm cloud;

[0054] Step S3: constructing a vortex field, calculating the centripetal force received by the cloud body during movement, and offsetting the UV sampling of the cloud image to realize the movement control of the thunderstorm cloud;

[0055] Step S4: obtaining the cloud body color in the pixel point ray direction according to the light position, light color, cloud body preset color, sampling point density, and light transmission model.

[0056] The working principle and beneficial effects of the above technical solution are:

[0057] The cloud layer density calculation in the application is based on the ray marching technique, and therefore, first, the ray direction of each pixel point in the screen space needs to be obtained, the starting point of the ray being the camera and the direction vector being the pixel point position minus the camera position. Then, a large-world cloud layer space is constructed, and the effective rendering length of the pixel point ray is obtained, which represents the total step length for subsequent density calculation based on ray marching. After the pixel point ray direction and the effective rendering length are obtained, the total density of the pixel point ray direction sampling is calculated in the manner of ray marching, and the total density is taken as the transparency value of the pixel point rendering cloud. In the application, the cloud map defines the basic shape of the cloud body, and the movement of the cloud body can be realized by dynamically changing the sampling UV of the cloud map. A vortex field is constructed, the centripetal force received by the density sampling point during the movement of the cloud body is calculated, the UV value of the cloud map sampling is influenced by the centripetal force, and the movement control of the thunderstorm cloud is realized. Finally, the light source position, the light intensity, the preset color of the cloud body, and the sampling point density are combined to determine the color of the cloud layer rendering.

[0058] In one embodiment, step S1: obtaining the pixel point ray direction, constructing a large-world cloud layer space, and calculating the effective rendering length of the pixel point ray; Figure 2 The schematic diagram for this step specifically includes:

[0059] Step S11: obtaining the pixel point ray direction, presetting the earth center position, the earth radius, the low cloud layer position height, and the high cloud layer position height.

[0060] Step S12: taking the low cloud layer position height plus the earth radius as the low cloud layer spherical radius, taking the earth center position as the center, and constructing a low cloud layer hemisphere. Taking the high cloud layer position height plus the earth radius as the high cloud layer spherical radius, taking the earth center position as the center, and constructing a high cloud layer hemisphere. Taking the height difference between the two hemispheres as the large-world cloud layer space.

[0061] Step S13: dividing the camera position into three cases of on the ground, in the cloud layer, and outside the cloud layer, respectively calculating the intersection points of the pixel point ray and the low cloud layer sphere and the high cloud layer sphere, and calculating the effective rendering length of the pixel point ray according to the intersection condition.

[0062] The working principle and beneficial effects of this step are:

[0063] The large-world cloud layer is a cloud layer without boundaries, and first, a large-world cloud layer space is constructed through the low cloud layer hemisphere and the high cloud layer hemisphere. The low cloud layer hemisphere is set as No. 1 hemisphere, and the high cloud layer hemisphere is set as No. 2 hemisphere. Then, the intersection points of the pixel point ray and No. 1 and No. 2 hemispheres are calculated, the intersection point of the pixel point ray and No. 1 hemisphere is set as p1, and the intersection point of the pixel point ray and No. 2 hemisphere is set as p2. Further, the length of the ray passing through the small sphere is set as y1, and the distance of the ray passing through No. 2 hemisphere is set as y2, such as Figure 2As shown, the camera position on the ground is described.

[0064] The camera position is divided into three cases: on the ground, in the cloud layer, and outside the cloud layer. When the viewpoint is on the ground, the starting point of the ray rendering is p1, and the effective rendering length is y2-y1. When the camera is in the cloud layer, the starting point is the camera position. If the ray intersects with the first hemisphere, the effective rendering length is y1. If there is no intersection, the effective rendering length is y2. When the camera is outside the cloud layer, the starting point is p2. If the ray intersects with the first hemisphere, the effective rendering length is the distance between p1 and p2. If there is no intersection, the effective rendering length is y2.

[0065] In an embodiment, given the radius of the first hemisphere, the radius of the second hemisphere, and the radius of the Earth, the cloud layer height range is determined, and the effective rendering length of the pixel ray is calculated according to the above principle.

[0066] (2) Based on the cloud map, three-dimensional noise, and position-density function, the total density of the pixel ray direction is calculated, and the shape of the thunderstorm cloud is obtained.

[0067] The shape of the thunderstorm cloud depends on the total density of the pixel ray direction, which is the sum of the densities of the sampling points in the pixel ray direction. The density of the sampling point is calculated based on the cloud map, three-dimensional noise, and position-density function.

[0068] Step S21: Obtain a two-dimensional cloud map texture, a set of basic three-dimensional noise texture, and a set of detailed three-dimensional noise texture.

[0069] The working principle and beneficial effects of this step are:

[0070] The cloud map texture mentioned above is a two-dimensional texture map with 128*128 pixels. The RGB channels of the texture are cloud density, cloud light absorption rate, and cloud type proportion, respectively. The cloud density defines the basic shape of the cloud, and the cloud light absorption rate indicates the light absorption of the cloud. The cloud type proportion represents the proportion of stratus, cumulus, and thunderstorm cloud at this point, and the sum of the three is 1.

[0071] The set of basic three-dimensional noise texture mentioned above has a size of 128*128*128 pixels. The R channel is a low-frequency Perlin-Worley noise texture, and the GBA channels are inverse Worley noise texture with increasing frequency.

[0072] The set of detailed three-dimensional noise texture mentioned above has a size of 32*32*32 pixels. The RGB channels store inverse Worley noise with increasing frequency.

[0073] Perlin noise is a natural noise generation algorithm improved by Ken Perlin from white noise. Worley noise, invented by Steven Worley in 1996, is a type of noise generated based on a spatial segmentation algorithm. It can generate a 3D Worley noise texture map. The generation of 3D Perlin-Worley noise is based on both 3D Perlin noise and 3D Worley noise; therefore, a 3D Perlin noise texture map is needed first. Generally speaking, the basic 3D noise texture map and the detailed 3D noise texture map can be obtained through the following steps:

[0074] 1. Calculate 3D Perlin noise

[0075] Traditional two-dimensional Perlin noise can be easily extended to higher dimensions. A schematic diagram of three-dimensional Perlin noise generation is shown below. Figure 3 As shown.

[0076] When calculating 3D Perlin noise, the space is first divided into a cubic mesh with a side length of 1. For each vertex of the cubic mesh, a random 3D gradient vector is generated. For a point P within the grid where the noise value needs to be calculated, the random gradients of the corresponding vertices of the cube are used. The vector projected onto P relative to the vertices of the cube. The contribution of this gradient to the noise value is obtained. After that Interpolation in three dimensions yields the final noise value N. P This yields a three-dimensional Perlin noise texture map.

[0077] 2. Perform fractal Brownian motion processing on the inverted Worley noise texture map to obtain a detailed 3D noise texture map. Mix the Perlin noise texture map and the inverted Worley noise texture map to obtain a set of basic 3D noise texture maps.

[0078] Fractal Brownian Motion (fBm) is a commonly used method to generate noise map, due to its fractal characteristics, it can generate noise with rich details. In this embodiment, the Perlin noise and the inverse Worley noise are continuously raised in frequency by a certain multiple, and the noise maps are cyclically superimposed to obtain Perlin noise maps and Worley noise maps of different frequencies. The inverse Worley noise maps of different frequencies are combined to obtain a three-dimensional noise texture map, and the Perlin-Worley noise is obtained by mixing the corresponding Perlin noise. The original inverse Worley noise of different frequencies can be combined to obtain the final basic three-dimensional noise texture map.

[0079] In this embodiment, a cloud texture map of 128*128 pixels is obtained. Since the R channel cloud layer density defines the basic shape of the cloud, in order to better define the shape of the thunderstorm cloud, the cloud layer density distribution needs to be set as an ellipse. A group of basic three-dimensional noise texture maps are obtained, and a group of detailed three-dimensional noise texture maps are obtained.

[0080] Step S22: Based on the two-dimensional cloud map and the two groups of three-dimensional noise texture, the sampling point density is calculated in the manner of ray step sampling.

[0081] Step S23: Obtain the ray direction of the pixel point, and accumulate the sampling point density of the ray direction as the overall density of the pixel.

[0082] The working principle and beneficial effects of step S22 and step S23 are as follows:

[0083] 1. Sampling point density calculation

[0084] The sampling point density calculation is divided into three parts: the cloud layer type density obtained based on the position-density function, the noise density obtained based on the three-dimensional noise texture, and the cloud layer distribution density obtained based on the two-dimensional cloud map.

[0085] The above position-density function is a mapping relationship between a group of sampling point positions and densities, which can be defined according to the cloud layer type. In this embodiment, for the cumuliform cloud, only the height is related, and the density corresponding to the middle height of the cloud layer is set to 1, and decreases to 0 towards the upper and lower boundary positions of the cloud layer. For thunderstorm clouds, in the horizontal direction, the density value at the middle position of the cloud layer is 1, and decreases to 0 towards both sides, and in the vertical direction, the density at the bottom position is 0, and increases to 1 towards the top. Finally, the value in the vertical direction is multiplied by the value in the horizontal direction.

[0086] The cloud type density is introduced to describe more types of cloud, and the calculation thereof comprises two parts. The first part is the type cloud density calculation at the sampling point, which needs to consider different types of cloud respectively. The second part is the proportion of the cloud type at the sampling point. The first part is calculated by the position-density function, and the cloud type is determined by the position thereof. In this embodiment, according to the distribution of cloud in nature, the height range of 1500m-2500m is set as the stratus range, the height range of 1500m-4000m is set as the cumulus range, and the height range of 1500m-8000m is set as the thunderstorm cloud range. The position-density function is the mapping relationship between the position and the density of the sampling point. Therefore, the position-density function can reflect the cloud type density. For ordinary stratus and cumulus, the position-density function is only related to the height position, and the density decreases from the middle position of the cloud to the two sides of the cloud. For thunderstorm cloud, in the horizontal direction, the density increases from the middle position to the outside position, and in the vertical direction, the density increases from the bottom to the top. Finally, the value in the vertical direction is multiplied by the value in the horizontal direction to obtain the final type cloud density of the thunderstorm cloud. The position-density function of the present application sets the feathering boundary for the stratus and cumulus, which can better adjust the cloud shape. First, the proportion of the height of the sampling point in the type cloud height needs to be calculated. The calculation method is to subtract the bottom height position of the type cloud range from the height position of the sampling point and then divide by the height of the type cloud. The proportion is set as heightFraction. The input of the position-density function is heightFraction, the bottom height of the type cloud cloudMin, the top height of the type cloud cloudMax, and the feathering value value. The proportion of heightFraction in the interval [cloudMin, cloudMin+value] is mapped to the interval [0, 1], and the value is set as a. The proportion of heightFraction in the interval [cloudMax-value, cloudMax] is mapped to the interval [1, 0], and the value is set as b. The value of a and b is multiplied, and the density of the type cloud at the sampling point is obtained. The proportion of the cloud type at the sampling point in the second part is a preset value, which is obtained through the B channel of the cloud texture. Then, the type cloud density values calculated by the first part for the stratus, cumulus and thunderstorm cloud are weighted and summed with the corresponding proportions, and the final cloud type density is obtained.

[0087] The noise density can be simply obtained by sampling the three-dimensional noise texture.

[0088] The cloud distribution density can be obtained by sampling the cloud texture.

[0089] The cloud layer distribution density of the cloud map texture defines the outline shape of the cloud body, and the cloud body is obtained as a column by extending the cloud map in the height direction. The basic shape of the cloud body is obtained from the Perlin-Worley noise in the R channel of the three-dimensional noise texture, and the details of the cloud body are enriched by the Worley noise in the GBA three channels of the three-dimensional noise texture. The cloud body is further modified by using the detail three-dimensional noise texture map. Finally, the density value of the sampling point is the product of the cloud layer type density, the noise density and the cloud layer distribution density.

[0090] 2. Ray marching sampling

[0091] According to the rendering starting point and the effective rendering length obtained in step S1, the ray marching sampling is performed. First, the step length needs to follow a certain marching strategy. When the sampling point density is less than 0, the step length is stepped by three times. If the current sampling point is blocked by an object or passes through the cloud coverage range, the current step is ended. When it is detected that the sampling point density is greater than 0, one step is backed up, and the sampling is performed by using the normal step length.

[0092] In this process, the product of the sampling point and the step length is calculated as the density on the step length interval. The density of each interval is sequentially accumulated as the total density of the ray direction of the current pixel point.

[0093] In addition, the performance of the present application depends to a great extent on the step length. Reducing the step length can increase the rendering accuracy, but will cause performance loss. If the step length is too large, the level of the cloud body will be increased. Therefore, the present application uses blue noise to offset the step starting point to reduce the level. The blue noise refers to noise with sometimes the smallest low-frequency components and no energy concentrated peak. The blue noise value of the sampling is offset to the rendering starting point position in step S1 to offset the problem of too large step length.

[0094] (3) Construct a vortex field, calculate the centripetal force received by the cloud body during the movement process, and offset the cloud map texture sampling UV to realize the movement control of the thunderstorm cloud.

[0095] Step S31: In the horizontal direction, according to the XZ plane position of the sampling point, the centripetal force generated by the cloud body affected by the vortex field is calculated by Newton's law of motion.

[0096] Step S32: The height position of the sampling point is mapped to the height proportion Y of the cloud layer.

[0097] Step S33: In the vertical direction, according to the Y calculated in step S32, the centripetal force obtained in step S31 is added with a weight, so that the rotation speed of the thunderstorm cloud has differences in the height direction.

[0098] Step S34: The centripetal force is decomposed, and the XZ plane position of the sampling point is updated to offset the cloud map texture sampling UV.

[0099] The working principle and beneficial effects of this step are:

[0100] Since the tornado-like thunderstorm cloud is formed by many cloud particles moving at high speed in a circular motion, according to Newton's law of motion, the particles will be subjected to a centripetal force when moving in a curve. The calculation formula is as follows

[0101]

[0102] Where f centripetal represents the centripetal force, D i represents the density of the i-th sampling point, and the sampling point represents the cloud particle, v i = (x i , z i ) represents the velocity of the sampling point in the XZ plane, (x i , z i ) represents the coordinates of the sampling point in the XZ plane, and (x0, z0) represents the coordinates of the vortex center point in the XZ plane.

[0103] In order to realize the difference of the rotation speed in height, the weight of the centripetal force in height also needs to be added. First, the height position of the sampling point is mapped to the cloud layer height ratio Y, and the calculation method is consistent with the heightFraction calculation in step S2. Then, a mapping function between height and weight is set to obtain the weight value from the height value. In this embodiment, the height ratio Y is mapped to the interval [0.1, 1] to obtain the weight value. Finally, the weight value is multiplied by the centripetal force in step S31 to obtain the weighted centripetal force. The centripetal force is decomposed into a force on the X axis and a force on the Z axis, and then the accelerations a x and a z on the X and Z axes are calculated. Then, according to Newton's law of motion, the velocity values of the sampling point in the X and Z directions at time t are updated, and the position of the sampling point in the XZ plane is updated as the sampling UV of the cloud texture.

[0104] (4) According to the light position, light color, cloud preset color, combined with the sampling point density, the cloud color in the line of sight direction of the pixel point is obtained by the light transmission model.

[0105] Step S41: Obtain light source information, preset color of cloud layer middle and edge, and preset absorption rate of cloud body.

[0106] Step S42: Calculate the illumination of a single sampling point. Step from the sampling point to the light source direction, accumulate the illumination value of each interval as the current sampling point illumination value.

[0107] Step S43: Based on the density of each sampling point in the ray direction of the pixel point, the illumination of the sampling point, combined with Beer's law, Beer-Power law and double Henyey-Greenstein phase function, the color of the cloud body in the ray direction of the pixel point is calculated.

[0108] The working principle and beneficial effects of this step are:

[0109] First, the light source information is obtained, including the light source position, the light source intensity, the light source color, the preset color of the cloud layer in the middle and the edge, including the dark surface color information, the bright surface color information, the color of the middle of the cloud layer, and the cloud body preset absorption rate is taken from the B channel of the cloud image. The illumination calculation of a single sampling point is based on the sampling point density and the interval length stepping towards the light source direction. In order to describe the dark edge effect, it needs to comply with the Beer-Power law. The light in the line of sight direction is the sum of the light contributed by the illumination of the sampling point in the current line of sight direction. The double Henyey-Greenstein phase function is used to describe the proportion of the sampling point illumination contribution in the light in the line of sight direction. Compared with the single Henyey-Greenstein phase function, it can better reflect the scattering of light. At the same time, in order to describe the attenuation of the light in the line of sight direction, the Beer's law based on the illumination transmission equation is introduced. Therefore, this illumination calculation method combines Beer's law, the dark edge effect, and the double Henyey-Greenstein phase function, and can obtain a more realistic illumination result.

Claims

1. A method for real-time simulation of thunderstorm clouds based on cloud images, characterized in that, Includes the following steps: Step S1: Obtain the direction of the pixel ray, construct the large world cloud space, and calculate the effective rendering length of the pixel ray; the starting point of the pixel ray is the camera position, and the direction vector of the pixel ray direction is the pixel position minus the camera position; Step S2 yields the shape of the thunderstorm cloud: Step S21: Obtain a 2D cloud texture map, a set of basic 3D noise texture maps, and a set of detailed 3D noise texture maps; Step S22: Within the effective rendering length, using a ray-stepping method, calculate the sampling point density based on the two-dimensional cloud texture, basic three-dimensional noise texture map, and detailed three-dimensional noise texture map obtained in step S21 through the position-density function; Step S23: Based on the ray direction of the pixel, accumulate the sampling point density in the ray direction as the overall pixel density; Step S3: Construct a vortex field, calculate the centripetal force on the cloud body during its movement, and use this to offset the UV sampling of the cloud image to achieve motion control of the thunderstorm cloud. Step S4: Based on the illumination position, illumination color, cloud preset color, and combined with the sampling point density and light transmission model, obtain the cloud color in the ray direction of the pixel. Step S1 specifically includes: Step S11: Obtain the ray direction of the pixel, preset the Earth's center position, Earth's radius, low cloud layer position height, and high cloud layer position height; Step S12: Add the Earth's radius to the height of the low cloud layer to obtain the radius of the low cloud layer sphere. Construct a low cloud layer hemisphere with the Earth's center as the center, and designate it as Hemisphere 1. Add the Earth's radius to the height of the high cloud layer to obtain the radius of the high cloud layer sphere. Construct a high cloud layer hemisphere with the Earth's center as the center, and designate it as Hemisphere 2. The area between the two hemispheres is designated as the large world cloud space. Step S13: Divide the camera position into three cases: on the ground, in the clouds, and outside the clouds. Calculate the intersection points of the pixel ray with the low cloud hemisphere and the high cloud hemisphere, respectively, and denote them as p1 and p2. The length of the pixel ray traveling in the low cloud hemisphere is y1, and the distance traveling in the high cloud hemisphere is y2. Calculate the effective rendering length of the pixel ray based on the intersection cases. When the camera position is on the ground, the rendering starting point is p1, and the effective rendering length is y2 – y1. When the camera position is divided into clouds, the starting point of the rendering is the camera position. If the ray intersects with hemisphere 1, the effective rendering length is y1. If there is no intersection, the effective rendering length is y2. When the camera position is outside the cloud layer, the rendering starting point is p2. If the ray intersects with hemisphere 1, the effective rendering length is the distance between p1 and p2. If there is no intersection, the effective rendering length is y2.

2. The method for real-time simulation of thunderstorm clouds based on cloud images as described in claim 1, characterized in that, In step S22, the calculation of the sampling point density includes the following steps: Cloud type density is obtained based on the location-density function; noise density is obtained based on 3D noise texture; cloud distribution density is obtained based on 2D cloud map. The calculation of the cloud type density includes the following steps: The first part is the calculation of cloud density at the sampling points, considering different types of clouds separately. The cloud type is determined by its location. Based on the distribution of clouds in nature, the altitude range of 1500m-2500m is set as the stratus cloud range, the altitude range of 1500m-4000m is set as the cumulus cloud range, and the altitude range of 1500m-8000m is set as the thunderstorm cloud range. The location-density function is the mapping relationship between the location of the sampling point and the density. For stratus and cumulus clouds, the position-density function depends only on altitude; the density decreases from the center of the cloud layer towards the sides. For thunderstorm clouds, in the horizontal direction, the density increases from the middle position to the outer position, and in the vertical direction, the density increases from the bottom to the top. To set feathering boundaries for the position-density function of stratus and cumulus clouds, first calculate the proportion of the height at the sampling point to the height of the cloud type. The calculation method is to subtract the bottom height of the cloud type range from the sampling point height and then divide by the cloud type height. Set this proportion as heightFraction. The input of the position-density function is heightFraction. Let the bottom height of the cloud type be cloudMin, the top height of the cloud type be cloudMax, and the feathering value be value. Map the proportion of heightFraction in the interval [cloudMin, cloudMin + value] to the cloud type proportion interval [0,1], and set this value as a. Map the proportion of heightFraction in the interval [cloudMax-value, cloudMax] to the interval [1,0], and set this value as b. Multiply the values ​​of a and b to obtain the density of the cloud type at the sampling point. The second part is to obtain the proportion of cloud types at that sampling point; The proportion of cloud types at the sampling points is obtained through the B channel of the cloud map texture. Then, the cloud type density is obtained by weighted summing the type cloud density values ​​obtained from the cloud computing of stratus, cumulus, and thunderstorm clouds in the first part and their corresponding proportions. The noise density is obtained by sampling the three-dimensional noise texture; The cloud distribution density is obtained by sampling the two-dimensional cloud texture map; The cloud distribution density defines the outline shape of the cloud body, which is an extension of the cloud map in height, resulting in a cylinder. The basic shape of the cloud is obtained from the Perlin-Worley noise in the R channel of the 3D noise texture, and the details of the cloud are enriched by Worley noise in the three channels of GBA in the 3D noise texture. The cloud is further modified using the detailed 3D noise texture map. The density value of the sampling point is the product of cloud type density, noise density, and cloud distribution density.

3. The method for real-time simulation of thunderstorm clouds based on cloud images as described in claim 2, characterized in that, Step S3 specifically includes: Step S31: In the horizontal direction, calculate the centripetal force generated by the vortex field on the cloud body according to the XZ plane position of the sampling point using Newton's laws of motion; Step S32: Map the height position of the sampling point to the height proportion Y in the cloud layer; Step S33: In the vertical direction, according to the Y calculated in step S32, add weight to the centripetal force obtained in step S31 so that the rotation speed of the thunderstorm cloud varies in height. Step S34: Decompose the centripetal force and update the XZ plane position of the sampling point to offset the UV sampling of the cloud map texture.

4. The method for real-time simulation of thunderstorm clouds based on cloud images as described in claim 3, characterized in that, Step S4 specifically includes: Step S41: Obtain the light source position, the preset color of the middle and edge of the cloud, the light intensity, and the preset absorption rate of the cloud. Step S42: Calculate the illumination of a single sampling point. Starting from the sampling point, perform step sampling in the direction of the light source, and accumulate the illumination value of each interval as the illumination value of the current sampling point. Step S43: Based on the density of each sampling point along the ray direction of the pixel, the illumination of the sampling point, and the light transmission model, calculate the cloud color along the ray direction of the pixel.

5. The method for real-time simulation of thunderstorm clouds based on cloud images as described in claim 4, characterized in that, In step S43, the light transmission model consists of Beer's law, Beer-Power's law, and the double Henyey-Greenstein phase function.

Citation Information

Patent Citations

  • Three-dimensional volume cloud rendering method and system based on three-dimensional noise map

    CN111951362A

  • Precise earthquake prediction method by using multi-point positioning of earthquake clouds

    TW200815782A