Volume rendering method and system for non-uniform ocean scalar field data
By employing adaptive step size and nonlinear color mapping, the rendering efficiency and quality issues of ocean scalar field data on the Web platform were resolved, achieving efficient and high-definition volume rendering effects suitable for the visualization of marine science and meteorological data.
Patent Information
- Application Number
- CN202511256132.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-04
- Publication Date
- 2025-12-09
AI Technical Summary
Existing technologies suffer from low rendering efficiency, inability to accurately reflect data details, and poor visual effects when processing non-uniformly distributed ocean scalar field data. In particular, achieving high-performance volume rendering on the Web platform presents significant challenges.
By employing an adaptive step-size stepping sampling algorithm and a nonlinear color mapping method based on data statistical features, data is organized through pseudo-3D textures and depth-spaced textures. Combined with adaptive ray casting and transfer functions, efficient and high-definition volume rendering is achieved.
It significantly improves rendering efficiency and image quality, and can clearly and intuitively present the spatial distribution characteristics and abnormal structures of data, making it suitable for interactive visualization analysis in a browser environment.
Smart Images

Figure CN121095412A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of marine data visualization and geographic information systems, and particularly relates to a volume rendering method and system for non-uniform marine scalar field data. Background Technology
[0002] In fields such as marine science research, weather forecasting, and environmental monitoring, the visualization and analysis of three-dimensional ocean scalar field data (such as sea surface temperature, salinity, and density) is crucial. Traditional data visualization methods mostly rely on two-dimensional charts or cross-sectional views. While effective in specific analyses, these methods cannot intuitively and completely demonstrate the continuous distribution and complex structure of data in three-dimensional space, thus limiting researchers' overall understanding of ocean phenomena.
[0003] To overcome the limitations of two-dimensional visualization, three-dimensional visualization technology has emerged. Among these technologies, volume rendering is one of the most effective means of showcasing the internal structure of a scalar field. Direct volume rendering (DVRF) generates projected images directly from volume data, avoiding information distortion that may result from intermediate geometry processes. Among numerous DVRF algorithms, ray casting is widely used due to its ability to produce high-quality rendered images and its strong support for parallelization.
[0004] However, applying traditional ray casting algorithms to 3D virtual Earth environments (such as Cesium) in the Web environment and visualizing non-uniform data such as oceans faces the following technical challenges: 1. The Conflict Between Rendering Efficiency and Quality: Traditional ray casting algorithms typically employ an equal-interval sampling strategy. However, ocean data (such as sea surface temperature) exhibits significant non-uniformity across vertical depth; surface data is dense and highly variable, while deep data is sparse and moderately variable. The equal-interval sampling strategy leads to extensive redundant sampling in sparse deep regions, wasting computational resources; while in critical areas such as the surface thermocline, insufficient sampling may result in the loss of important detailed features. This makes it difficult to balance rendering efficiency and image quality.
[0005] 2. Poor visual differentiation: The numerical distribution of ocean scalar field data is also uneven, with a large number of data points concentrated in a small numerical range. If traditional linear color mapping functions are used for coloring, the rendered colors will be concentrated in a very small range, causing visual confusion and over-drawing, and failing to effectively highlight the spatial distribution characteristics and abnormal structures of the data.
[0006] 3. Technical limitations of the Web platform: Achieving high-performance volume rendering in a browser environment requires efficient use of the graphics processor. However, existing Web 3D frameworks have limited support for advanced graphics functions such as 3D textures. How to efficiently organize and transmit volume data and implement complex shader logic is a major challenge for volume rendering on the Web.
[0007] Therefore, existing technologies suffer from problems such as low rendering efficiency, inability to accurately reflect data details, and poor visual effects when processing non-uniformly distributed ocean scalar field data. There is an urgent need for a method to achieve high-efficiency and high-quality volume rendering of non-uniform ocean scalar field data. Summary of the Invention
[0008] The purpose of this invention is to solve the problems existing in the prior art and to provide a volume rendering method and system for non-uniform ocean scalar field data.
[0009] To achieve the above-mentioned objectives, the present invention specifically adopts the following technical solution: In a first aspect, the present invention provides a volume rendering method for non-uniform ocean scalar field data, comprising the following steps: S1. Acquire three-dimensional ocean scalar field data with non-uniform depth layer distribution, create a pseudo-three-dimensional data texture based on the three-dimensional ocean scalar field data to store voxel scalar values, and create a one-dimensional depth interval texture based on the depth layer distribution of the three-dimensional ocean scalar field data to record the depth interval between each depth layer and its adjacent layers; wherein, the voxel scalar value is the value of each voxel in the three-dimensional ocean scalar field data; S2. For each pixel to be rendered in the rendering viewport, a ray is projected from the viewpoint along the position direction of the pixel in three-dimensional space. The projected ray passes through the bounding box generated by the three-dimensional ocean scalar field data and is sampled step by step along the ray path with an adaptive sampling step size. The sampling step size is dynamically adjusted according to the depth interval corresponding to the current sampling point in the one-dimensional depth interval texture. The value of each sampling point is the corresponding scalar value sampled from the pseudo three-dimensional data texture. S3. The scalar values sampled in S2 are mapped to color values and opacity values by a pre-designed transfer function. The color values and opacity values of all sampled points are accumulated along the ray path to calculate the final color of the pixel. After obtaining the final colors of all pixels in the rendering viewport, the volume rendering image corresponding to the rendering viewport is formed, thus completing the volume rendering.
[0010] Based on the above scheme, each step can be implemented in the following preferred manner.
[0011] As a preferred embodiment of the first aspect, the step of creating a pseudo-3D data texture in S1 is achieved by calling the WebGL texImage3D function in the shader to load the 3D ocean scalar field data into the texture object of the graphics processor.
[0012] As a preferred embodiment of the first aspect described above, step S2 is executed in real time on the graphics processor via a programmable fragment shader.
[0013] As a preferred embodiment of the first aspect, in step S2, the sampling step size is dynamically adjusted based on the following process: querying the depth interval obtained from the one-dimensional depth interval texture, calculating the sine value of the angle between the first vector and the second vector, calculating the product of the depth interval and the sine value, and using the ratio of the product to the preset sampling density factor as the sampling step size; wherein, the first vector is the direction vector of the light ray, and the second vector is the unit vector in the vertical direction of the three-dimensional ocean scalar field data.
[0014] As a preferred embodiment of the first aspect mentioned above, the sampling density factor is dynamically adjusted based on the rate of change of the numerical values of the three-dimensional ocean scalar field data between depth layers, and the rate of change of the numerical values is positively correlated with the sampling density factor.
[0015] As a preferred embodiment of the first aspect, in step S3, the specific method for obtaining the color value and opacity value of the current sampling point from the transfer function is as follows: First, the skewness coefficient is calculated based on the numerical distribution characteristics of the three-dimensional ocean scalar field data. When the skewness coefficient is negative, the nonlinear factor is set to a value greater than 1. When the skewness coefficient is positive, the nonlinear factor is set to a value between 0 and 1. Then, the scalar value of the current sampling point is normalized from the maximum scalar value. Based on the nonlinear factor, the normalized scalar value is nonlinearly mapped. The mapped scalar value is then sampled in a pre-constructed color lookup table to obtain the color value and opacity value of the current sampling point.
[0016] As a preferred embodiment of the first aspect, the specific process of nonlinear mapping of the normalized scalar value based on the nonlinear factor is as follows: the nonlinear factor is used as an exponent, the normalized scalar value is exponentially multiplied by the maximum scalar value to obtain the mapped scalar value.
[0017] As a preferred embodiment of the first aspect, the transfer function is also used to extract specific three-dimensional feature structures within the region of interest. By setting the opacity corresponding to the scalar values within the region of interest to [0.7,1] and the opacity corresponding to the scalar values outside the region of interest to [0,0.3], visualization of the region of interest is achieved.
[0018] In a second aspect, the present invention provides a volume rendering system for non-uniform ocean scalar field data, comprising: The data acquisition module is used to acquire three-dimensional ocean scalar field data with non-uniform depth layer distribution, create pseudo-three-dimensional data textures based on the three-dimensional ocean scalar field data to store voxel scalar values, and create one-dimensional depth interval textures based on the depth layer distribution of the three-dimensional ocean scalar field data to record the depth interval between each depth layer and its adjacent layers; wherein, the voxel scalar value is the value of each voxel in the three-dimensional ocean scalar field data; The volume rendering module is used to project light rays from the viewpoint along the position direction of the pixel in three-dimensional space for each pixel to be rendered in the rendering viewport. The projected light rays pass through the bounding box generated by the three-dimensional ocean scalar field data and are sampled step by step along the light ray path with an adaptive sampling step size. The sampling step size is dynamically adjusted according to the depth interval corresponding to the current sampling point in the one-dimensional depth interval texture. The value of each sampling point is the corresponding scalar value sampled from the pseudo three-dimensional data texture. The visual enhancement module maps the sampled scalar values to color and opacity values using a pre-designed transfer function. It accumulates the color and opacity values of all sampled points along the ray path, calculates the final color of the pixel, and after obtaining the final colors of all pixels within the rendering viewport, forms the volume rendering image corresponding to the rendering viewport, thus completing the volume rendering.
[0019] Thirdly, the present invention provides a computer electronic device, which includes a memory and a processor; The memory is used to store computer programs; The processor is configured to, when executing the computer program, implement the volume rendering method for non-uniform ocean scalar field data as described in any of the embodiments of the first aspect above.
[0020] Compared with the prior art, the present invention has the following advantages: 1. Improve rendering efficiency and image quality: By introducing a step sampling algorithm based on the adaptive step size of data depth distribution, this invention avoids redundant calculations in sparse data areas while ensuring sampling accuracy in dense data areas. It effectively solves the contradiction between efficiency and quality in traditional equal-interval sampling methods when processing non-uniform data, and significantly improves rendering frame rate and image detail performance.
[0021] 2. Enhanced data visualization: By adopting a nonlinear color mapping method based on data statistical features, this invention can stretch the color distribution of key numerical ranges, effectively avoiding the problem of visual over-drawing, and making the spatial distribution characteristics, changing trends and abnormal structures (such as thermoclines, cold and warm vortices, etc.) of the data clear and intuitive.
[0022] 3. Improved Web applicability: By constructing pseudo-3D textures and custom shaders, this invention successfully deployed complex volume rendering algorithms on the web, providing a complete and efficient technical solution for interactive visualization analysis of large-scale marine, meteorological, and other scientific data in a browser environment. Attached Figure Description
[0023] Figure 1 This is a flowchart of the steps of the method of the present invention; Figure 2This is a schematic diagram of the module composition of the system of the present invention; Figure 3 This is a schematic diagram of the hardware structure of the computer electronic device on which the embodiments of the present invention depend. Figure 4 This is a comparison chart of the frame rates of the algorithms in this embodiment of the invention; Figure 5 This is a statistical histogram of the sea surface temperature field dataset for the experimental area in this embodiment of the invention. Figure 6 This is a schematic diagram of the nonlinear mapping enhancement scheme results according to an embodiment of the present invention; Figure 7 This is a schematic diagram of marine anomaly region extraction according to an embodiment of the present invention; Figure 8 This is a visual schematic diagram of a special marine area according to an embodiment of the present invention. Detailed Implementation
[0024] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. Technical features in the various embodiments of the present invention can be combined accordingly without mutual conflict.
[0025] In the description of this invention, it should be understood that the terms "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first" and "second" may explicitly or implicitly include at least one of those features.
[0026] like Figure 1As shown, in a preferred embodiment of the present invention, a volume rendering method for non-uniform ocean scalar field data is provided. Specifically, this method can be used in fields such as marine science and weather forecasting to efficiently and accurately visualize large-scale, non-uniform three-dimensional ocean scalar field data. In marine scientific research, data such as sea surface temperature and salinity often exhibit non-uniform distribution across depths; for example, surface data is dense while deep data is sparse. Traditional volume rendering methods use fixed, equally spaced sampling. When processing such data, they are either inefficient due to redundant sampling in sparse areas or lose details due to insufficient sampling in dense areas. Furthermore, linear color mapping struggles to highlight key data features. The volume rendering method provided by this invention can adaptively adjust the rendering strategy according to the data's inherent distribution characteristics, resolving the contradiction between rendering efficiency and image quality, and significantly enhancing visualization effects, providing strong technical support for scientific research and analysis.
[0027] It should be noted that, in this invention, "non-uniform data" refers to data points whose distribution intervals are unequal in at least one dimension, or whose rates of change in space are significantly non-uniform. This invention uses sea surface temperature data as an example, but it does not limit its application scope; it is equally applicable to other scalar field data with similar distribution characteristics.
[0028] The volume rendering method for non-uniform ocean scalar field data described above includes the following steps S1 to S3. The specific implementation process of each step will be described in detail below.
[0029] S1. Data Preparation: Acquire three-dimensional ocean scalar field data with a non-uniform depth layer distribution. Create a pseudo-three-dimensional data texture based on the three-dimensional ocean scalar field data to store voxel scalar values. Also create a one-dimensional depth interval texture based on the depth layer distribution of the three-dimensional ocean scalar field data to record the depth interval between each depth layer and its adjacent layers. Here, the voxel scalar value is the numerical value of each voxel in the three-dimensional ocean scalar field data.
[0030] It should be noted that the "scalar field data" mentioned in this invention refers to a dataset where each point in three-dimensional space corresponds to a scalar value. This scalar value is non-directional, and examples include temperature, density, pressure, and chemical concentration. This invention uses ocean temperature field data as an example to illustrate the above method, but the method is not limited to this. The term "non-uniform depth layer distribution" specifically refers to the fact that the sampling layers in the depth (or vertical) dimension of the data are not equidistant. This is very common in ocean observation and model data. For example, in surface waters, there may be a data layer every 2 meters, while in deep water areas below 500 meters, there may be a data layer every 100 meters or even further. The ultimate goal of this step is to convert the diverse and structurally complex raw data (three-dimensional ocean scalar field data) into two highly optimized textures (data structures) suitable for parallel computing by graphics processing units (GPUs), laying the foundation for subsequent real-time volume rendering.
[0031] It should be noted that the step of creating pseudo-3D data texture in S1 of this invention is achieved by calling the WebGL texImage3D function in the shader to load the 3D ocean scalar field data into the texture object of the graphics processor (GPU).
[0032] In an embodiment of the present invention, step S1 can be implemented by a background data processing program that provides an interface or graphical user interface (GUI) for the user to input the path to the original three-dimensional ocean scalar field data file and specify the output path. Taking the processing of a NetCDF format ocean temperature dataset as an example, the specific process of this step is as follows: S11. Data reading and information extraction.
[0033] The program uses the netCDF4 library in Python to open the user-specified .nc file. First, it parses the file's metadata to determine the names of the scalar field variables, dimensional information (such as lon, lat, depth), and the coordinate axis data for each dimension. Then, it reads the core three-dimensional temperature data block and the specific depth value list for each depth layer (such as [2.0, 5.0, 10.0,..., 1000.0, 2000.0] meters) into memory.
[0034] S12, Data cleaning and normalization.
[0035] The program iterates through the input 3D temperature data array. First, invalid values are identified and processed. Invalid data points often appear in ocean data due to land obstruction or sensor malfunctions; these points are typically marked with specific padding values or NaN in the data file. The program replaces all these invalid values with 0. Second, to map the temperature values to the [0, 1] range suitable for texture storage and shader calculations, the program iterates through the entire dataset to find the actual maximum and minimum temperature values. Then, for each valid temperature value T, a linear normalization formula is applied for calculation. Finally, a clean 3D floating-point array (i.e., a 3D normalized temperature array) is obtained, where all values are within the [0, 1] interval.
[0036] S13. Generate the texture data required for rendering.
[0037] In GPU rendering, textures are an efficient data storage and access structure. This step will generate two key texture data types and save them in a format that the GPU can easily read (such as a binary file or a PNG image).
[0038] 1. Pseudo-3D Data Texture: This is the core for storing voxel scalar values. Since it will ultimately be rendered in an environment supporting WebGL 2.0, a 3D data structure can be directly created. The 3D normalized temperature array obtained in S12 is flattened into a 1D array using a row-first, column-first, layer-by-layer approach. This 1D array will serve as the source data for the pseudo-3D data texture.
[0039] 2. One-Dimensional Depth-Interval Texture: This is crucial for achieving adaptive sampling. Using the specific depth value list extracted from S11 for each depth layer, the interval between every two adjacent depth layers is calculated, forming a one-dimensional array, such as [3.0, 5.0, ..., 1000.0]. Since the interval values vary widely, directly storing them in a standard 8-bit image channel would result in significant precision loss. Therefore, a high-precision encoding scheme is adopted: for each interval value, it is decomposed into two 8-bit integers. For example, high_byte = floor(interval / 256), low_byte = interval % 256. These high and low byte pairs are then interleaved and stored in an array. This array will serve as the source data for the one-dimensional depth-interval texture.
[0040] The two source data arrays mentioned above are ultimately written to files for loading by the front-end application. In the front-end application, these two arrays are loaded and created as TEXTURE objects in the GPU by calling the underlying WebGL API. This approach, which places complex preprocessing on the back end and the front end is only responsible for loading the optimized textures, is a common strategy for achieving high-performance visualization on the web.
[0041] S2, Adaptive Ray Casting: For each pixel to be rendered in the rendering viewport, a ray is cast from the viewpoint along the direction of the pixel's position in 3D space. The cast ray passes through the bounding box generated by the 3D ocean scalar field data and is sampled step by step along the ray path with an adaptive sampling step size. The sampling step size is dynamically adjusted according to the depth interval corresponding to the current sampling point in the 1D depth interval texture. The value of each sampling point is the corresponding scalar value sampled from the pseudo 3D data texture.
[0042] It should be noted that this step is the core of the method of this invention, and it is executed in real time on a graphics processing unit (GPU) through a programmable fragment shader. For each frame of the rendered image, the algorithm is executed in parallel once for each pixel in the viewport, thereby efficiently generating the final volumetric rendered image. The "adaptive" characteristic of the algorithm is reflected in the fact that its sampling step size is not fixed, but dynamically adjusted according to the one-dimensional depth interval texture prepared in S1 to match the non-uniform distribution characteristics of the data in the depth dimension.
[0043] It should be noted that step S2 is executed in real time on the graphics processing unit (GPU) via a programmable fragment shader.
[0044] It should be noted that in step S2, the dynamic adjustment process of the sampling step size is as follows: the depth interval is obtained by querying the one-dimensional depth interval texture, the sine value of the angle between the first vector and the second vector is calculated, the product of the depth interval and the sine value is calculated, and the ratio of the product to the preset sampling density factor is used as the sampling step size.
[0045] In this embodiment, the sampling step size Calculated based on the following formula: in, To retrieve the depth interval from a one-dimensional depth interval texture; The angle between the first vector and the second vector is the direction vector of the light ray, and the second vector is the unit vector perpendicular to the three-dimensional ocean scalar field data. This is a preset sampling density factor used to balance rendering efficiency and quality.
[0046] Furthermore, the sampling density factor is dynamically adjusted based on the rate of change of the three-dimensional ocean scalar field data between depth layers, and the rate of change of the data is positively correlated with the sampling density factor. That is, in areas where the data changes gradually, the rate of change of the data is small, so a smaller sampling density factor is used to increase the step size; in areas where the data changes drastically, the rate of change of the data is large, so a larger sampling density factor is used to decrease the step size.
[0047] In an embodiment of the present invention, for any pixel that needs to calculate color, the process of performing the adaptive ray casting step in the GPU is as follows: S21. Calculate the ray path.
[0048] First, based on the current pixel's 2D coordinates on the display screen and the camera parameters of the virtual Earth environment (such as camera position, projection matrix, and view matrix), the 2D coordinates of the current pixel on the display screen are converted into viewport coordinates. Then, the viewport coordinates are multiplied by the obtained projection matrix to obtain the coordinates after projection matrix transformation. Homogeneous division and the inverse transformation of the view matrix are then performed to generate world coordinates. Finally, a ray is calculated in the 3D world coordinate system, originating from the viewpoint (camera position) and passing through the center of the pixel. This ray can be represented by the parametric equation P(t) = RayOrigin + t * RayDirection, where RayOrigin is the origin of the ray, RayDirection is the direction of the ray, and t is a scalar parameter. The parametric equation generates all points on this ray by varying t. Next, the program calculates the intersection points of this ray with the 3D bounding box of the 3D ocean scalar field data. By solving the parametric equation of the ray and the equations of the six planes of the bounding box, two intersection points are obtained, denoted as EntryPoint and ExitPoint, respectively. These two points define the valid path segment for light rays to sample within the 3D ocean scalar field data. If the light ray does not intersect the bounding box, it means that the pixel does not contain 3D ocean scalar field data information, and the shader will terminate prematurely, directly outputting the background color.
[0049] S22. Initialize and start the step sampling loop with adaptive sampling step size.
[0050] In the shader, initialize a loop starting at EntryPoint. Define a variable currentPos to record the position of the current sampling point, with its initial value being EntryPoint. The loop terminates when currentPos exceeds ExitPoint, or when the cumulative opacity calculated in subsequent steps reaches a threshold (e.g., 0.99), indicating that the light has been completely blocked.
[0051] S23. Dynamically calculate the sampling step size.
[0052] In each iteration of the loop, the length of the next step is dynamically calculated based on the position of the current sampling point currentPos.
[0053] First, the depth coordinates (usually Z coordinates) of currentPos are converted into one-dimensional texture coordinates, which are then used to query the one-dimensional depth interval texture created in S1. The query operation returns a highly encoded value, which the shader program decodes to reconstruct the actual physical depth interval between the data layer at the current position and the layer below it.
[0054] Then, the sampling step size is calculated based on this depth interval. The calculation formula is as follows: In the formula, The angle between the ray direction vector and the unit vector perpendicular to the three-dimensional ocean scalar field data (e.g., (0,0,1)) can be obtained by vector dot product operation to obtain the cosine value, and then converted to obtain the sine value. This term is used to correct the step size for the viewing angle, ensuring that the projection spacing of sampling points in the depth direction maintains a suitable proportional relationship with the depth interval under a tilted viewing angle. Parameters This is a preset floating-point number used as an adjustment factor for the sampling density. Its value is greater than 0. According to the Nyquist theorem, to avoid information loss, this factor is usually set to 2.0 or higher.
[0055] S24, Three-dimensional ocean scalar field data sampling.
[0056] After calculating the step size, advance the current sampling point by one step to obtain the position of the next sampling point: nextPos=currentPos+RayDirection*s Then, the world coordinates of nextPos are converted to texture coordinates of the pseudo-3D data texture (i.e., normalized to the [0,1] range). Using these texture coordinates, a 3D texture lookup is performed in the pseudo-3D data texture created in S1 (by calling the texture() or texture3D() function in GLSL) to obtain the normalized ocean scalar value corresponding to the sampling point.
[0057] S25, Iteration.
[0058] Assign nextPos to currentPos, then proceed to the next iteration of the loop, repeating steps S23 and S24 until the loop termination condition is met.
[0059] In this way, light travels rapidly with larger steps in the sparse deep-sea region, while it is finely sampled with smaller steps in the dense surface region. This significantly reduces the total number of samples while maintaining image quality, thus improving rendering efficiency.
[0060] S3. Color and Transparency Calculation: The scalar values sampled in S2 are mapped to color and opacity values by a pre-designed transfer function. The color and opacity values of all sampled points are accumulated along the ray path to calculate the final color of the pixel. After obtaining the final colors of all pixels in the rendering viewport, the volume rendering image corresponding to the rendering viewport is formed, thus completing the volume rendering.
[0061] It should be noted that this step is performed in the fragment shader, immediately following each sample of S2. Its core is the construction and application of an efficient transfer function. In volumetric rendering, the transfer function is crucial in determining the final image quality; it defines the mapping rules from raw data values to optical properties (color and opacity). For ocean data with uneven numerical distribution, traditional linear transfer functions map most data values to a very narrow area in the color lookup table, resulting in monotonous colors, poor gradation, and an inability to effectively distinguish important scientific features, causing visual "over-drawing." This invention addresses this problem through a non-linear color mapping enhancement method.
[0062] It should be noted that in step S3, the specific method for obtaining the color value and opacity value of the current sampling point from the transfer function is as follows: First, the skewness coefficient is calculated based on the numerical distribution characteristics of the three-dimensional ocean scalar field data. When the skewness coefficient is negative, a nonlinear factor is set. The value of is a number greater than 1. When the skewness coefficient is positive, a nonlinear factor is set. The value is a number between 0 and 1. Then, the scalar value of the current sampling point is normalized by the maximum scalar value. The normalized scalar value is nonlinearly mapped based on the nonlinear factor. The mapped scalar value is then sampled in a pre-built color lookup table to obtain the color value and opacity value of the current sampling point.
[0063] Furthermore, the specific process of nonlinearly mapping the normalized scalar value based on the nonlinear factor is as follows: using the nonlinear factor as an exponent, the normalized scalar value is exponentially raised and then multiplied by the maximum scalar value to obtain the mapped scalar value. in, Represents the mapped scalar value; Indicates the maximum scalar value; This represents the scalar value obtained from the sampling.
[0064] In an embodiment of the present invention, the calculation process for the color and opacity of any sampling point is as follows: S31, Enhancement of nonlinear mapping.
[0065] First, in the data preprocessing stage of S1, the numerical distribution of the entire dataset is statistically analyzed, and its skewness coefficient is calculated. Skewness describes the asymmetry of the data distribution. According to the experiment of this invention, the skewness value of the sea surface temperature dataset in a certain East China Sea area is -3.885, showing a significant negative skewness, that is, a large amount of data is concentrated in the high-value area (high-temperature area). To address this statistical characteristic, a nonlinear mapping function is applied in the fragment shader for nonlinear transformation. Specifically, a suitable nonlinear factor is first selected based on the sign of the skewness value. If the skewness is negative, then take... (In this embodiment, 2.0 is used); if it is positive, then take... Then, the normalized scalar values obtained from sampling in S24 are... The following nonlinear mapping function is applied for transformation: Here, pow represents the aforementioned nonlinear mapping function, which can effectively "stretch" the dynamic range of the data distribution. For negatively skewed data, it expands the numerical range of the high-value region, and for positively skewed data, it expands the numerical range of the low-value region to enhance the visual distinguishability of the data.
[0066] Furthermore, in this embodiment, a power function is used as the aforementioned nonlinear mapping function to normalize the scalar value. The specific form of applying this function is as follows: in, This represents the largest scalar value; Represents the scalar value before normalization; This represents the scalar value after nonlinear mapping.
[0067] S32, Obtain optical properties.
[0068] The mapped_value obtained from S31 is used as texture coordinates and sampled in a predefined color lookup table, which is uploaded to the GPU as a one-dimensional texture. For example, a color spectrum from blue (representing low temperature) to red (representing high temperature) can be used. Through texture sampling, the color sample_color (a vector containing R, G, and B components) and the opacity sample_opacity (a scalar) corresponding to the current sampling point can be obtained.
[0069] S33, Color Accumulation.
[0070] In the stepping loop of S2, a standard "front-to-back" composition algorithm is used to accumulate colors. Two accumulation variables are defined in the shader: the final color `final_color` (initially set to (0,0,0,0)) and the accumulated opacity `accumulated_alpha` (initially set to 0). In each iteration, after obtaining the currently sampled color `sample_color` and the currently sampled opacity `sample_opacity`, they are updated according to the following formula: final_color=final_color+sample_color*sample_opacity*(1.0-accumulated_alpha) accumulated_alpha=accumulated_alpha+sample_opacity*(1.0-accumulated_alpha) This process simulates the attenuation and superposition effects of light passing through a semi-transparent medium. The loop continues until the light reaches the exit point, or the value of accumulated_alpha approaches 1.0, at which point the loop can be terminated early to save computational resources. The final_color obtained after the loop ends is the final color of the current pixel.
[0071] It should also be noted that the transfer function in step S3 of this invention is also used to extract specific three-dimensional feature structures within the region of interest. By setting the opacity corresponding to the scalar value within the region of interest to [0.7,1] and the opacity corresponding to the scalar value outside the region of interest to [0,0.3], visualization of the region of interest is achieved.
[0072] In this embodiment, by carefully designing the opacity portion of the transfer function in S32, the extraction of specific three-dimensional feature structures can be achieved. To extract high-temperature anomaly areas on the sea surface, the alpha channel value (i.e., opacity) of pixels corresponding to high-temperature values (e.g., mapped_value in the range [0.9, 1.0]) can be set to a higher value in the transfer function (color lookup table), while the alpha channel values for all other value ranges can be set to 0 or a lower value (completely transparent or semi-transparent). Thus, during the color accumulation process in S303, only sampling points in the high-temperature region will contribute to the final color, thereby highlighting the local structures of interest in the rendering result.
[0073] In summary, this invention, through data preparation in S1, adaptive ray casting in S2, and nonlinear color mapping and accumulation in S3, forms a complete technical solution for high-performance, high-fidelity volume rendering of non-uniform data in a web environment. This invention solves the problem of organizing and accessing 3D data on the web by constructing pseudo-3D textures and depth-interval textures; it effectively resolves the efficiency and quality contradiction of traditional equal-interval sampling when processing non-uniform data through a step-sampling algorithm with adaptive sampling step size, significantly improving the rendering frame rate; and it greatly enhances the visualization effect through a nonlinear color mapping enhancement method based on data statistical characteristics, enabling the spatial distribution characteristics and abnormal structures of the data to be clearly and intuitively presented. This invention provides an innovative and efficient technical approach for interactive visualization analysis of large-scale marine, meteorological, and other scientific data in a browser environment.
[0074] To better demonstrate the specific implementation and technical effects of the present invention, the volume rendering method for non-uniform ocean scalar field data shown in steps S1 to S3 of the above preferred implementation is applied to a specific example.
[0075] Example The specific implementation process of the volume rendering method for non-uniform ocean scalar field data used in this embodiment is as described above and will not be repeated here.
[0076] This invention proposes a volume rendering method for non-uniform ocean scalar field data, aiming to effectively improve the rendering speed and image quality of non-uniform scalar field data in a 3D virtual Earth environment. The following experiments, using Cesium, a mainstream open-source 3D Earth platform, as an example, conducted experiments on a 3D sea surface temperature field dataset, including comparative tests of rendering efficiency and the improvement of visual effects by non-linear color mapping schemes. An example of a practical scientific research need is also provided.
[0077] 1. Rendering efficiency comparison test In this section, an experiment is designed to verify the effectiveness of the adaptive step sampling improvement algorithm, using frames per second (FPS) as the measurement standard for rendering efficiency. The client machine has 16GB of memory, an Intel Core i5-10300H processor running at 2.5GHz, and an NVIDIA GeForce RTX 2060 GPU. The experiment uses an equidistant sampling algorithm for comparison, and frame rate tests are performed on the first 10, 20, 30, and 40 layers of the same sea surface temperature dataset under the same viewpoint and with the same incident light conditions. The experimental results are as follows... Figure 4 As shown.
[0078] Overall, when the data layers are set to 10 and 20, the adaptive sampling algorithm slightly outperforms the equidistant sampling algorithm in frame rate tests. As the number of data layers increases, the adaptive step size algorithm becomes significantly more efficient than the equidistant sampling algorithm because the equidistant sampling algorithm generates a large amount of redundant sampling between data layers with large depth intervals.
[0079] To further quantify the performance improvement of the improved algorithm compared to traditional algorithms, this embodiment introduces specific statistical indicators. Based on the experimental data above, when the number of data layers is greater than 30, the adaptive step sampling algorithm improves the average frame rate by approximately 12%-28% compared to the equidistant sampling algorithm, meaning the rendering time is reduced by approximately 15%. This data intuitively demonstrates the superiority of the adaptive step sampling algorithm in the scenario of sea surface temperature data rendering.
[0080] 2. Non-linear color mapping Seawater temperature is a physical quantity characterizing the thermal state of seawater. Solar radiation and ocean-atmosphere heat exchange are two major factors affecting seawater temperature. In addition, ocean currents also have a significant impact on seawater temperature in localized areas. Surface seawater temperature decreases with depth, with more pronounced changes within 1000 meters. Within the seawater depth range of 100-200 meters, there exists a layer with a sharp drop in sea temperature between a thin layer of warm water at the surface and a thick layer of cold water below it; this is called the thermocline and is one of the key phenomena in oceanographic research.
[0081] This embodiment selected a portion of the East China Sea as the study area. Statistical data analysis yielded a data distribution frequency chart and the skewness of the dataset. Figure 5 In the histogram, the red and green vertical lines represent the positions of the median and mean of the dataset, respectively. Furthermore, using first to third-order raw moments, the skewness of the sea surface temperature dataset in the study area was calculated to be -3.885, indicating that the sea surface temperature distribution in the study area exhibits a significant negative skewness.
[0082] Because the sea surface temperature field in the study area exhibits a negatively skewed distribution, the nonlinear factor should be greater than 1.0. Finally, an nonlinear factor of 2.0 was used in the experiment to stretch the original attribute values of the sea surface temperature field and apply color mapping. For example... Figure 6 As shown in the left figure, in the case of linear color mapping, the color distribution of the volumetric rendered image is concentrated in a very small color range, losing the details of the spatial distribution characteristics of the sea surface temperature scalar field. Figure 6 The right image in the image is the image after nonlinear mapping enhancement. Compared with the linear mapping result, the volume rendering result image is stretched to a wider color range, and the spatial distribution characteristics of the sea surface temperature field are better revealed through color changes.
[0083] 3. Extraction of three-dimensional feature structures of the ocean The transfer function is the most crucial part of the ray casting algorithm. In constructing the transfer function of this algorithm, a nonlinear color mapping strategy can be used to enhance the overall rendering effect of the ocean scalar field. Furthermore, appropriately designed transfer functions can enable the extraction of local feature structures in the study area: regions of interest in the sea surface temperature data are given low transparency, while other irrelevant regions can be displayed semi-transparent or even fully transparent.
[0084] Sea surface temperatures generally decrease gradually from low latitudes to high latitudes. In localized sea areas, ocean currents and eddies can cause regional anomalies in sea surface temperature distribution. For example, the South China Sea and its surrounding waters are influenced by the Kuroshio Current, and the shedding of mesoscale eddies from the Kuroshio Current can cause localized thermal anomalies. Therefore, this embodiment designs an experiment to extract sea surface temperature anomalies in the study area. First, for the sea surface temperature dataset, the experiment sets low transparency for the sea surface temperature range [0.95, 1.0] and sets the data in other ranges to transparent, thus achieving the extraction of localized hydrothermal regions, such as... Figure 7 As shown, hydrothermal zones are mainly concentrated in low-latitude regions, indicating that latitude is a major influencing factor on surface sea surface temperature. For the simulation dataset, two low-temperature spherical regions can be pre-constructed to represent anomalous low-temperature structures in certain areas of the seawater, and then a higher opacity can be set for the low-temperature regions in the transfer function. For example... Figure 8 As shown, two blue spherical regions are clearly visible in the results. This also demonstrates that volume rendering can better visualize certain special regions or structures in the deep sea.
[0085] It should also be noted that the volume rendering method for non-uniform ocean scalar field data in the above embodiments can essentially be executed by a computer program or module. Therefore, similarly, based on the same inventive concept, another preferred embodiment of the present invention also provides a volume rendering system for non-uniform ocean scalar field data corresponding to the volume rendering method for non-uniform ocean scalar field data provided in the above embodiments, such as... Figure 2 As shown, it includes: The data acquisition module is used to acquire three-dimensional ocean scalar field data with non-uniform depth layer distribution, create pseudo-three-dimensional data textures based on the three-dimensional ocean scalar field data to store voxel scalar values, and create one-dimensional depth interval textures based on the depth layer distribution of the three-dimensional ocean scalar field data to record the depth interval between each depth layer and its adjacent layers; wherein, the voxel scalar value is the value of each voxel in the three-dimensional ocean scalar field data; The volume rendering module is used to project light rays from the viewpoint along the position direction of the pixel in three-dimensional space for each pixel to be rendered in the rendering viewport. The projected light rays pass through the bounding box generated by the three-dimensional ocean scalar field data and are sampled step by step along the light ray path with an adaptive sampling step size. The sampling step size is dynamically adjusted according to the depth interval corresponding to the current sampling point in the one-dimensional depth interval texture. The value of each sampling point is the corresponding scalar value sampled from the pseudo three-dimensional data texture. The visual enhancement module maps the sampled scalar values to color and opacity values using a pre-designed transfer function. It accumulates the color and opacity values of all sampled points along the ray path, calculates the final color of the pixel, and after obtaining the final colors of all pixels within the rendering viewport, forms the volume rendering image corresponding to the rendering viewport, thus completing the volume rendering.
[0086] Similarly, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer electronic device corresponding to the volume rendering method for non-uniform ocean scalar field data provided in the above embodiments, such as... Figure 3 As shown, it includes a memory and a processor; The memory is used to store computer programs; The processor is configured to implement the volume rendering method for non-uniform ocean scalar field data in the above embodiments when executing the computer program.
[0087] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0088] It is understood that the processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0089] It should also be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the system described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. In the embodiments provided in this application, the division of steps or modules in the system and method is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple modules or steps may be combined or integrated together, and a module or step may also be split.
[0090] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the invention. Therefore, all technical solutions obtained through equivalent substitution or transformation fall within the protection scope of the present invention.
Claims
1. A volume rendering method for non-uniform ocean scalar field data, characterized in that, Includes the following steps: S1. Acquire three-dimensional ocean scalar field data with non-uniform depth layer distribution, create a pseudo-three-dimensional data texture based on the three-dimensional ocean scalar field data to store voxel scalar values, and create a one-dimensional depth interval texture based on the depth layer distribution of the three-dimensional ocean scalar field data to record the depth interval between each depth layer and its adjacent layers; wherein, the voxel scalar value is the value of each voxel in the three-dimensional ocean scalar field data; S2. For each pixel to be rendered in the rendering viewport, a ray is projected from the viewpoint along the position direction of the pixel in three-dimensional space. The projected ray passes through the bounding box generated by the three-dimensional ocean scalar field data and is sampled step by step along the ray path with an adaptive sampling step size. The sampling step size is dynamically adjusted according to the depth interval corresponding to the current sampling point in the one-dimensional depth interval texture. The value of each sampling point is the corresponding scalar value sampled from the pseudo three-dimensional data texture. S3. The scalar values sampled in S2 are mapped to color values and opacity values by a pre-designed transfer function. The color values and opacity values of all sampled points are accumulated along the ray path to calculate the final color of the pixel. After obtaining the final colors of all pixels in the rendering viewport, the volume rendering image corresponding to the rendering viewport is formed, thus completing the volume rendering of the three-dimensional ocean scalar field data.
2. The volume rendering method for non-uniform ocean scalar field data as described in claim 1, characterized in that, The step of creating pseudo-3D data texture in S1 is achieved by calling the WebGL texImage3D function in the shader to load 3D ocean scalar field data into the texture object of the graphics processor.
3. The volume rendering method for non-uniform ocean scalar field data as described in claim 1, characterized in that, Step S2 is executed in real time on the graphics processor via a programmable fragment shader.
4. The volume rendering method for non-uniform ocean scalar field data as described in claim 1, characterized in that, In step S2, the sampling step size is dynamically adjusted based on the following process: the depth interval is obtained by querying the one-dimensional depth interval texture, the sine value of the angle between the first vector and the second vector is calculated, the product of the depth interval and the sine value is calculated, and the ratio of the product to the preset sampling density factor is used as the sampling step size; wherein, the first vector is the direction vector of the light ray, and the second vector is the unit vector in the vertical direction of the three-dimensional ocean scalar field data.
5. The volume rendering method for non-uniform ocean scalar field data as described in claim 4, characterized in that, The sampling density factor is dynamically adjusted based on the rate of change of the numerical values of the three-dimensional ocean scalar field data between depth layers, and the rate of change of the numerical values is positively correlated with the sampling density factor.
6. The volume rendering method for non-uniform ocean scalar field data as described in claim 1, characterized in that, In step S3, the specific method for obtaining the color value and opacity value of the current sampling point from the transfer function is as follows: First, the skewness coefficient is calculated based on the numerical distribution characteristics of the three-dimensional ocean scalar field data. When the skewness coefficient is negative, the nonlinear factor is set to a value greater than 1. When the skewness coefficient is positive, the nonlinear factor is set to a value between 0 and 1. Then, the scalar value of the current sampling point is normalized from the maximum scalar value. Based on the nonlinear factor, the normalized scalar value is nonlinearly mapped. The mapped scalar value is then sampled in a pre-built color lookup table to obtain the color value and opacity value of the current sampling point.
7. The volume rendering method for non-uniform ocean scalar field data as described in claim 6, characterized in that, The specific process of nonlinear mapping of normalized scalar values based on nonlinear factors is as follows: the nonlinear factor is used as an exponent, the normalized scalar value is exponentially multiplied by the maximum scalar value to obtain the mapped scalar value.
8. The volume rendering method for non-uniform ocean scalar field data as described in claim 1, characterized in that, The transfer function is also used to extract specific 3D feature structures within the region of interest. By setting the opacity of the scalar values within the region of interest to [0.7, 1] and the opacity of the scalar values outside the region of interest to [0, 0.3], the region of interest can be visualized.
9. A volume rendering system for non-uniform ocean scalar field data, characterized in that, include: The data acquisition module is used to acquire three-dimensional ocean scalar field data with non-uniform depth layer distribution, create pseudo-three-dimensional data textures based on the three-dimensional ocean scalar field data to store voxel scalar values, and create one-dimensional depth interval textures based on the depth layer distribution of the three-dimensional ocean scalar field data to record the depth interval between each depth layer and its adjacent layers; wherein, the voxel scalar value is the value of each voxel in the three-dimensional ocean scalar field data; The volume rendering module is used to project light rays from the viewpoint along the position direction of the pixel in three-dimensional space for each pixel to be rendered in the rendering viewport. The projected light rays pass through the bounding box generated by the three-dimensional ocean scalar field data and are sampled step by step along the light ray path with an adaptive sampling step size. The sampling step size is dynamically adjusted according to the depth interval corresponding to the current sampling point in the one-dimensional depth interval texture. The value of each sampling point is the corresponding scalar value sampled from the pseudo three-dimensional data texture. The visual enhancement module maps the sampled scalar values to color and opacity values using a pre-designed transfer function. It accumulates the color and opacity values of all sampled points along the ray path, calculates the final color of the pixel, and after obtaining the final colors of all pixels within the rendering viewport, forms the volume rendering image corresponding to the rendering viewport, thus completing the volume rendering.
10. A computer electronic device, characterized in that, Including memory and processor; The memory is used to store computer programs; The processor is configured to, when executing the computer program, implement the volume rendering method for non-uniform ocean scalar field data as described in any one of claims 1 to 8.