Volume rendering method and system based on WRF output data
By establishing a bounding box in the volume drawing method, dynamically adjusting the sampling step length and layered resampling, and opacity calculations, the problems of low rendering efficiency and image distortion in the prior art are solved, and efficient and accurate meteorological data visualization is achieved.
Patent Information
- Application Number
- CN202510335101.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-08-15
AI Technical Summary
When the existing volume drawing methods render complex weather data, sampling point selection and color value calculation may cause image distortion, and the rendering efficiency of large-scale high-resolution data is low, making it difficult to meet the needs of real-time display and interaction.
The volume rendering and rendering method based on WRF output data is adopted, and the calculation process of color values and opacity values is optimized by establishing a bounding box, dynamically adjusting the sampling step length, layered resampling and calculating reflectivity and shadow parameters.
It significantly improves rendering efficiency and accuracy, can better express the spatial distribution of meteorological data, and enhances the sense of hierarchy and realism of visual effects.
Smart Images

Figure CN120495495A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional data visualization, and in particular to a volume rendering method and system based on WRF output data. Background Art
[0002] Meteorological data visualization is a crucial application in fields such as three-dimensional weather simulation, meteorological system research, and large-scale scene simulation. With the rapid development of remote sensing technology, existing techniques have enabled the provision of massive amounts of real-time data for meteorological research. However, relying solely on this data is insufficient to fully capture the complexity of meteorological phenomena. To effectively transform this vast amount of data into intuitive and understandable information, meteorological data visualization technology is crucial.
[0003] Currently, volume rendering technology is widely used in the visualization of meteorological data. Volume rendering technology generates two-dimensional images from meteorological data in a hierarchical manner by displaying three-dimensional volume data field information. Unlike traditional surface rendering, volume rendering focuses on displaying the volume information of objects, especially visualizing the details inside the objects. Specifically, volume rendering technology uses a ray casting algorithm to emit light from the viewpoint, interact with each sampling point of the volume data, and finally accumulate the color values and opacity values of all sampling points to generate the final image. This method can provide more detailed layering and spatial information for the presentation of meteorological data. However, in practical applications, existing volume rendering methods still face some challenges, especially when it comes to efficiently presenting complex meteorological elements. The intuitiveness and rendering effects are often insufficient, affecting the quality and accuracy of the visualization effect.
[0004] Traditional volume rendering techniques often suffer from the following shortcomings: First, during the rendering process, the selection of sampling points and the calculation of color values may not fully reflect the actual distribution of meteorological data, resulting in distortion in the rendered image. Second, traditional methods are inefficient for rendering large datasets, especially when processing high-resolution data. The computational complexity and rendering time are significant, affecting the smoothness of real-time display and interaction. Therefore, improving the rendering quality of meteorological data volume rendering and optimizing sampling and calculation strategies have become research hotspots in meteorological data visualization technology. Summary of the Invention
[0005] In view of the above existing problems, the present invention is proposed.
[0006] Therefore, the present invention provides a volume rendering method and system based on WRF output data to solve the problem that traditional volume rendering methods may cause image distortion when rendering complex meteorological data, and have low rendering efficiency for large-scale high-resolution data, making it difficult to meet the needs of real-time display and interaction.
[0007] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0008] In a first aspect, the present invention provides a volume rendering method based on WRF output data, comprising:
[0009] Establish bounding boxes for interpolated meteorological volume data;
[0010] Setting an observation point, projecting light from the observation point into the bounding box in the direction of the screen pixel, using an improved ray casting algorithm to determine the end point and direction of the light, and calculating the coordinates of the end point and incident point of the light;
[0011] Sampling is performed along the ray path at a specific step size. Based on the total length of the ray and the sampling resolution, a dynamically adjusted sampling step size strategy is used to optimize the sampling accuracy on each ray path.
[0012] According to the distance between the sampling point and the observation point, the light is divided into different levels using the layered resampling method at each sampling point, and different interpolation methods are applied to different levels to calculate the color value and opacity value;
[0013] Calculating reflectivity and shadow parameters based on the grayscale and gradient information of the sampling points, and optimizing the color value and opacity value in combination with the transfer function;
[0014] The optimized color value and opacity value are cumulatively calculated at each sampling point to determine the color value of the pixel point, and the rendering result is visually displayed.
[0015] As a preferred solution of the volume rendering method based on WRF output data of the present invention, the step of determining the end point and direction of a ray using an improved ray casting algorithm and calculating the coordinates of the end point and incident point of the ray includes:
[0016] After processing, the volume data is stored in the video memory in the form of a three-dimensional texture, and the texture coordinates of the three-dimensional texture are mapped one-to-one with the cube bounding box;
[0017] Define the size of the bounding box as size i ×space i , where i∈{x,y,z}, size i is the size of the volume data along the i direction, space i is the voxel spacing in the i direction, and the bounding box is normalized;
[0018] Render the back part of the normalized bounding box, write vertex program and fragment program using GLSL shading language, calculate and store the coordinate of the end point of the light t end In three-dimensional textures;
[0019] Render the front part of the normalized bounding box, write vertex programs and fragment programs using the GLSL shading language, calculate and store the coordinates of the light incident point t start In three-dimensional textures;
[0020] By setting the coordinates of the end point of the ray t end Subtract the coordinates of the incident point of the light ray t start , calculate the light direction vector dir for each pixel on the rendering screen, and store the light direction vector in a three-dimensional texture.
[0021] As a preferred solution of the volume rendering method based on WRF output data of the present invention, the optimization of the sampling accuracy on each ray path by adopting a dynamically adjusted sampling step strategy includes:
[0022] Emitting a ray from the observation point into the bounding box, and calculating the total length of the ray based on the starting point and the ending point of the ray in the bounding box;
[0023] According to the data resolution of the pre-processed meteorological data and the incident angle of the emitted light, the minimum sampling intervals of the light in the three axes of X, Y, and Z are calculated, and the maximum value of the minimum sampling intervals of the three axes is taken as the minimum sampling interval of the light;
[0024] The total length of the ray divided by the minimum number of sampling intervals of the ray is the sampling step length, and it is ensured that the sampling step length of each time is less than half of the distance between two adjacent voxel data points in the volume data;
[0025] According to the total length of the light and the minimum number of sampling steps, a dynamically adjusted sampling step strategy is adopted to optimize the sampling accuracy on each light path.
[0026] As a preferred solution of the volume rendering method based on WRF output data of the present invention, wherein: the layered resampling method is used at each sampling point to divide the light into different levels, including:
[0027] At each sampling point, the light is divided into three equal parts according to the distance between the sampling point and the set observation point;
[0028] When the distance from the sampling point to the observation point is in the first third of the total length of the light, the sampling point is judged to belong to the first level; when the distance from the sampling point to the observation point is in the middle third of the total length of the light, the sampling point is judged to belong to the second level; when the distance from the sampling point to the observation point is in the last third of the total length of the light, the sampling point is judged to belong to the third level.
[0029] As a preferred embodiment of the volume rendering method based on WRF output data of the present invention, the step of applying different interpolation methods to different levels to calculate color values and opacity values includes:
[0030] At the first level, trilinear interpolation is used to calculate the color and opacity values of each sampling point on the light.
[0031] At the second level, every three adjacent sampling points are grouped together, and trilinear interpolation is performed only on the first sampling point in each group. The calculated color and opacity values are assigned to the next two sampling points in the same group.
[0032] At the third level, the color value and opacity value of the point closest to the sampling point are taken as the value of the sampling point using the nearest neighbor interpolation method;
[0033] According to the sampling points at different levels, different interpolation methods are used to perform resampling interpolation operations until the position coordinates of the resampling points are greater than the coordinates of the end point of the light.
[0034] As a preferred embodiment of the volume rendering method based on WRF output data of the present invention, the calculation of reflectivity and shadow parameters based on the grayscale and gradient information of the sampling points and the optimization of the color value and opacity value in combination with the transfer function include:
[0035] Extract the grayscale value and two-dimensional grayscale gradient of the sampling point;
[0036] Predefine the grayscale and gradient values of some key sampling points in the transfer function and assign corresponding optical parameters to them, where the optical parameters include opacity, color value, reflectivity and shadow parameters;
[0037] For sampling points that are not preset, the optical parameters are automatically generated using the linear interpolation method according to their grayscale and gradient values;
[0038] Using the transfer function to correct the color and opacity values obtained by the interpolation method;
[0039] The reflectivity and shadow parameters of the sampling points are calculated based on the grayscale and gradient values of the sampling points, so as to simulate the propagation and interaction of light in the meteorological volume data.
[0040] As a preferred embodiment of the volume rendering method based on WRF output data of the present invention, the cumulative calculation of the optimized color value and opacity value at each sampling point to determine the color value of the pixel point includes:
[0041] According to the light sampling path, the color value and opacity value of the sampling point are recursively superimposed in the order from front to back;
[0042] The color value and opacity value of each sampling point are synthesized with the accumulated color value and accumulated opacity value of the previous sampling point to obtain a synthesized result;
[0043] The color value and opacity value on the current path of the light are dynamically updated according to the synthesis result until the light passes through the entire sampling path to generate a target image.
[0044] In a second aspect, the present invention provides a volume rendering system based on WRF output data, comprising:
[0045] An initial calculation module is used to establish a bounding box for the interpolated meteorological volume data, set an observation point, project a ray from the observation point into the bounding box in the direction of the screen pixel, use an improved ray casting algorithm to determine the end point and direction of the ray, and calculate the coordinates of the end point and incident point of the ray;
[0046] The first optimization module is used to sample along the ray path at a specific step size, and optimize the sampling accuracy on each ray path using a dynamically adjusted sampling step size strategy based on the total length of the ray and the sampling resolution;
[0047] The layered calculation module is used to divide the light into different layers using the layered resampling method at each sampling point according to the distance between the sampling point and the observation point, and calculate the color value and opacity value by applying different interpolation methods to different layers;
[0048] A second optimization module is used to calculate reflectivity and shadow parameters according to the grayscale and gradient information of the sampling points, and optimize the color value and opacity value in combination with the transfer function;
[0049] The cumulative rendering module is used to perform cumulative calculation on the optimized color value and opacity value at each sampling point, determine the color value of the pixel point, and visually display the rendering result.
[0050] In a third aspect, the present invention provides an electronic device, comprising:
[0051] memory and processor;
[0052] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the volume rendering method based on WRF output data are implemented.
[0053] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the volume rendering method based on WRF output data.
[0054] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention provides a volume rendering method and system based on WRF output data, which dynamically adjusts the sampling step size and optimizes the sampling accuracy on each light path according to the total length of the light and the sampling resolution, thereby avoiding oversampling and unnecessary calculations and significantly improving the rendering efficiency; adopts a layered resampling method, divides the light into different levels according to the distance between the sampling point and the observation point, and adopts different interpolation methods to calculate the color value and opacity value, which can improve the rendering rate; calculates the reflectivity and shadow parameters of the point according to the grayscale and gradient information of the sampling point, thereby optimizing and adjusting the transfer function, and calculating the final color value of the screen pixel, so that the rendering effect is more in line with the physical characteristics of the meteorological data, can more accurately represent the spatial distribution of meteorological elements, and improve the layering and realism of the visualization effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0056] Figure 1 This is a logical diagram of the overall process of a volume rendering method based on WRF output data according to an embodiment of the present invention;
[0057] Figure 2 A schematic diagram of a method for ray traversing three-dimensional volume data and a layered resampling method of a volume rendering method based on WRF output data according to an embodiment of the present invention;
[0058] Figure 3 Comparison chart of rendering time of the marching cubes algorithm, ray casting algorithm, improved ray casting algorithm, and the method proposed in the present invention in a volume rendering method based on WRF output data according to an embodiment of the present invention. (a) The figure area is nationwide, and (b) The figure area is Guizhou Province;
[0059] Figure 4 This is a visualization diagram of the temperature field after rendering is completed using the volume rendering method based on WRF output data according to an embodiment of the present invention. (a) The area of the figure is the whole country, and (b) The area of the figure is Guizhou;
[0060] Figure 5 This is a visualization diagram of the relative humidity field after rendering is completed using the volume rendering method based on WRF output data according to an embodiment of the present invention. (a) The area of the figure is the entire country, and (b) The area of the figure is Guizhou.
[0061] Figure 6 This is a visualization diagram of the cloud fraction field after rendering is completed using the volume rendering method based on WRF output data according to an embodiment of the present invention. (a) is the national area, and (b) is the Guizhou area. DETAILED DESCRIPTION
[0062] To make the above-mentioned objects, features, and advantages of the present invention more clearly understood, the following detailed description of the specific embodiments of the present invention is given in conjunction with the accompanying drawings. It is obvious that the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in this field without creative work should fall within the scope of protection of the present invention.
[0063] Example 1, with reference to Figure 1-Figure 2 As an embodiment of the present invention, a volume rendering method based on WRF output data is provided. Figure 1 The specific steps shown include:
[0064] S100: establishing a bounding box for the interpolated meteorological volume data;
[0065] S200: Setting an observation point, projecting light from the observation point to the screen pixel into the bounding box, using an improved ray casting algorithm to determine the end point and direction of the light, and calculating the coordinates of the end point and incident point of the light;
[0066] S300: Sampling is performed along the ray path at a specific step size. Based on the total length of the ray and the sampling resolution, a dynamically adjusted sampling step size strategy is used to optimize the sampling accuracy on each ray path.
[0067] S400: Based on the distance between the sampling point and the observation point, a layered resampling method is used at each sampling point to divide the light into different levels, and different interpolation methods are applied to different levels to calculate the color value and opacity value;
[0068] S500: Calculate reflectivity and shadow parameters based on the grayscale and gradient information of the sampling points, and optimize color values and opacity values in combination with the transfer function;
[0069] S600: Accumulate and calculate the optimized color value and opacity value at each sampling point, determine the color value of the pixel point, and visualize the rendering result.
[0070] It should be noted that the present invention provides a volume rendering method and system based on WRF output data. By dynamically adjusting the sampling step size, the sampling accuracy on each light path is optimized according to the total length of the light and the sampling resolution, thereby avoiding oversampling and unnecessary calculations and significantly improving the rendering efficiency; a layered resampling method is adopted to divide the light into different levels according to the distance between the sampling point and the observation point, and different interpolation methods are used to calculate the color value and opacity value, which can improve the rendering rate; the reflectivity and shadow parameters of the point are calculated according to the grayscale and gradient information of the sampling point, thereby optimizing and adjusting the transfer function, and calculating the final color value of the screen pixel, so that the rendering effect is more in line with the physical characteristics of the meteorological data, can more accurately represent the spatial distribution of meteorological elements, and improve the layering and realism of the visualization effect.
[0071] In the embodiment of the present application, the above step S100 includes:
[0072] Specifically, interpolation processing is performed on the WRF output data to improve the data resolution, wherein the interpolation processing steps include:
[0073] Assume that the coordinates of the point to be interpolated are (x, y), and the coordinates of the four grid points around this point are (x1, y1), (x1, y1), (x1, y2), (x2, y2), and their corresponding values are Q1, Q2, Q3, and Q4 respectively;
[0074] First, perform linear interpolation in the x-axis direction and calculate two temporary interpolation values T2 and T2. The formula is expressed as:
[0075]
[0076] Then perform linear interpolation in the y-axis direction to calculate the final interpolation value P, which is expressed as:
[0077]
[0078] Specifically, the step of establishing a bounding box for the interpolated meteorological volume data includes: determining minimum and maximum boundary values according to the spatial range of the meteorological data, forming a three-dimensional axis-aligned bounding box, and ensuring that all data points are located within the bounding box.
[0079] It should be noted that the above step S100 can effectively limit the scope of data processing and rendering, reduce computational complexity, improve the efficiency of subsequent ray casting and other processing steps, and lay the foundation for high-quality visualization.
[0080] In the embodiment of the present application, the above step S200 sets the observation point, projects a ray from the observation point toward the screen pixel into the bounding box, uses an improved ray casting algorithm to determine the end point and direction of the ray, and calculates the coordinates of the end point and incident point of the ray. The steps specifically include:
[0081] After processing, the volume data is stored in the video memory in the form of a three-dimensional texture, and the texture coordinates of the three-dimensional texture are mapped one-to-one with the cube bounding box;
[0082] Define the size of the bounding box as size i ×space i , where i∈{x,y,z}, size i is the size of the volume data along the i direction, space i is the voxel spacing in the i direction, and the bounding box is normalized;
[0083] Render the back part of the normalized bounding box, write vertex programs and fragment programs using the GLSL shading language, and calculate and store the coordinates of the end point of the light t end In three-dimensional textures;
[0084] Render the front part of the normalized bounding box, write vertex programs and fragment programs using the GLSL shading language, and calculate and store the coordinates of the light incident point t start In three-dimensional textures;
[0085] By setting the coordinates of the end point of the ray t end Subtract the coordinates of the incident point t start , calculate the light direction vector dir for each pixel on the rendering screen, and store the light direction vector in a three-dimensional texture.
[0086] It should be noted that the above step S200 can accurately locate and trace the light path, provide accurate basic data for subsequent sampling and rendering, and enhance the authenticity and accuracy of the visualization effect.
[0087] In the embodiment of the present application, step S300 performs sampling along the light path at a specific step size. Based on the total length of the light and the sampling resolution, a dynamically adjusted sampling step size strategy is used to optimize the sampling accuracy on each light path. The steps specifically include:
[0088] Emit a ray from the observation point into the bounding box, and calculate the total length of the ray based on the starting and ending points of the ray in the bounding box;
[0089] According to the data resolution of the pre-processed meteorological data and the incident angle of the emitted light, the minimum sampling intervals of the light in the three axes of X, Y, and Z are calculated, and the maximum value of the minimum sampling intervals of the three axes is taken as the minimum sampling interval of the light;
[0090] The total length of the ray divided by the minimum sampling interval of the ray is the sampling step length, and each sampling step length must be less than half the distance between two adjacent voxel data points in the volume data to ensure image quality;
[0091] Based on the total length of the light and the minimum number of sampling steps, a dynamically adjusted sampling step strategy is used to optimize the sampling accuracy on each light path to ensure the accuracy and computational efficiency of the rendering effect. The step calculation formula is as follows:
[0092]
[0093] Among them, Len represents the total length of the light, P s,x 、P e,x 、P s,y 、P e,y 、P s,z 、P e,z Represents the coordinate values of the starting point and end point of the light on each axis, r x 、r y 、r z are the resolutions of the data in the X, Y, and Z axes respectively. f is a dynamic adjustment factor used to ensure that the sampling step is less than half of the distance between two adjacent voxel data points in the volume data. The value range is between 0 and 1.
[0094] It should be noted that the above step S300 adopts a dynamically adjusted sampling step strategy for sampling along the light path, and optimizes the sampling accuracy on each light path based on the total length of the light and the sampling resolution. This method can significantly reduce the amount of calculation while ensuring the rendering quality, improve rendering efficiency, and ensure that key features are accurately represented.
[0095] In the embodiment of the present application, the above step S400 divides the light into different levels at each sampling point using a layered resampling method based on the distance between the sampling point and the observation point, and calculates the color value and opacity value by applying different interpolation methods to different levels, including:
[0096] Specifically, at each sampling point, the stratified resampling method is used to divide the light into different levels, including:
[0097] At each sampling point, the light is divided into three equal parts according to the distance between the sampling point and the set observation point;
[0098] When the distance from the sampling point to the observation point is in the first third of the total length of the ray, the sampling point is judged to belong to the first level;
[0099] When the distance from the sampling point to the observation point is in the middle third of the total length of the ray, the sampling point is judged to belong to the second level;
[0100] When the distance from the sampling point to the observation point is in the last third of the total length of the ray, the sampling point is judged to belong to the third level.
[0101] Specifically, different interpolation methods are applied to different levels to calculate color and opacity values, including:
[0102] At the first level, trilinear interpolation is used to calculate the color and opacity values of each sampling point on the light;
[0103] At the second level, every three adjacent sampling points are divided into a group, and only the first sampling point of each group is subjected to trilinear interpolation. The calculated color value and opacity value are assigned to the next two sampling points in the same group respectively.
[0104] At the third level, the nearest neighbor interpolation method is used to take the color value and opacity value of the point closest to the sampling point as the value of the sampling point;
[0105] According to the sampling points at different levels, different interpolation methods are used to perform resampling interpolation operations until the position coordinates of the resampling points are greater than the coordinates of the end point of the light.
[0106] It should be noted that the above step S400 can finely process information of different depths, enhance the detail expression and layering of the image, and make the final visualization result more realistic and detailed.
[0107] In the embodiment of the present application, the above step S500 calculates the reflectivity and shadow parameters based on the grayscale and gradient information of the sampling point, and optimizes the color value and opacity value in combination with the transfer function. The steps specifically include:
[0108] Extract the grayscale value and two-dimensional grayscale gradient of sampling points from meteorological data;
[0109] Predefine the grayscale and gradient values of some key sampling points in the transfer function and assign corresponding optical parameters to them, where the optical parameters include opacity, color value, reflectivity and shadow parameters;
[0110] For sampling points that are not preset, the optical parameters are automatically generated using the linear interpolation method according to their grayscale and gradient values;
[0111] The color and opacity values obtained by interpolation are corrected using transfer functions to adjust optical parameters more accurately.
[0112] The reflectivity and shadow parameters of the sampling points are calculated based on the grayscale and gradient values of the sampling points to simulate the propagation and interaction of light in meteorological data, so as to enhance the realism and layering of the rendering results.
[0113] In an embodiment of the present application, for sampling points that are not preset, the steps of automatically generating optical parameters using a linear interpolation method according to their grayscale and gradient values include:
[0114] Find two key sampling points (A and B) adjacent to the sampling point;
[0115] According to the proportional relationship between the grayscale and gradient values of the sampling point and A and B, the optical parameters are calculated as follows:
[0116]
[0117] Among them, G C is the grayscale value of sampling point C, G A and G B are the grayscale values of key sampling points A and B, α A and α B The opacity of A and B respectively.
[0118] In the embodiment of the present application, the calculation formula of the reflectivity is as follows:
[0119]
[0120] Among them, S base is the basic shadow parameter, is the grayscale gradient, is the maximum grayscale gradient, θ is the angle between the light direction and the gradient direction;
[0121] In the embodiment of the present application, the calculation formula of the shadow parameter is as follows:
[0122]
[0123] Among them, S base is the basic shadow parameter, is the grayscale gradient, is the maximum grayscale gradient, and θ is the angle between the light direction and the gradient direction.
[0124] It should be noted that the above step S500 can enhance the realism and depth of the image, accurately represent the optical properties of the object surface, and improve the quality and realism of the overall visual effect by optimizing color and transparency.
[0125] In the embodiment of the present application, the above step S600 accumulates and calculates the optimized color value and opacity value at each sampling point, determines the color value of the pixel point, and visually displays the rendering result, including:
[0126] Specifically, the optimized color value and opacity value are cumulatively calculated at each sampling point to determine the color value of the pixel point, including:
[0127] According to the light sampling path, the color value and opacity value of the sampling point are recursively superimposed in the order from front to back;
[0128] The color value C of each sampling point now and opacity value α now The cumulative color value C of the previous sampling point in and the cumulative opacity value α in Synthesize to obtain a synthesis result;
[0129] The synthesis formula is expressed as:
[0130] C out =C in α in +C now α now (1-α in )
[0131] α out =α in +α now (1-α in )
[0132] The color value and opacity value on the current path of the light are dynamically updated according to the synthesis result until the light passes through the entire sampling path and the target image is generated.
[0133] It should be noted that the above step S600 accumulates the optimized color value and opacity value at each sampling point, determines the color value of the pixel point, and visualizes the rendering result. This method can integrate the information of all sampling points to generate a high-quality final image, ensuring rich details and accurate colors, while providing intuitive visualization results, which facilitates the analysis and understanding of the internal structure and characteristics of meteorological volume data.
[0134] Example 2, reference Figures 3 to 6 Based on the previous embodiment, this embodiment provides an application example of a volume rendering method and system based on WRF output data, in order to verify and illustrate the technical effects adopted in this method.
[0135] In order to verify the improvement of the visualization efficiency of WRFOUT meteorological 3D data by the method proposed in this invention, this example compares the rendering time of three meteorological volume data: temperature, relative humidity, and cloud fraction. The experimental results are as follows: Figures 4 to 6 As shown in the figure, the changes in rendering time under different meteorological datasets and different algorithms are shown. The data in the figure covers the entire country and Guizhou region, and intuitively shows the differences in rendering time of different methods in different regions and datasets.
[0136] like Figure 3 The figure shows the comparison of rendering time of marching cube algorithm, ray casting algorithm, improved ray casting algorithm and the method proposed in this invention. (a) is the whole country, (b) is the Guizhou area. Figure 3 It can be seen that the method proposed in the present invention outperforms the other three comparison methods in both areas. Compared with traditional algorithms, the method proposed in the present invention shortens the rendering time, can significantly improve the calculation speed and efficiency, and significantly optimizes the three-dimensional visualization process.
[0137] Therefore, the present invention dynamically adjusts the sampling step size and optimizes the sampling accuracy on each light path according to the total length of the light and the sampling resolution, thereby avoiding oversampling and unnecessary calculations and significantly improving rendering efficiency; adopts a layered resampling method to divide the light into different levels according to the distance between the sampling point and the observation point, and adopts different interpolation methods to calculate the color value and opacity value, which can improve the rendering rate; calculates the reflectivity and shadow parameters of the point according to the grayscale and gradient information of the sampling point, thereby optimizing and adjusting the transfer function, and calculating the final color value of the screen pixel, so that the rendering effect is more in line with the physical characteristics of the meteorological data, can more accurately represent the spatial distribution of meteorological elements, and improve the layering and realism of the visualization effect.
[0138] Embodiment 3: This embodiment provides a volume rendering system based on WRF output data, including:
[0139] The initial calculation module is used to establish a bounding box for the interpolated meteorological volume data, set the observation point, cast a ray from the observation point to the screen pixel into the bounding box, use the improved ray casting algorithm to determine the end point and direction of the ray, and calculate the coordinates of the end point and incident point of the ray;
[0140] The first optimization module is used to sample along the ray path at a specific step size, and optimize the sampling accuracy on each ray path using a dynamically adjusted sampling step size strategy based on the total length of the ray and the sampling resolution;
[0141] The layered calculation module is used to divide the light into different layers using the layered resampling method at each sampling point according to the distance between the sampling point and the observation point, and calculate the color value and opacity value by applying different interpolation methods to different layers;
[0142] The second optimization module is used to calculate the reflectivity and shadow parameters according to the grayscale and gradient information of the sampling points, and optimize the color value and opacity value in combination with the transfer function;
[0143] The cumulative rendering module is used to accumulate the optimized color value and opacity value at each sampling point, determine the color value of the pixel point, and visualize the rendering results.
[0144] It should be noted that the technical solution of the volume rendering system based on WRF output data and the technical solution of the volume rendering method based on WRF output data belong to the same concept. For details not described in detail in the technical solution of the volume rendering system based on WRF output data in this embodiment, please refer to the description of the technical solution of the volume rendering method based on WRF output data.
[0145] The above-mentioned unit 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 corresponding operations of the above-mentioned modules.
[0146] This embodiment also provides an electronic device, which includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. 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 communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a volume rendering method based on WRF output data 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 covering the display screen, or a button, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse.
[0147] This embodiment further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method proposed in the above embodiment is implemented.
[0148] The storage medium proposed in this embodiment and the method proposed in the above embodiment belong to the same inventive concept. For technical details not fully described in this embodiment, please refer to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0149] Through the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented with the help of software and necessary general-purpose hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the method of the embodiment of the present invention.
[0150] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
[0151] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code. The scheme in the embodiment of the present application can be implemented in various computer languages.
[0152] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0153] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0154] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0155] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.
[0156] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.
Claims
1. A volume rendering method based on WRF output data, characterized in that: include: Establish bounding boxes for interpolated meteorological volume data; Setting an observation point, projecting light from the observation point into the bounding box in the direction of the screen pixel, using an improved ray casting algorithm to determine the end point and direction of the light, and calculating the coordinates of the end point and incident point of the light; Sampling is performed along the ray path at a specific step size. Based on the total length of the ray and the sampling resolution, a dynamically adjusted sampling step size strategy is used to optimize the sampling accuracy on each ray path. According to the distance between the sampling point and the observation point, the light is divided into different levels using the layered resampling method at each sampling point, and different interpolation methods are applied to different levels to calculate the color value and opacity value; Calculating reflectivity and shadow parameters based on the grayscale and gradient information of the sampling points, and optimizing the color value and opacity value in combination with the transfer function; The optimized color value and opacity value are cumulatively calculated at each sampling point to determine the color value of the pixel point, and the rendering result is visually displayed.
2. The volume rendering method based on WRF output data according to claim 1, characterized in that: The improved ray casting algorithm is used to determine the end point and direction of the ray, and calculate the coordinates of the end point and incident point of the ray, including: After processing, the volume data is stored in the video memory in the form of a three-dimensional texture, and the texture coordinates of the three-dimensional texture are mapped one-to-one with the cube bounding box; Define the size of the bounding box as size i ×space i , where i∈{x,y,z}, size i is the size of the volume data along the i direction, space i is the voxel spacing in the i direction, and the bounding box is normalized; Render the back part of the normalized bounding box, write vertex program and fragment program using GLSL shading language, calculate and store the coordinate of the end point of the light t end In three-dimensional textures; Render the front part of the normalized bounding box, write vertex programs and fragment programs using the GLSL shading language, calculate and store the coordinates of the light incident point t start In three-dimensional textures; By setting the coordinates of the end point of the ray t end Subtract the coordinates of the incident point of the light ray t start , calculate the light direction vector dir for each pixel on the rendering screen, and store the light direction vector in a three-dimensional texture.
3. The volume rendering method based on WRF output data according to claim 2, characterized in that: The method of optimizing the sampling accuracy on each light path by adopting a dynamically adjusted sampling step strategy includes: Emitting a ray from the observation point into the bounding box, and calculating the total length of the ray based on the starting point and the ending point of the ray in the bounding box; According to the data resolution of the pre-processed meteorological data and the incident angle of the emitted light, the minimum sampling intervals of the light in the three axes of X, Y, and Z are calculated, and the maximum value of the minimum sampling intervals of the three axes is taken as the minimum sampling interval of the light; The total length of the ray divided by the minimum number of sampling intervals of the ray is the sampling step length, and it is ensured that the sampling step length of each time is less than half of the distance between two adjacent voxel data points in the volume data; According to the total length of the light and the minimum number of sampling steps, a dynamically adjusted sampling step strategy is adopted to optimize the sampling accuracy on each light path.
4. The volume rendering method based on WRF output data according to claim 3, characterized in that: The layered resampling method is used at each sampling point to divide the light into different levels, including: At each sampling point, the light is divided into three equal parts according to the distance between the sampling point and the set observation point; When the distance from the sampling point to the observation point is in the first third of the total length of the light, the sampling point is judged to belong to the first level; when the distance from the sampling point to the observation point is in the middle third of the total length of the light, the sampling point is judged to belong to the second level; when the distance from the sampling point to the observation point is in the last third of the total length of the light, the sampling point is judged to belong to the third level.
5. The volume rendering method based on WRF output data according to claim 4, characterized in that: The calculation of color values and opacity values by applying different interpolation methods to different levels includes: At the first level, trilinear interpolation is used to calculate the color and opacity values of each sampling point on the light. At the second level, every three adjacent sampling points are grouped together, and trilinear interpolation is performed only on the first sampling point in each group. The calculated color and opacity values are assigned to the next two sampling points in the same group. At the third level, the color value and opacity value of the point closest to the sampling point are taken as the value of the sampling point using the nearest neighbor interpolation method; According to the sampling points at different levels, different interpolation methods are used to perform resampling interpolation operations until the position coordinates of the resampling points are greater than the coordinates of the end point of the light.
6. The volume rendering method based on WRF output data according to claim 5, characterized in that: The calculating of reflectivity and shadow parameters according to the grayscale and gradient information of the sampling points, and optimizing the color value and opacity value in combination with the transfer function includes: Extract the grayscale value and two-dimensional grayscale gradient of the sampling point; Predefine the grayscale and gradient values of some key sampling points in the transfer function and assign corresponding optical parameters to them, where the optical parameters include opacity, color value, reflectivity and shadow parameters; For sampling points that are not preset, the optical parameters are automatically generated using the linear interpolation method according to their grayscale and gradient values; Using the transfer function to correct the color and opacity values obtained by the interpolation method; The reflectivity and shadow parameters of the sampling points are calculated based on the grayscale and gradient values of the sampling points, so as to simulate the propagation and interaction of light in the meteorological volume data.
7. The volume rendering method based on WRF output data according to claim 6, characterized in that: The accumulating calculation of the optimized color value and opacity value at each sampling point to determine the color value of the pixel point includes: According to the light sampling path, the color value and opacity value of the sampling point are recursively superimposed in the order from front to back; The color value and opacity value of each sampling point are synthesized with the accumulated color value and accumulated opacity value of the previous sampling point to obtain a synthesized result; The color value and opacity value on the current path of the light are dynamically updated according to the synthesis result until the light passes through the entire sampling path to generate a target image.
8. A volume rendering system based on WRF output data, applying the method according to any one of claims 1 to 7, characterized in that: include: An initial calculation module is used to establish a bounding box for the interpolated meteorological volume data, set an observation point, project a ray from the observation point into the bounding box in the direction of the screen pixel, use an improved ray casting algorithm to determine the end point and direction of the ray, and calculate the coordinates of the end point and incident point of the ray; The first optimization module is used to sample along the ray path at a specific step size, and optimize the sampling accuracy on each ray path using a dynamically adjusted sampling step size strategy based on the total length of the ray and the sampling resolution; The layered calculation module is used to divide the light into different layers using the layered resampling method at each sampling point according to the distance between the sampling point and the observation point, and calculate the color value and opacity value by applying different interpolation methods to different layers; A second optimization module is used to calculate the reflectivity and shadow parameters according to the grayscale and gradient information of the sampling points, and optimize the color value and opacity value in combination with the transfer function; The cumulative rendering module is used to perform cumulative calculation on the optimized color value and opacity value at each sampling point, determine the color value of the pixel point, and visually display the rendering result.
9. An electronic device comprising a memory and a processor, characterized in that: The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having computer-executable instructions stored thereon, characterized in that: When the computer executable instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Volume data rendering acceleration method for blank space jump
CN120747330A