Volume rendering method, device and computer equipment for meteorological data
Through the combination of texture mapping and color fusion coefficients, the problem of insufficient intuitiveness of meteorological data volume rendering technology is solved, more efficient meteorological data visualization is achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202110828368.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-22
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-07-22
AI Technical Summary
The existing meteorological data volume rendering technology has low intuitiveness, which affects the visualization effect and makes it difficult to accurately and intuitively display meteorological elements.
Use texture mapping to form multiple mapped texture slices, establish a cubic bounding box, set the initial light source for equidistant sampling, determine the pixel color mixing value based on the RGB color value and transparency, mix it with the color fusion coefficient k, and save it on the GPU Displayed in the frame buffer area.
It improves the visualization effect of meteorological data, enhances the user's visual experience, can display meteorological elements more intuitively, and improves the rendering effect.
Smart Images

Figure CN114219902B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a volume rendering method for meteorological data, a volume rendering device for meteorological data and a computer device. Background Art
[0002] Meteorological data visualization is an important application field for three-dimensional weather simulation, meteorological system research, and large-scale scene simulation. Thanks to the development of remote sensing detection technology, the current working base stations, drone aerial photography technology, satellite telemetry and other technologies can provide massive real-time and accurate data information for the field of meteorological research. However, only through more specific and efficient visualization technology can single data information be presented to people in a diversified way. Data visualization is the foothold for all research results.
[0003] In related technologies, a lot of research has been done to enable more accurate and intuitive visualization of meteorological elements. Volume rendering technology is usually described as generating two-dimensional images based on three-dimensional volume data field information. A more specific description is that through a certain method, based on the three-dimensional spatial information of the object, the volume details of the object are displayed in sequence rather than the surface details, and finally the color synthesis is performed based on the return values of all voxel rays penetrated by each pixel to form a color value of a pixel, and rendering is performed based on the color value. However, the volume rendering using this technology is less intuitive, which affects the visualization effect. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems in the above-mentioned technology to a certain extent. To this end, the first object of the present invention is to propose a volume rendering method for meteorological data, which can more intuitively display meteorological elements, improve visualization effects, and enhance user visual experience by setting color fusion coefficients.
[0005] A second objective of the present invention is to provide a volume rendering device for meteorological data.
[0006] A third object of the present invention is to provide a computer device.
[0007] A fourth object of the present invention is to provide a non-transitory computer-readable storage medium.
[0008] To achieve the above object, a first embodiment of the present invention provides a volume rendering method for meteorological data, comprising:
[0009] Obtain multiple meteorological data and location information of each meteorological data;
[0010] Based on the meteorological data and the location information, a plurality of mapped texture slices are formed by texture mapping;
[0011] Establishing a bounding box surrounding a plurality of mapped texture slices, wherein the bounding box is in a cube shape;
[0012] An initial light source is set so that light is projected from the initial light source into the cube. When the distance n that the light travels through in the cube is less than the farthest distance m that the light travels through in the cube, equidistant sampling is performed to obtain the RGB color value and transparency of each sampling point.
[0013] Determine the color fusion coefficient k of the current mapped texture slice, where the value of k is between 0 and 1;
[0014] According to each of the RGB color values, the transparency and the color fusion coefficient k, the pixel color mixing value D (r, g, b, a) is determined, and the D (r, g, b, a) is:
[0015]
[0016] Where i is the current ray step, m is the farthest distance the ray travels in the cube, Tr is the red color value at the intersection of the ray and the slice, Tg is the green color value at the intersection of the ray and the slice, Tb is the blue color value at the intersection of the ray and the slice, and Ta is the transparency at the intersection of the ray and the slice;
[0017] The pixel color mixing value is stored in the frame buffer of the GPU and drawn and displayed in the Web map framework.
[0018] In addition, the volume rendering method for meteorological data proposed in the above embodiment of the present invention may also have the following additional technical features:
[0019] According to an embodiment of the present invention, forming a plurality of mapped texture slices by texture mapping based on the plurality of meteorological data and the position information includes:
[0020] Preprocessing the corresponding meteorological data based on each of the location information to obtain corresponding data field grid point coordinates;
[0021] Dividing the data field grid point coordinates into sections to form a plurality of section units with grid points as basic units, wherein the attribute data of the grid points include: the number of rows, the number of columns, the number of layers, the world three-dimensional coordinate values and the corresponding meteorological data values;
[0022] Forming a corresponding blank texture according to the number of rows and layers of grid points in each section unit, and color mapping the texture pixels in the corresponding blank texture according to the numerical value of the meteorological data to obtain a mapped texture;
[0023] The mapping texture is sliced according to the number of columns of the grid points to obtain a plurality of mapping texture slices arranged in slices.
[0024] According to one embodiment of the present invention, the preprocessing includes:
[0025] The meteorological data of the same altitude layer is converted into a spatial rectangular coordinate system to obtain the position information (x, y, z) in the spatial rectangular coordinate system, where the conversion formula is:
[0026]
[0027] Among them, R is the radius of the sphere, LatValue is the latitude coordinate, and LongValue is the longitude coordinate;
[0028] Calculate the world coordinates (X, Y, Z) of grid points at different pressure layers at the same longitude and latitude, where the calculation formula is:
[0029]
[0030]
[0031] X=X0*(1_h) / 1
[0032] Y=Y0*(1_h) / 1
[0033] Z=Z0+(Z0*h) / R,
[0034] Where h is the height of the point from the ground, Z0 is the Z value of the world coordinate system of the initial point, Y0 is the Y value of the world coordinate system of the initial point, and X0 is the X value of the world coordinate system of the initial point.
[0035] According to an embodiment of the present invention, the volume rendering method for meteorological data further includes: determining the farthest traversal distance m of the light in the cube according to the transparency.
[0036] According to an embodiment of the present invention, determining the light projection distance m according to the transparency includes:
[0037] Determine the depth value based on transparency;
[0038] Eliminate fragments whose depth values are greater than the first threshold, and render a front-facing depth map of the data field. At this time, the color value of each pixel on the depth map represents the distance to the point closest to the viewpoint in that direction.
[0039] Eliminate fragments whose depth values are less than the second threshold, and render a depth map of the rear surface of the data field, where the color value of each pixel on the rear surface represents the distance of the point farthest from the viewpoint in that direction;
[0040] The data on the rear surface depth map and the front surface depth map are subtracted to obtain the farthest traversal distance m of the light in the cube.
[0041] According to one embodiment of the present invention, obtaining the RGB color value and transparency of each sampling point includes:
[0042] Calculate the sampled texture coordinate t according to the following formula;
[0043] t=t start +Dir*delta
[0044] Among them, t start Represents the volume texture coordinates of the projected point on the cube surface, Dir represents the unit vector of the projection direction, and delta represents the sampling interval, which increases as n increases;
[0045] The RGB color value and transparency of the corresponding sampling point are queried on the cube according to the sampled texture coordinates.
[0046] According to an embodiment of the present invention, the color fusion coefficient k increases as n increases.
[0047] To achieve the above-mentioned purpose, a second embodiment of the present invention provides a volume rendering device for meteorological data, comprising:
[0048] An acquisition module, used for acquiring multiple meteorological data and location information of each meteorological data;
[0049] A forming module, configured to form a plurality of mapped texture slices by texture mapping based on the meteorological data and the location information;
[0050] An establishing module, used for establishing a bounding box surrounding a plurality of mapped texture slices, wherein the bounding box is in the shape of a cube;
[0051] A sampling module is used to set an initial light source so that light is projected from the initial light source into the cube, and when the distance n that the light travels through in the cube is less than the farthest distance m that the light travels through in the cube, equidistant sampling is performed to obtain the RGB color value and transparency of each sampling point;
[0052] A first determination module is used to determine a color fusion coefficient k of a current mapped texture slice, where the value of k is between 0 and 1;
[0053] The second determination module is used to determine the pixel color mixing value D (r, g, b, a) according to each of the RGB color values, the transparency and the color fusion coefficient k, where D (r, g, b, a) is:
[0054]
[0055] Where i is the current ray step, m is the farthest distance the ray travels in the cube, Tr is the red color value at the intersection of the ray and the slice, Tg is the green color value at the intersection of the ray and the slice, Tb is the blue color value at the intersection of the ray and the slice, and Ta is the transparency at the intersection of the ray and the slice;
[0056] The display module is used to store the pixel color mixing value in the frame buffer of the GPU and draw and display it in the Web map framework.
[0057] To achieve the above-mentioned objectives, the third aspect of the present invention proposes a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the volume rendering method for meteorological data proposed in the first aspect of the present invention is implemented.
[0058] To achieve the above objectives, the fourth aspect of the present invention proposes a non-temporary computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the volume rendering method of meteorological data proposed in the first aspect of the present invention.
[0059] The technical solution of the present invention sets a color fusion coefficient k, and then determines the color mixing value of the pixel point according to the RGB color value, transparency and the color fusion coefficient k, so as to achieve a visualization effect with perspective. Therefore, by setting the color fusion coefficient, meteorological elements can be displayed more intuitively, the visualization effect can be improved, and the user's visual experience can be enhanced. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 The present invention is a flowchart of a volume rendering method for meteorological data according to an embodiment of the present invention.
[0061] Figure 2 FIG. 4 is a schematic diagram of a light ray passing through a cube according to an embodiment of the present invention.
[0062] Figure 3 A schematic diagram of texture mapping according to an embodiment of the present invention.
[0063] Figure 4 A schematic diagram of multiple texture mapping slices according to an embodiment of the present invention.
[0064] Figure 5 The figure is a schematic diagram of a meteorological data volume rendering process based on a web page and GPU acceleration according to an embodiment of the present invention.
[0065] Figure 6 The figure is a flowchart of an improved volume rendering method according to an example of the present invention.
[0066] Figure 7 This is an example of the present invention, which is a result of fusing a humidity range with a higher value range with reduced transparency.
[0067] Figure 8 This is an example of the present invention, which is a result of fusing a humidity range with a higher value range with reduced transparency.
[0068] Fig. 9 The result graph showing the fusion transparency for a humidity range greater than 35% for an example of the present invention.
[0069] Fig.10 The result of adjusting the slice range size is displayed as an example of the present invention.
[0070] Fig.11 It is a block diagram of a volume rendering device for meteorological data according to an embodiment of the present invention. DETAILED DESCRIPTION
[0071] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0072] It should be noted that the core idea of volume rendering technology is to specify a corresponding opacity for each spatial voxel object, then set a light source, emit light through the entire data field, and consider the transmission, emission and reflection of each spatial voxel on the light according to the opacity of the voxel. Finally, the color synthesis is performed based on the return value of all voxel light penetrated by each pixel to form the color value of a pixel. However, there are problems of low efficiency and poor effect when only using volume rendering technology to render meteorological elements.
[0073] With the development of computer hardware, the performance of GPU (Graphics Processing Unit) has been qualitatively improved in computing efficiency compared with traditional hardware. Using the powerful floating-point computing power of GPU for computer visualization rendering is now the mainstream direction. The existing volume rendering technology method through parallel computing of CPU and GPU can improve the computing efficiency of rendering to a certain extent, but there is little work on GPU acceleration for meteorological element rendering on the web side. Most researchers use GPU for simple floating-point calculations to improve the overall meteorological element data computing efficiency and rendering efficiency. While using GPU to improve computing efficiency, there is still insufficient work on how to use WebGL (Web Graphics Library) technology to render meteorological element information more realistically and in line with actual physical meanings, and improve visualization effects.
[0074] It can be seen that there are at least three advantages to using volume rendering technology optimization methods to accelerate GPU rendering of three-dimensional meteorological elements on the web: (1) The rendering effect is three-dimensional, and the threshold range can be artificially highlighted. The dynamic change effect can load data at multiple times; (2) The rendering method accelerated by the shader can use the GPU on the web, which has advantages for massive data processing and animation effect setting.
[0075] Based on this, the embodiment of the present invention aims at some deficiencies in rendering meteorological elements on the web page, proposes a volume rendering method for meteorological data based on GPU acceleration, combines WebGL and volume rendering technology, and optimizes and improves the problem of unclear visualization effect in the rendering process of meteorological elements, so as to draw the three-dimensional atmospheric model result data of multiple time changes on the web page. Compared with the existing technology, it has obvious improvements in intuitiveness, structure, and timeliness, and has better visual performance.
[0076] Figure 1 The present invention is a flowchart of a volume rendering method for meteorological data according to an embodiment of the present invention.
[0077] like Figure 1 As shown, the method comprises the following steps:
[0078] S1, obtaining multiple meteorological data and location information of each meteorological data.
[0079] Meteorological data may refer to data indicating various elements of the physical state and physical phenomena of the atmosphere, such as atmospheric temperature, relative humidity, speed or air pressure, etc. The location information of meteorological data may include: longitude, latitude and height from the ground surface.
[0080] S2, forming a plurality of mapping texture slices through texture mapping based on the meteorological data and the location information.
[0081] Specifically, after obtaining a plurality of meteorological data and the position information of each meteorological data, a plurality of texture mapping slices can be formed by means of texture mapping, wherein the plurality of texture mapping slices can be arranged in slices.
[0082] S3. Establish a bounding box enclosing the plurality of mapped texture slices, and the shape of the bounding box is a cube.
[0083] S4. Set an initial light source, and project light from the initial light source into the cube. When the traversal distance n of the light in the cube is less than the farthest traversal distance m of the light in the cube, equidistant sampling is performed to obtain the RGB color value (where R represents Red, G represents Green, and B represents Blue) and transparency of each sampling point.
[0084] Specifically, set an initial light source and make a ray, as Figure 2 shown, project light from the initial light source into the cube so that the ray passes through a plurality of mapped texture slices, and perform sampling when the traversal distance is n (n < m) until n > m or the transparency accumulates to more than 1, and the sampling process of one ray ends.
[0085] S5. Determine the color fusion coefficient k of the current mapped texture slice, and the value of k is between 0 and 1.
[0086] In the embodiment of the present invention, the color fusion coefficient k can be set according to the user's request, and the value of k is between 0 and 1. According to the perspective principle, the larger the k of the mapped texture slice, the higher the perspective; the smaller the k of the mapped texture slice, the lower the perspective.
[0087] In one example, the value of the color fusion coefficient k increases as n increases.
[0088] Specifically, for different meteorological elements, different color fusion coefficients k can be set. The color fusion coefficient k has three values, Ka, Kg, and Kb, corresponding to the color values R, G, and B respectively. According to the perspective principle, the color value transparency calculated at the intersection of the projected light and the first texture mapping slice should be relatively low, so the k coefficient is set to a low value here. And so on, as the projection line intersects with the subsequent texture mapping slices in turn, the k value should be set to gradually increase.
[0089] S6. Determine the pixel point color mixing value D(r, g, b, a) according to each RGB color value, transparency, and color fusion coefficient k.
[0090] Specifically, determine the pixel point color mixing value D(r, g, b, a) according to Formula 1:
[0091]
[0092] Among them, i is the current ray step, m is the farthest distance the light travels in the cube, Tr is the red color value at the intersection of the ray and the slice, Tg is the green color value at the intersection of the ray and the slice, Tb is the blue color value at the intersection of the ray and the slice, and Ta is the transparency at the intersection of the ray and the slice.
[0093] S7, saves the pixel color mixing value in the frame buffer of the GPU, and draws and displays it in the Web map framework.
[0094] That is to say, the embodiment of the present invention is based on the traditional volume rendering concept, models the meteorological model result data into a three-dimensional space grid field, forms a cubic space containing texture slices through texture mapping, and uses projection line technology to obtain each intersecting RGBA value, which is accumulated according to a certain strategy according to the fusion coefficient k (ranging from 0 to 1) to obtain the final pixel color, and renders the overall three-dimensional field effect according to the final accumulated pixel color.
[0095] It should be noted that the embodiment of the present invention places the entire calculation process on the GPU, which greatly improves the efficiency of rendering on the Web side. At the same time, the set color fusion coefficient can artificially control the visibility of different value ranges in the meteorological elements, and more intuitively display the internal interest area and its internal structural characteristics. And it can continuously and dynamically display the changing effects of meteorological elements under multiple time series, the program runs smoothly, and the effect is intuitive and reliable.
[0096] Therefore, by setting the color fusion coefficient, this method can display meteorological elements more intuitively, improve the visualization effect, and enhance the user's visual experience.
[0097] In one embodiment of the present invention, the above step S2 may include the following steps:
[0098] S21, pre-processing the corresponding meteorological data based on each location information to obtain the corresponding data field grid point coordinates.
[0099] The preprocessing may include: converting the meteorological data of the same altitude layer into a spatial rectangular coordinate system to obtain the position information (x, y, z) in the spatial rectangular coordinate system, wherein the conversion formula is:
[0100]
[0101] Where R is the radius of the sphere, LatValue is the latitude coordinate, and LongValue is the longitude coordinate; calculate the world coordinates (X, Y, Z) of the grid points of different pressure layers at the same longitude and latitude, where the calculation formula is:
[0102]
[0103]
[0104] X=X0*(1_h) / l (5)
[0105] Y=Y0*(1_h) / l (6)
[0106] Z=Z0+(Z0*h) / R (7)
[0107] Where h is the height of the point from the ground, Z0 is the Z value of the world coordinate system of the initial point, Y0 is the Y value of the world coordinate system of the initial point, and X0 is the X value of the world coordinate system of the initial point.
[0108] By using formulas (3) to (7), the three-dimensional world coordinates of any point at any latitude and longitude within the spatial range and any height above the ground surface can be obtained, and the data field grid coordinates can be obtained.
[0109] S22, divide the data field grid coordinates into sections to form multiple section units with grid points as basic units, wherein the attribute data of the grid points include: number of rows, number of columns, number of layers, world three-dimensional coordinate values (i.e. longitude, latitude and altitude) and corresponding meteorological data values.
[0110] It can be understood that the number of rows, columns and layers respectively correspond to x, y and z in the spatial rectangular coordinate system, and the world three-dimensional coordinate values are X, Y and Z. The value of the meteorological data is the attribute value of the grid point.
[0111] S23, forming a corresponding blank texture according to the number of rows and layers of grid points in each profile unit, and color mapping the texture pixels in the corresponding blank texture according to the numerical value of the meteorological data to obtain a mapped texture. The schematic diagram of texture mapping can be shown as follows: Figure 3 shown.
[0112] S24, slicing the mapped texture according to the number of columns of grid points to obtain a plurality of mapped texture slices arranged in slices.
[0113] Specifically, the shader acceleration setting in WebGL is used to form a mapping texture of corresponding resolution according to the number of grid field rows and layers of the section unit. According to the value, RGB color mapping is performed on each texture pixel to obtain a mapping texture. Then, according to the number of grid field columns, the mapping texture is sliced to form mapping texture slices in sequence, and finally a mapping texture slice array with the same position information as the source data is obtained. The mapping texture slice array is as follows: Figure 4 As shown, and forms a cubic space that contains it.
[0114] In general, if Figure 5 As shown, firstly, meteorological data is acquired, and then converted into regular structure point data through formulas (2)-(7), and the regular structure point data is formed into a three-dimensional grid field bounding box, and then the meteorological data is rendered through volume rendering technology and GPU acceleration settings to achieve intuitive visualization of meteorological data.
[0115] In one embodiment of the present invention, the volume rendering method for meteorological data may further include: determining the farthest traversal distance m of the light in the cube according to the transparency.
[0116] Furthermore, determining the farthest traversal distance m of a light ray in a cube according to transparency may include: determining a depth value according to transparency; eliminating fragments having depth values greater than a first threshold, and rendering a front surface depth map of the data field, wherein the color value of each pixel on the depth map represents the distance of the point closest to the viewpoint in that direction; eliminating fragments having depth values less than a second threshold, and rendering a rear surface depth map of the data field, wherein the color value of each pixel on the rear surface represents the distance of the point farthest from the viewpoint in that direction; and subtracting the data on the rear surface depth map from the data on the front surface depth map to obtain the farthest traversal distance m of the light ray in the cube.
[0117] That is, the maximum traversal distance m is calculated by using transparency as a depth value instead.
[0118] In one embodiment of the present invention, obtaining the RGB color value and transparency of each sampling point may include: calculating the sampling texture coordinate t according to the following formula:
[0119] t=t start +Dir*delta
[0120] Among them, t start Represents the volume texture coordinates of the projected point on the cube surface, Dir represents the unit vector of the projection direction, delta represents the sampling interval, which increases as n increases; query the RGB color value and transparency of the corresponding sampling point on the cube according to the sampled texture coordinates.
[0121] Specifically, the sampled texture coordinates may be calculated by a vertex shader, and then the RGB color value and transparency of the sampling point of the slice data may be queried on the cube through the sampled texture coordinates.
[0122] Afterwards, the queried RGB color values and transparency are accumulated according to a certain strategy according to the color fusion coefficient k (ranging from 0 to 1) to obtain the final sampling value. The final sampling result is saved in the frame buffer and drawn and displayed in the Web map framework.
[0123] like Figure 6As shown, the embodiment of the present invention adopts an improved volume rendering technology, that is, a GPU web page acceleration setting is used to achieve the rendering of meteorological data.
[0124] The following is a further detailed description of the web page and shader-accelerated meteorological element volume rendering technology of the present invention through a specific example:
[0125] The experiment uses the atmospheric humidity data obtained by running the meteorological model WRF (Weather Research and Forecasting Model): relative humidity, in nc format (nc is one of the standard formats for meteorological data). First, the netcdf (network Common Data Format) expansion package is used to read the nc data in the background, and the coordinates are converted according to formulas (2)-(7), and then the data set with the specified data structure is formed through encoding. Then, based on the three-dimensional data field, a blank texture of corresponding resolution is set for each layer of the profile grid, and a grayscale mapping between 0-255 is performed according to the grid data value to form the following: Figure 3 The mapping texture shown in FIG. Figure 4 The mapped texture slice array shown.
[0126] The bounding box of the three-dimensional grid field is established as a spatial cube structure. The eight vertices of the cube are passed into the vertex shader as texture coordinates. The camera view is set as the initial light source point, and the three faces of the bounding box away from the view are used as the rear faces, and the three faces close to the view are used as the front faces. In the fragment shader, the sampling step is set, and the grayscale value Gray of the intersection point with the slice in the ray from the view to the rear face is calculated in sequence. The grayscale value of the final pixel point is accumulated and calculated by formula (1). The RGBA value of the fragment is obtained by using the RGBA (R represents Red, G represents Green, B represents Blue, and A represents Alpha) color table with atmospheric humidity classification.
[0127] Finally, the returned results are overlaid on the map using the web-based map framework Mapbox (Mapbox is a website that allows you to create and customize personalized maps for free). This process is as follows: Figure 6 shown.
[0128] In order to better display the internal structure of atmospheric humidity, the present invention adjusts the color fusion coefficient k and the ray step length so that the atmospheric humidity range that accounts for a large proportion of the area is highlighted and the rest is hidden. The result is more intuitive and credible. Figures 7 to 10 shown.
[0129] In summary, the embodiments of the present invention address the shortcomings of existing meteorological element simulation technologies, such as lack of real-time performance and intuitiveness, by using improved volume rendering technology and web-side shader acceleration technology. This method is based on the traditional volume rendering concept, models the meteorological model result data into a three-dimensional space grid field, forms a cubic space containing texture slices through texture mapping, and uses projection line technology to fuse and accumulate the color values of each slice sampling point according to a certain strategy to form the final pixel point color, rendering the overall three-dimensional field effect. The entire calculation process is placed on the GPU, which greatly improves the efficiency of web-side rendering. At the same time, the set color fusion coefficient can artificially control the visibility of different value ranges in the meteorological elements, and more intuitively display the internal interest area and its internal structural characteristics. The invention can continuously and dynamically display the changing effects of meteorological elements under multiple time series, the program runs smoothly, and the effect is intuitive and reliable.
[0130] Fig.11 It is a block diagram of a volume rendering device for meteorological data according to an embodiment of the present invention.
[0131] like Fig.11 As shown, the volume rendering device 100 for meteorological data includes: an acquisition module 10 , a formation module 20 , a creation module 30 , a sampling module 40 , a first determination module 50 , a second determination module 60 and a display module 70 .
[0132] Among them, the acquisition module 10 is used to acquire multiple meteorological data and the location information of each meteorological data; the formation module 20 is used to form multiple mapping texture slices by texture mapping based on the meteorological data and the location information; the establishment module 30 is used to establish a bounding box surrounding the multiple mapping texture slices, and the shape of the bounding box is a cube; the sampling module 40 is used to set the initial light source so that the light is projected from the initial light source into the cube, and when the traversal distance n of the light in the cube is less than the farthest traversal distance m of the light in the cube, equidistant sampling is performed to obtain the RGB color value and transparency of each sampling point; the first determination module 50 is used to determine the color fusion coefficient k of the current mapping texture slice, and the size of k is between 0 and 1; the second determination module 60 is used to determine the pixel color mixing value D(r, g, b, a) according to each of the RGB color values, the transparency and the color fusion coefficient k, and the D(r, g, b, a) is:
[0133]
[0134] Among them, i is the current ray step, m is the farthest traversal distance of the light in the cube, Tr is the red color value at the intersection of the light and the slice, Tg is the green color value at the intersection of the light and the slice, Tb is the blue color value at the intersection of the light and the slice, and Ta is the transparency at the intersection of the light and the slice; the display module 70 is used to save the pixel color mixing value in the frame buffer area of the GPU and draw it in the Web map framework.
[0135] It should be noted that, for other specific implementations of the volume rendering device for meteorological data in the embodiment of the present invention, reference may be made to the specific implementations of the volume rendering method for meteorological data described above, which will not be described again here to avoid redundancy.
[0136] By setting the color fusion coefficient, the device can display meteorological elements more intuitively, improve visualization effects, and enhance the user's visual experience.
[0137] Corresponding to the above embodiment, the present invention also provides a computer device.
[0138] The computer device of the embodiment of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the volume rendering method for meteorological data according to the above embodiment of the present invention can be implemented.
[0139] When the processor of the computer device executes a computer program, it can set a color fusion coefficient to more intuitively display meteorological elements, improve visualization effects, and enhance the user's visual experience.
[0140] Corresponding to the above embodiment, the present invention also proposes a non-transitory computer-readable storage medium.
[0141] The non-temporary computer-readable storage medium of the embodiment of the present invention stores a computer program, which, when executed by a processor, can implement the volume rendering method for meteorological data according to the above embodiment of the present invention.
[0142] When the processor executes the computer program, the storage medium can set the color fusion coefficient to more intuitively display meteorological elements, improve the visualization effect, and enhance the user's visual experience.
[0143] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. "Multiple" means two or more, unless otherwise clearly and specifically defined.
[0144] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0145] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.
[0146] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0147] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0148] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0149] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0150] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A volume rendering method for meteorological data, characterized in that: include: Obtain multiple meteorological data and location information of each meteorological data; Based on the meteorological data and the location information, a plurality of mapped texture slices are formed by texture mapping; Establishing a bounding box surrounding a plurality of mapped texture slices, wherein the bounding box is in a cube shape; An initial light source is set so that light is projected from the initial light source into the cube. When the distance n that the light travels through in the cube is less than the farthest distance m that the light travels through in the cube, equidistant sampling is performed to obtain the RGB color value and transparency of each sampling point. Determine the color fusion coefficient k of the current mapped texture slice, where the value of k is between 0 and 1; According to each of the RGB color values, the transparency and the color fusion coefficient k, the pixel color mixing value D (r, g, b, a) is determined, and the D (r, g, b, a) is: Where i is the current ray step, m is the farthest distance the ray travels in the cube, Tr is the red color value at the intersection of the ray and the slice, Tg is the green color value at the intersection of the ray and the slice, Tb is the blue color value at the intersection of the ray and the slice, and Ta is the transparency at the intersection of the ray and the slice; The pixel color mixing value is stored in the frame buffer of the GPU and drawn and displayed in the Web map framework.
2. The volume rendering method for meteorological data according to claim 1, characterized in that: Forming a plurality of mapped texture slices by texture mapping based on the plurality of meteorological data and the position information includes: Preprocessing the corresponding meteorological data based on each of the location information to obtain corresponding data field grid point coordinates; Dividing the data field grid point coordinates into sections to form a plurality of section units with grid points as basic units, wherein the attribute data of the grid points include: the number of rows, the number of columns, the number of layers, the world three-dimensional coordinate values and the corresponding meteorological data values; Forming a corresponding blank texture according to the number of rows and layers of grid points in each section unit, and color mapping the texture pixels in the corresponding blank texture according to the numerical value of the meteorological data to obtain a mapped texture; The mapping texture is sliced according to the number of columns of the grid points to obtain a plurality of mapping texture slices arranged in slices.
3. The volume rendering method for meteorological data according to claim 2, characterized in that: The pre-processing comprises: The meteorological data of the same altitude layer is converted into a spatial rectangular coordinate system to obtain the position information (x, y, z) in the spatial rectangular coordinate system, where the conversion formula is: Among them, R is the radius of the sphere, LatValue is the latitude coordinate, and LongValue is the longitude coordinate; Calculate the world coordinates (X, Y, Z) of grid points at different pressure layers at the same longitude and latitude, where the calculation formula is: X=X0*(1_h) / 1 Y=Y0*(1_h) / 1 Z=Z0+(Z0*h) / R, Where h is the height of the point from the ground, Z0 is the Z value of the world coordinate system of the initial point, Y0 is the Y value of the world coordinate system of the initial point, and X0 is the X value of the world coordinate system of the initial point.
4. The volume rendering method for meteorological data according to claim 1, characterized in that: Also includes: The farthest distance m that a ray of light travels in the cube is determined according to the transparency.
5. The volume rendering method for meteorological data according to claim 4, characterized in that: Determining the light projection distance m according to the transparency includes: Determine the depth value based on transparency; Eliminate fragments whose depth values are greater than the first threshold, and render a front-facing depth map of the data field. At this time, the color value of each pixel on the depth map represents the distance to the point closest to the viewpoint in that direction. Eliminate fragments whose depth values are less than the second threshold, and render a depth map of the rear surface of the data field, where the color value of each pixel on the rear surface represents the distance of the point farthest from the viewpoint in that direction; The data on the rear surface depth map and the front surface depth map are subtracted to obtain the farthest traversal distance m of the light in the cube.
6. The volume rendering method for meteorological data according to claim 1, characterized in that: Get the RGB color value and transparency of each sampling point, including: Calculate the sampled texture coordinate t according to the following formula; t=t start +Dir*delta Among them, t start Represents the volume texture coordinates of the projected point on the cube surface, Dir represents the unit vector of the projection direction, and delta represents the sampling interval, which increases as n increases; The RGB color value and transparency of the corresponding sampling point are queried on the cube according to the sampled texture coordinates.
7. The volume rendering method for meteorological data according to claim 1, characterized in that: The color fusion coefficient k increases as n increases.
8. A volume rendering device for meteorological data, characterized in that: include: An acquisition module, used for acquiring multiple meteorological data and location information of each meteorological data; A forming module, configured to form a plurality of mapped texture slices by texture mapping based on the meteorological data and the location information; An establishing module, used for establishing a bounding box surrounding a plurality of mapped texture slices, wherein the bounding box is in the shape of a cube; A sampling module is used to set an initial light source so that light is projected from the initial light source into the cube, and when the distance n that the light travels through in the cube is less than the farthest distance m that the light travels through in the cube, equidistant sampling is performed to obtain the RGB color value and transparency of each sampling point; A first determination module is used to determine a color fusion coefficient k of a current mapped texture slice, where the value of k is between 0 and 1; The second determination module is used to determine the pixel color mixing value D (r, g, b, a) according to each of the RGB color values, the transparency and the color fusion coefficient k, where D (r, g, b, a) is: Where i is the current ray step, m is the farthest distance the ray travels in the cube, Tr is the red color value at the intersection of the ray and the slice, Tg is the green color value at the intersection of the ray and the slice, Tb is the blue color value at the intersection of the ray and the slice, and Ta is the transparency at the intersection of the ray and the slice; The display module is used to store the pixel color mixing value in the frame buffer of the GPU and draw and display it in the Web map framework.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the volume rendering method for meteorological data according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the volume rendering method for meteorological data according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Graphics processing unit (GPU) based accelerated dynamic sectioning method of volume data
CN102074036A
Image rendering method and device based on volume rendering
CN107481312A
GPU-based meteorological data volume rendering method
CN111652961A
Volume rendering apparatus
JP2019207450A
