A volumetric cloud ground shadow rendering method, device and storage medium
By obtaining meteorological data, cloud texture data is generated, and shadow texture data is obtained using projection method, combined with the scene depth information and shadow intensity information of ground pixel points, the shadow color information is determined, which solves the problems of poor rendering effect of volume cloud ground shadows and low computing efficiency in the prior art, and achieves more accurate and efficient shadow rendering.
Patent Information
- Application Number
- CN202311667946.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-06
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2043-12-06
AI Technical Summary
When rendering simplified cloud ground shadows, existing cloud simulation technologies are difficult to take into account the accuracy and computing efficiency of shadows, resulting in unsatisfactory shadow effects or low computing efficiency.
By obtaining meteorological data at a specified geographical location, cloud texture data are generated, and shadow texture data is obtained using projection methods, including shadow depth information and shadow intensity information. Then, based on the scene depth information and shadow intensity information of the ground pixel points, the shadow color information is determined to achieve more accurate shadow rendering.
This method improves the accuracy and computing efficiency of terrestrial shadow rendering of volume clouds, can more effectively reflect the influence of cloud on the light and darkness of ground shadows, and avoids complex cloud density accumulation calculations.
Smart Images

Figure CN117649481B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of environmental simulation technology, and in particular to a volumetric cloud ground shadow rendering method, device and storage medium. Background Art
[0002] Clouds are an important part of natural scenes, and volumetric cloud simulation technology is widely used in animation, games, film and television, meteorology, flight simulation, military simulation and other fields. In some specific scenarios, such as virtual combat environment simulation, the ground shadow of clouds will affect the reconnaissance and detection of ground targets by drones. At the same time, clouds are a type of light-transmitting medium. Different cloud thicknesses and densities determine the different light transmittance of clouds, and the brightness of ground shadows is also different. Accurate simulation of cloud ground shadows can make the scene more realistic and immersive, reflecting the occlusion relationship of clouds to ground buildings. At present, most cloud simulation technologies either use parameters such as depth to set the shadow intensity, making the cloud simulation effect less than ideal, or calculate the shadow intensity by sampling the accumulated cloud density, which is inefficient. Summary of the invention
[0003] Based on this, it is necessary to provide a volumetric cloud ground shadow rendering method, device and storage medium that can take into account both shadow accuracy and computational efficiency in order to address the above technical problems.
[0004] A volumetric cloud ground shadow rendering method, the method comprising:
[0005] Acquire meteorological data at a specified geographical location, wherein the meteorological data includes relative humidity data;
[0006] generating cloud texture data at the specified geographical location according to the relative humidity data;
[0007] Based on the cloud texture data, taking the sunlight direction as a viewport, obtaining shadow texture data corresponding to the cloud texture data by projection, wherein the shadow texture data includes shadow depth information and shadow intensity information;
[0008] Taking the camera position as the viewport, according to the shadow depth information and the scene depth information of the ground pixel points, if it is determined that any ground pixel point is in the shadow, the shadow color information at the ground pixel point is determined according to the scene depth information and shadow intensity information of the ground pixel point.
[0009] In one of the embodiments, the designated geographical location is divided into a plurality of location points, and the location information of each location point is described using latitude and longitude information and cloud height information; the cloud texture data includes a cloud amount value at each location point;
[0010] Get the weather data at the specified location, including:
[0011] Acquire the relative humidity data at each location point and the location information corresponding to the location point to form a two-dimensional relative humidity value matrix at the specified geographical location; and
[0012] Generating cloud texture data at the specified geographical location according to the relative humidity data specifically includes:
[0013] For each location point, according to the relative humidity data corresponding to the location point, the cloud cover value at the location point is generated using the cloud cover diagnosis formula based on relative humidity.
[0014] In one embodiment, for each location point, according to the relative humidity data corresponding to the location point, a cloud amount diagnostic formula based on relative humidity is used to generate the cloud amount value at the location point in the following manner:
[0015]
[0016]
[0017] in:
[0018] CM c Indicates the cloud cover value at the location point;
[0019] rh and rh cr They respectively represent the relative humidity at the location point and the relative humidity critical value for cloud formation. Low cloud, medium cloud and high cloud all represent relative humidity critical values, and the relative humidity critical values change with the cloud height.
[0020] In one of the embodiments, an exponential shadow map ESM is used as a render target texture RTT;
[0021] Based on the cloud texture data, taking the sunlight direction as the viewport, obtaining the shadow texture data corresponding to the cloud texture data by projection, specifically includes:
[0022] Taking the sunlight direction as the viewport, the cloud depth information at each location point is obtained by using the ray-stepping projection method;
[0023] Determine the shadow depth information according to the cloud depth information and ESM parameters;
[0024] Based on the conversion matrix from the sunlight viewport coordinate system to the world coordinate system, determine the target position point corresponding to each position point in the world coordinate system;
[0025] Finding a target cloud amount value corresponding to the target position point from the cloud texture data;
[0026] The shadow intensity information at the corresponding position point is determined according to the target cloud amount value.
[0027] In one embodiment,
[0028] According to the target cloud amount value, the shadow intensity information at the corresponding position point is determined according to the following method: in:
[0029] CM c Indicates the target cloud amount value corresponding to the target location point;
[0030] CMC max Indicates the maximum cloud amount value in the cloud texture data;
[0031] p represents the shadow intensity coefficient.
[0032] In one embodiment, whether any ground pixel is in a shadow is determined by the following method:
[0033] Based on the transformation matrix from the camera viewport coordinate system to the world coordinate system and the transformation matrix from the world coordinate system to the sunlight viewport coordinate system, determine the transformation matrix from the camera viewport coordinate system to the sunlight viewport coordinate system;
[0034] According to the conversion matrix from the camera viewport coordinate system to the sunlight viewport coordinate system, the target depth information corresponding to the scene depth information of any ground pixel point in the sunlight viewport coordinate system is determined;
[0035] For any position point, compare the shadow depth information of the position point with the target depth information of the ground pixel point corresponding to the position point in the sunlight viewport coordinate system;
[0036] If the shadow depth information of the position point is less than the target depth information of the ground pixel point corresponding to the position point in the sunlight viewport coordinate system, it is determined that the corresponding ground pixel point is in the shadow.
[0037] In one embodiment, the shadow color information at the ground pixel point is determined according to the scene depth information and shadow intensity information of the ground pixel point according to the following formula:
[0038]
[0039] in:
[0040] saturate is the saturation function;
[0041] Depth ESM =e (k*depth) , k represents the ESM parameter, depth represents the shadow depth information at any location point; depth Camera_SunRepresents the target depth information of the ground pixel point corresponding to any position point in the sunlight viewport coordinate system.
[0042] A volumetric cloud ground shadow rendering device, the device comprising:
[0043] An acquisition unit, configured to acquire meteorological data at a specified geographical location, wherein the meteorological data includes relative humidity data;
[0044] A generating unit, configured to generate cloud texture data at the specified geographical location according to the relative humidity data;
[0045] An obtaining unit, configured to obtain shadow texture data corresponding to the cloud texture data by projection based on the cloud texture data and taking the sunlight direction as a viewport, wherein the shadow texture data includes shadow depth information and shadow intensity information;
[0046] The determination unit is used to take the camera position as a viewport, and according to the shadow depth information and the scene depth information of the ground pixel points, if it is determined that any ground pixel point is in the shadow, determine the shadow color information at the ground pixel point according to the scene depth information and the shadow intensity information of the ground pixel point.
[0047] In one of the embodiments, the designated geographical location is divided into a plurality of location points, and the location information of each location point is described using latitude and longitude information and cloud height information; the cloud texture data includes a cloud amount value at each location point;
[0048] The acquisition unit is specifically used to acquire the relative humidity data at each location point and the location information corresponding to the location point to form a two-dimensional relative humidity value matrix at the specified geographical location;
[0049] The generating unit is specifically used to generate the cloud amount value at each location point according to the relative humidity data corresponding to the location point and using a cloud amount diagnosis formula based on relative humidity.
[0050] In one embodiment, the generating unit is specifically used to generate the cloud amount value at the location point according to the following method:
[0051]
[0052]
[0053] in:
[0054] CM c Indicates the cloud cover value at the location point;
[0055] rh and rh crThey respectively represent the relative humidity at the location point and the relative humidity critical value for cloud formation. Low cloud, medium cloud and high cloud all represent relative humidity critical values, and the relative humidity critical values change with the cloud height.
[0056] In one of the embodiments, an exponential shadow map ESM is used as a render target texture RTT;
[0057] The acquisition unit is specifically used to obtain cloud depth information at each position point by using the sunlight direction as the viewport and adopting the projection method of light stepping; determine the shadow depth information according to the cloud depth information and ESM parameters; determine the target position point corresponding to each position point in the world coordinate system based on the conversion matrix from the sunlight viewport coordinate system to the world coordinate system; search for the target cloud amount value corresponding to the target position point from the cloud texture data; and determine the shadow intensity information at the corresponding position point according to the target cloud amount value.
[0058] In one embodiment, the obtaining unit is specifically configured to determine the shadow intensity information at the corresponding position point according to the target cloud amount value in accordance with the following method: Among them: CM c Indicates the target cloud amount value corresponding to the target location point; CMc max represents the maximum cloud amount value in the cloud texture data; p represents the shadow intensity coefficient.
[0059] In one of the embodiments, the determination unit is specifically used to determine whether any ground pixel is in the shadow according to the following method: based on the transformation matrix from the camera viewport coordinate system to the world coordinate system and the transformation matrix from the world coordinate system to the sunlight viewport coordinate system, determine the transformation matrix from the camera viewport coordinate system to the sunlight viewport coordinate system; according to the transformation matrix from the camera viewport coordinate system to the sunlight viewport coordinate system, determine the target depth information corresponding to the scene depth information of any ground pixel in the sunlight viewport coordinate system; for any position point, compare the shadow depth information of the position point with the target depth information of the ground pixel corresponding to the position point in the sunlight viewport coordinate system; if the shadow depth information of the position point is less than the target depth information of the ground pixel corresponding to the position point in the sunlight viewport coordinate system, determine that the corresponding ground pixel is in the shadow.
[0060] In one embodiment, the determining unit is specifically configured to determine the shadow color information at the ground pixel point according to the scene depth information and shadow intensity information of the ground pixel point according to the following formula:
[0061]
[0062] in:
[0063] saturate is the saturation function;
[0064] Depth ESM =e (k*depth) , k represents the ESM parameter, depth represents the shadow depth information at any location point; depth Camera_Sun Represents the target depth information of the ground pixel point corresponding to any position point in the sunlight viewport coordinate system.
[0065] A computing device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in any one of the above embodiments when executing the computer program.
[0066] A computer-readable storage medium stores a computer program, which implements the steps of the method described in any of the above embodiments when executed by a processor.
[0067] The above-mentioned volumetric cloud ground shadow rendering method, device and storage medium use meteorological data to generate cloud texture data, determine the ground shadow intensity based on the cloud texture data, and draw the shadow using a shadow map algorithm based on the determined ground shadow intensity, replacing the parameter setting method of the general shadow map algorithm, more accurately and effectively reflecting the impact of clouds on the brightness of ground shadows, avoiding complex cloud density accumulation calculations, thereby improving the accuracy and computational efficiency of volumetric cloud ground shadow rendering. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 A schematic diagram of an application environment of a volumetric cloud ground shadow rendering method in one embodiment;
[0069] Figure 2 It is a schematic diagram of the process of a volumetric cloud ground shadow rendering method in one embodiment;
[0070] Figure 3 A schematic diagram of determining whether any ground pixel is in a shadow in an embodiment;
[0071] Figure 4 A schematic diagram of a flow chart of another volumetric cloud ground shadow rendering method in one embodiment;
[0072] Figure 5 is a structural block diagram of a volumetric cloud ground shadow rendering device in one embodiment;
[0073] Figure 6 FIG. 4 is a diagram showing the internal structure of a computing device in one embodiment. DETAILED DESCRIPTION
[0074] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0075] The volumetric cloud ground shadow rendering method provided in this application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 through a network. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0076] In one embodiment, Figure 2 As shown, a volume cloud ground shadow rendering method is provided, and the method is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0077] S21. Acquire meteorological data at a specified geographical location, wherein the meteorological data includes relative humidity data.
[0078] In the embodiment of the present invention, the volume cloud is modeled based on meteorological data, where the meteorological data may use global forecast system meteorological data, and the data format is grib2. In this step, the relative humidity data at the specified location is obtained from the global forecast system meteorological data.
[0079] In specific implementation, the specified geographical location can be divided into several location points. The location information of each location point can be described by (latitude and longitude information, cloud height information), for example (0° north latitude, 39° east longitude, 400 mbar). The relative data at the location point is obtained from the global forecast system meteorological data. The relative humidity data at each location point and the location information corresponding to the location point constitute a two-dimensional relative humidity numerical matrix at the specified geographical location.
[0080] S22. Generate cloud texture data at a specified geographical location according to the acquired relative humidity data.
[0081] In one embodiment, the cloud texture data includes the cloud amount value at each position point. In step S22, based on the two-dimensional relative humidity numerical matrix obtained in step S21, after spline interpolation, the value of each position point in the two-dimensional relative humidity numerical matrix is determined by a cloud amount diagnosis formula based on relative humidity to determine whether clouds are generated at the position point. If there are clouds, the corresponding cloud amount value is calculated, and the judgment result is used as a cloud density matrix and stored in the red R channel of the two-dimensional cloud texture map CloudMap, with an image resolution of 6500*5500.
[0082] Specifically, for each location point, the cloud cover value at the location point can be generated according to the following formula:
[0083]
[0084]
[0085] in:
[0086] CM c Indicates the cloud cover value at the location point;
[0087] rh and rh cr They respectively represent the relative humidity at the location point and the relative humidity critical value of cloud formation. The relative humidity critical value changes with the cloud height. Low cloud, medium cloud and highcloud respectively represent the relative humidity critical values corresponding to different cloud heights, and their specific values can be preset.
[0088] After generating cloud texture data, use cloud texture Cloudmap to build cloud volume material. First, coordinate transformation is performed in the vertex shader of cloud material, and then Cloudmap texture map and parameters related to illumination are passed into fragment shader (shader), including sunlight color, sky light color, illumination attenuation coefficient and scattering coefficient, etc. On this basis, cloud ground shadow rendering is performed. Cloud ground shadow rendering is performed based on meteorological data, and shadow map algorithm is used to determine whether the current pixel is in the shadow of the cloud, and shadow color is calculated in combination with meteorological data. The algorithm is divided into two steps, the first step is to render shadow map texture, and the second step is to render cloud ground shadow. Before starting rendering, create texture Rtt as the rendering target in the first rendering, that is, shadow map texture ShadowMap, set appropriate texture parameters, create rendering camera RttCamera in the direction of light source, set appropriate camera parameters such as angle, height and direction, and bind Rtt as the rendering target of rendering camera RttCamera. In the first rendering, only cloud is rendered without rendering other scenes, and the output result (including depth and cloud amount value of cloud texture Cloudmap) is saved in ShadowMap. During the second rendering, restore the normal viewpoint position and re-render the scene. Figure 3 As shown in the figure, in order to compare the depth with the shadow map obtained by the first rendering, the current vertex position (camera viewpoint space) must be transformed into a coordinate system with the light source as the viewpoint, and the transformed coordinates are passed to the fragment shader in the form of texture coordinates (depth is L). In the fragment shader, the depth is compared with the Depth stored in the ShadowMap obtained by the first rendering. If L>Depth, it means that the current pixel is in the shadow, otherwise it is the opposite.
[0089] The ground shadow color is combined with the cloud cover value CM stored in ShadowMap c Perform calculations, traverse the cloud cover values in Cloudmap, and find the maximum value, which is recorded as CMc max , construct the relationship between the shadow color component c and the cloud density:
[0090]
[0091] In the fragment Shader, the r, g, b, and a values of ShadowOutColor of the shadow area are assigned respectively, r=g=b=c, a=0.7, and finally the color of the shadow area of the surface is formed.
[0092] Based on the above description, in the embodiment of the present invention, ground shadow rendering can be performed according to the process shown in step S23 and step S24. In step S23, the cloud is rendered from the sun direction to generate a shadow texture map, and step S24 is rendered from the camera direction to generate the ground shadow of the cloud, which is described in detail below.
[0093] S23. Based on the obtained cloud texture data, taking the sunlight direction as the viewport, a projection method is used to obtain shadow texture data corresponding to the cloud texture data.
[0094] The shadow texture data includes shadow position information, shadow depth information and shadow intensity information.
[0095] In the specific implementation, in this step, first create a rendering camera in the direction of sunlight, define an orthogonal projection, the camera height is 32Km, and the rendered shadow map texture uses ExponentialShadowMap (ESM for short) as the rendering target texture (RTT) with a resolution of 1024*1024. The characteristic of ESM is that it uses exponential processing when storing cloud depth, which can simulate the gradual light transmission effect, and make the shadow transition soft and natural through certain parameter settings. One of the parameter setting formulas is as follows:
[0096] Depth ESM =e (k*depth)
[0097] Based on this, the cloud depth information at each position point is obtained by using the projection method of light stepping with the sunlight direction as the viewport; the shadow depth information is determined according to the cloud depth information and the ESM parameters; the target position point corresponding to each position point in the world coordinate system is determined based on the conversion matrix from the sunlight viewport coordinate system to the world coordinate system; the target cloud amount value corresponding to the target position point is found from the cloud texture data; the shadow intensity information at the corresponding position point is determined according to the target cloud amount value. In one embodiment, according to the target cloud amount value, the shadow intensity information at the corresponding position point can be determined according to the following method:
[0098] in:
[0099] CM c Indicates the target cloud amount value corresponding to the target location point;
[0100] CMC max Indicates the maximum cloud amount value in the cloud texture data;
[0101] p represents the shadow intensity coefficient.
[0102] In specific implementation, the cloud position is recorded by Raymarch (ray stepping), and the exponential value after multiplying the corresponding depth value by k (ESM parameter) is stored in the R channel of ShadowMap. The depth value information in the shadow texture map reflects the distribution position information of the cloud. To calculate the shadow intensity of the cloud based on meteorological data, the cloud amount value information of the cloud texture obtained in step S22 is also required and stored in the G channel of ShadowMap. When Raymarching the cloud, the known information is the camera position and the stepping distance (depth). To obtain the cloud texture information, it is necessary to query the fragment shader after coordinate conversion. The transformation matrix from the sun viewport to the world coordinate is:
[0103] M SW =SunViewMatrix*InvSunViewMatrix
[0104] Among them, M SW is the transformation matrix from the viewport coordinate system in the direction of sunlight to the world coordinate system, SunViewMatrix represents the view matrix of the sun viewport, and InvSunViewMatrix represents the inverse transformation matrix of the sun viewport view matrix. Finally, anti-aliasing processing is performed: Gaussian blur is added to ShadowMap: ShadowUV = gaussian_blur (ShadowUV).
[0105] S24. Taking the camera position as the viewport, according to the shadow depth information and the scene depth information of the ground pixel point, if it is determined that any ground pixel point is in the shadow, the shadow color information at the ground pixel point is determined according to the scene depth information and the shadow intensity information of the ground pixel point.
[0106] Specifically, the following steps may be included:
[0107] (1) Use ScreenSpaceShadowMask to draw shadows in UE, render the entire scene at the original camera position, and obtain the scene depth of the ground pixel point Camera .
[0108] (2) In order to compare with the depth in the ShadowMap obtained by the first rendering in step S23, and thus determine whether the sampling point is in the cloud shadow, the scene depth (camera viewpoint space) of the current sampling point needs to be transformed into a coordinate system with the sun as the viewpoint. First, the scene depth is converted into world coordinates, and then the world coordinates are converted to the sun viewport to obtain the linear depth under the sun viewport. The transformation matrix is:
[0109] M CS =M CW *M WS
[0110] Among them, M CW is the transformation matrix from the camera viewport to the world space, M WS is the transformation matrix from world space to sun viewport. The transformed depth value is as follows:
[0111] depth Camera_Sun =depth Camera *M CS
[0112] According to the above description, in an embodiment of the present invention, whether any ground pixel point is in the shadow can be determined according to the following method: based on the transformation matrix from the camera viewport coordinate system to the world coordinate system and the transformation matrix from the world coordinate system to the sunlight viewport coordinate system, determine the transformation matrix from the camera viewport coordinate system to the sunlight viewport coordinate system; according to the transformation matrix from the camera viewport coordinate system to the sunlight viewport coordinate system, determine the target depth information corresponding to the scene depth information of any ground pixel point in the sunlight viewport coordinate system; for any position point, compare the shadow depth information of the position point with the target depth information of the ground pixel point corresponding to the position point in the sunlight viewport coordinate system; if the shadow depth information of the position point is less than the target depth information of the ground pixel point corresponding to the position point in the sunlight viewport coordinate system, then determine that the corresponding ground pixel point is in the shadow, such as Figure 3 shown.
[0113] (3) Multiply the transformed depth value by p and take the exponent, then compare it with the depth in the shadow texture map and calculate the shadow color:
[0114]
[0115] The left half of the formula is the ESM shadow probability calculation formula, which is used to determine whether the current point is in the shadow of the cloud. Saturate is a saturation function, which is used to limit a value to the range of [0,1]. The right half is the shadow intensity calculation formula based on the cloud amount value, so that the shadow intensity is correlated with the cloud amount information in the meteorological data.
[0116] In the fragment Shader, the r, g, b, and a values of ShadowOutColor of the shadow area are assigned respectively, r=g=b=c, a=0.7, and finally the color of the shadow area of the surface is formed.
[0117] In summary, in the embodiments of the present invention, Figure 4 The pipeline shown performs ground shadow rendering for volumetric clouds.
[0118] The present invention performs ground shadow rendering of volumetric clouds based on meteorological data. During the shadow rendering process, the shadow intensity is calculated by querying the cloud amount value information in the cloud texture, which replaces the parameter setting method of the general shadow map algorithm and realizes the calculation of ground shadow intensity related to cloud density. It more accurately and effectively reflects the influence of clouds on the brightness of ground shadows, and the shadow color is more accurate. At the same time, it avoids the complex cloud density accumulation calculation, thereby improving the calculation efficiency.
[0119] It should be understood that although Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0120] In one embodiment, Figure 5 As shown, a volume cloud ground shadow rendering device is provided, comprising:
[0121] An acquisition unit, configured to acquire meteorological data at a specified geographical location, wherein the meteorological data includes relative humidity data;
[0122] A generating unit, configured to generate cloud texture data at the specified geographical location according to the relative humidity data;
[0123] An obtaining unit, configured to obtain shadow texture data corresponding to the cloud texture data by projection based on the cloud texture data and taking the sunlight direction as a viewport, wherein the shadow texture data includes shadow depth information and shadow intensity information;
[0124] The determination unit is used to take the camera position as a viewport, and according to the shadow depth information and the scene depth information of the ground pixel points, if it is determined that any ground pixel point is in the shadow, determine the shadow color information at the ground pixel point according to the scene depth information and the shadow intensity information of the ground pixel point.
[0125] In one of the embodiments, the designated geographical location is divided into a plurality of location points, and the location information of each location point is described using latitude and longitude information and cloud height information; the cloud texture data includes a cloud amount value at each location point;
[0126] The acquisition unit is specifically used to acquire the relative humidity data at each location point and the location information corresponding to the location point to form a two-dimensional relative humidity value matrix at the specified geographical location;
[0127] The generating unit is specifically used to generate the cloud amount value at each location point according to the relative humidity data corresponding to the location point and using a cloud amount diagnosis formula based on relative humidity.
[0128] In one embodiment, the generating unit is specifically used to generate the cloud amount value at the location point according to the following method:
[0129]
[0130]
[0131] in:
[0132] CM c Indicates the cloud cover value at the location point;
[0133] rh and rh cr They respectively represent the relative humidity at the location point and the relative humidity critical value for cloud formation. Low cloud, medium cloud and high cloud all represent relative humidity critical values, and the relative humidity critical values change with the cloud height.
[0134] In one of the embodiments, an exponential shadow map ESM is used as a render target texture RTT;
[0135] The acquisition unit is specifically used to obtain cloud depth information at each position point by using the sunlight direction as the viewport and adopting the projection method of light stepping; determine the shadow depth information according to the cloud depth information and ESM parameters; determine the target position point corresponding to each position point in the world coordinate system based on the conversion matrix from the sunlight viewport coordinate system to the world coordinate system; search for the target cloud amount value corresponding to the target position point from the cloud texture data; and determine the shadow intensity information at the corresponding position point according to the target cloud amount value.
[0136] In one embodiment, the obtaining unit is specifically configured to determine the shadow intensity information at the corresponding position point according to the target cloud amount value in accordance with the following method: Among them: CM c Indicates the target cloud amount value corresponding to the target location point; CMc max represents the maximum cloud amount value in the cloud texture data; p represents the shadow intensity coefficient.
[0137] In one of the embodiments, the determination unit is specifically used to determine whether any ground pixel is in the shadow according to the following method: based on the transformation matrix from the camera viewport coordinate system to the world coordinate system and the transformation matrix from the world coordinate system to the sunlight viewport coordinate system, determine the transformation matrix from the camera viewport coordinate system to the sunlight viewport coordinate system; according to the transformation matrix from the camera viewport coordinate system to the sunlight viewport coordinate system, determine the target depth information corresponding to the scene depth information of any ground pixel in the sunlight viewport coordinate system; for any position point, compare the shadow depth information of the position point with the target depth information of the ground pixel corresponding to the position point in the sunlight viewport coordinate system; if the shadow depth information of the position point is less than the target depth information of the ground pixel corresponding to the position point in the sunlight viewport coordinate system, determine that the corresponding ground pixel is in the shadow.
[0138] In one embodiment, the determining unit is specifically configured to determine the shadow color information at the ground pixel point according to the scene depth information and shadow intensity information of the ground pixel point according to the following formula:
[0139]
[0140] in:
[0141] saturate is the saturation function;
[0142] Depth ESM =e (k*depth) , k represents the ESM parameter, depth represents the shadow depth information at any location point; depth Camera_Sun Represents the target depth information of the ground pixel point corresponding to any position point in the sunlight viewport coordinate system.
[0143] For the specific definition of the volumetric cloud ground shadow rendering device, please refer to the definition of the volumetric cloud ground shadow rendering method above, which will not be repeated here. Each module in the above-mentioned volumetric cloud ground shadow rendering device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0144] In one embodiment, a computing device is provided. The computing device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a volume cloud ground shadow rendering method is implemented.
[0145] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a volume cloud ground shadow rendering method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse, etc.
[0146] Those skilled in the art will understand that Figure 6The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0147] In one embodiment, a computing device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the method described in any of the above embodiments when executing the computer program.
[0148] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in any of the above embodiments are implemented.
[0149] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0150] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0151] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A volumetric cloud ground shadow rendering method, which divides a specified geographical location into a number of location points, and the location information of each location point is described by longitude and latitude information and cloud height information; Cloud texture data includes the cloud amount value at each location point; The method comprises: Acquiring meteorological data at a specified geographical location, wherein the meteorological data includes relative humidity data, including: acquiring the relative humidity data at each location point and the location information corresponding to the location point to form a two-dimensional relative humidity value matrix at the specified geographical location; Generating cloud texture data at the designated geographical location according to the relative humidity data includes: for each location point, according to the relative humidity data corresponding to the location point, using a cloud amount diagnostic formula based on relative humidity, and generating a cloud amount value at the location point according to the following method: in: CM c Indicates the cloud cover value at the location point; rh and rh cr They represent the relative humidity at the location and the relative humidity critical value of cloud formation. Low cloud, medium cloud and high cloud all represent the relative humidity critical value, which changes with the cloud height. Based on the cloud texture data, taking the sunlight direction as the viewport, a projection method is used to obtain shadow texture data corresponding to the cloud texture data, wherein the shadow texture data includes shadow depth information and shadow intensity information, and an exponential shadow map ESM is used as a rendering target texture RTT; including: taking the sunlight direction as the viewport, a light stepping projection method is used to obtain cloud depth information at each position point; determining the shadow depth information according to the cloud depth information and ESM parameters; determining the target position point corresponding to each position point in the world coordinate system based on a conversion matrix from the sunlight viewport coordinate system to the world coordinate system; searching for a target cloud amount value corresponding to the target position point from the cloud texture data; and determining the shadow intensity information at the corresponding position point according to the target cloud amount value according to the following method: in: CM c Indicates the target cloud amount value corresponding to the target location point; CMC max Indicates the maximum cloud amount value in the cloud texture data; p represents the shadow intensity coefficient; Taking the camera position as the viewport, according to the shadow depth information and the scene depth information of the ground pixel points, if it is determined that any ground pixel point is in the shadow, the shadow color information at the ground pixel point is determined according to the scene depth information and shadow intensity information of the ground pixel point.
2. The method according to claim 1, characterized in that: Use the following method to determine whether any ground pixel is in shadow: Based on the transformation matrix from the camera viewport coordinate system to the world coordinate system and the transformation matrix from the world coordinate system to the sunlight viewport coordinate system, determine the transformation matrix from the camera viewport coordinate system to the sunlight viewport coordinate system; According to the conversion matrix from the camera viewport coordinate system to the sunlight viewport coordinate system, the target depth information corresponding to the scene depth information of any ground pixel point in the sunlight viewport coordinate system is determined; For any position point, compare the shadow depth information of the position point with the target depth information of the ground pixel point corresponding to the position point in the sunlight viewport coordinate system; If the shadow depth information of the position point is less than the target depth information of the ground pixel point corresponding to the position point in the sunlight viewport coordinate system, it is determined that the corresponding ground pixel point is in the shadow.
3. The method according to claim 2, characterized in that According to the scene depth information and shadow intensity information of the ground pixel point, the shadow color information at the ground pixel point is determined according to the following formula: in: saturate is the saturation function; Depth ESM =e (k*depth) , k represents the ESM parameter, depth represents the cloud depth information at any location point; depth Camea_Sun Represents the target depth information of the ground pixel point corresponding to any position point in the sunlight viewport coordinate system.
4. A volumetric cloud ground shadow rendering device, characterized in that: The designated geographical location is divided into a number of location points, and the location information of each location point is described by using latitude and longitude information and cloud height information; Cloud texture data includes the cloud amount value at each location point; The device comprises: An acquisition unit is used to acquire meteorological data at a specified geographical location, wherein the meteorological data includes relative humidity data, including: acquiring the relative humidity data at each location point and the location information corresponding to the location point to form a two-dimensional relative humidity value matrix at the specified geographical location; A generating unit is used to generate cloud texture data at the specified geographical location according to the relative humidity data, including: for each location point, according to the relative humidity data corresponding to the location point, using a cloud amount diagnostic formula based on relative humidity, and generating a cloud amount value at the location point according to the following method: in: CM c Indicates the cloud cover value at the location point; rh and rh cr They represent the relative humidity at the location and the relative humidity critical value of cloud formation. Low cloud, medium cloud and high cloud all represent the relative humidity critical value, which changes with the cloud height. An obtaining unit is used to obtain shadow texture data corresponding to the cloud texture data by projection based on the cloud texture data and taking the sunlight direction as a viewport, wherein the shadow texture data includes shadow depth information and shadow intensity information, and uses an exponential shadow map ESM as a rendering target texture RTT; comprising: taking the sunlight direction as a viewport and obtaining cloud depth information at each position point by a ray stepping projection method; determining the shadow depth information according to the cloud depth information and ESM parameters; determining a target position point corresponding to each position point in the world coordinate system based on a conversion matrix from a sunlight viewport coordinate system to a world coordinate system; searching for a target cloud amount value corresponding to the target position point from the cloud texture data; and determining the shadow intensity information at the corresponding position point according to the target cloud amount value according to the following method: in: CM c Indicates the target cloud amount value corresponding to the target location point; CMC max Indicates the maximum cloud amount value in the cloud texture data; p represents the shadow intensity coefficient; The determination unit is used to take the camera position as the viewport, and according to the shadow depth information and the scene depth information of the ground pixel points, if it is determined that any ground pixel point is in the shadow, determine the shadow color information at the ground pixel point according to the scene depth information and the shadow intensity information of the ground pixel point.
5. A computing device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to claim 1, 2 or 3 are implemented.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to claim 1, 2 or 3 are implemented.
Citation Information
Patent Citations
Volume cloud shadow rendering method and device, electronic equipment and storage medium
CN111968216A