Non-uniform cuboid grid adaptive sampling volume drawing method based on GPU acceleration

Through GPU multi-threading and three-dimensional texture hardware technology, adaptive sampling and trilinear interpolation of non-uniform rectangular mesh are achieved, solving the problem of difficult to take into account the efficiency and accuracy of non-uniform mesh Ray Casting body drawing in the existing technology, significantly improving the Computational efficiency and data feature integrity are maintained.

CN119047261AActive Publication Date: 2024-11-29XIAN YUSHENSUAN SECURITY TECHNOLOGY CO LTD

Patent Information

Application Number
CN202411163839.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-11-29
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

In the prior art, when visualizing the Ray Casting body of a non-uniform rectangular mesh, it is difficult to take into account both accuracy and efficiency. The adaptive sampling method is complex to calculate and cannot fully utilize GPU hardware acceleration.

Method used

Adopting GPU multi-threaded computing and three-dimensional texture hardware interpolation technology, through data bounding box rendering and ray intersection sorting, the adaptive sampling point position calculation of the non-uniform cuboid mesh is realized, and trilinear interpolation is used for GPU three-dimensional texture hardware, combined with Alpha fusion The operator generates visual results.

Benefits of technology

The Ray Casting volume drawing efficiency of non-uniform cuboid mesh data is improved, ensuring the integrity of data characteristics and the improvement of computational efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119047261A_ABST
    Figure CN119047261A_ABST
Patent Text Reader

Abstract

The invention discloses a non-uniform cuboid grid adaptive sampling volume drawing method based on GPU acceleration, which comprises the following steps: firstly, generating a sampling ray set of a non-uniform cuboid grid based on data bounding box rendering and GPU multi-thread calculation, then calculating an intersection point of each ray and a grid unit surface, and determining an adaptive sampling point coordinate position; and then storing the non-uniform cuboid grid data in a three-dimensional texture memory of a GPU in a normalization mode, performing texture hardware query by using the weighted and corrected adaptive sampling point coordinates to obtain a trilinear interpolation result scalar value at the sampling point, and finally, calculating the color and transparency corresponding to the sampling point according to a transfer function to obtain the three-dimensional texture data of the GPU. And correct color synthesis of all sampling points on the rays is realized by using an Underer operator in Alpha fusion, and finally a visual result image is formed. Experimental results show that the Ray Casting volume rendering calculation efficiency of the non-uniform cuboid grid can be effectively improved, and the visual analysis calculation process of the non-uniform cuboid grid is accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of mechanical finite element calculation and electromagnetic simulation technology, particularly in the research of three-dimensional scientific data volume rendering visualization. The present invention uses GPU multithreading and three-dimensional texture hardware interpolation technology to quickly obtain scalar field values ​​of ray adaptive sampling point positions in non-uniform rectangular parallelepiped grids, thereby realizing efficient adaptive sampling Ray Casting volume rendering visualization of non-uniform rectangular parallelepiped grid data. Background Art

[0002] Ray Casting volume rendering method is a three-dimensional visualization technology. This method directly emits rays from the viewpoint to the data volume, and samples data on the ray path to obtain color accumulation to form a two-dimensional image visualization technology. The advantage of this method is that it can directly generate the result image from the original volume data without generating intermediate geometric results, and the visualization efficiency is higher. In addition, the Ray Casting method can directly reflect the internal structural characteristics of complex data by adjusting the translucency parameters, and can clearly show the detailed characteristics of the structure in the data body, which is more intuitive. The disadvantage of this method is that the amount of calculation is large, and sampling and calculating the volume data will consume a lot of computing power. Therefore, in practical applications, acceleration hardware such as GPU is often used to implement this algorithm to improve computing efficiency and achieve real-time interactive visualization.

[0003] Non-uniform cuboid grids are usually used in numerical simulation fields such as three-dimensional finite element calculations and three-dimensional electromagnetic field calculations. This type of grid is composed of cuboid units and is a three-dimensional extension of a two-dimensional non-uniform rectangular grid. The characteristic of this type of grid is that the topological structure is the same as that of a three-dimensional regular grid, both of which are structured rectangular hexahedral grids. The difference is that the spacing between adjacent parallel planes of the non-uniform cuboid grid varies non-uniformly, and the density of parallel planes can be adjusted according to the regional calculation accuracy. This flexibility makes non-uniform grids more effective than uniform grids when dealing with complex geometric shapes or drastically changing physical phenomena. Therefore, in terms of numerical simulation efficiency, the use of non-uniform cuboid grids is often more efficient than uniform structured grids.

[0004] Although the non-uniform cuboid mesh is similar to the three-dimensional regular mesh in topology, there are significant differences in visualization. At present, there are generally two methods for Ray Casting volume rendering visualization of non-uniform cuboid meshes. The first method is the resampling method, that is, uniformly resampling the non-uniform cuboid mesh, interpolating the original non-uniform mesh to generate a uniform regular mesh, and then loading the uniform mesh into the GPU for visualization. The main problem with this method is that it is difficult to balance accuracy and efficiency. When the uniform resampling interval is relatively sparse, the original non-uniform cuboid data may be skipped, resulting in data feature loss; when the resampling interval is relatively dense, it will cause problems such as too many sampling points and too much calculation, and the visualization efficiency is not high; the second method is the adaptive sampling method. This method adopts an adaptive sampling strategy according to the different densities of the non-uniform grid area, performs encrypted sampling on the dense grid and sparse sampling on the sparse grid area, so as to effectively keep the data features from being lost. Although the second method can effectively capture data features, due to the uneven density of the grid, more query and judgment operations are required to realize the adaptive sampling process compared to the uniform grid. The adaptive calculation process is complex and cannot be unified and accelerated with the help of GPU hardware, making it difficult to give full play to the computational advantages of the simple topological structure of the rectangular grid. Summary of the invention

[0005] The present invention proposes a non-uniform cuboid grid efficient adaptive sampling Ray Casting volume rendering method implemented on a GPU. Firstly, based on data bounding box rendering and GPU multi-threaded calculation, a sampling ray set of the non-uniform cuboid grid is generated and the position of the adaptive sampling point on each ray is calculated. Then, the three-dimensional texture hardware device of the GPU is used to calculate the scalar value of the trilinear interpolation result at the sampling point position after weighted correction in a hardware query manner. Finally, the color and transparency are calculated according to the transfer function, and the Under operator in Alpha fusion is used to realize the correct color synthesis of all sampling points on the ray, so as to finally form a visual result image.

[0006] To achieve the above object, the present invention adopts the following technical solutions:

[0007] (1) Read the non-uniform rectangular grid data, obtain the relevant attribute parameters of the grid data body, establish the world coordinate system with the minimum coordinate point of the grid data as the origin of the world coordinate system, and determine the scene parameters;

[0008] (2) Taking the viewpoint as the starting point of the sampling ray, the parametric equation of the effective sampling ray is determined according to the external contour of the data body and the projection area of ​​the visible surface on the viewing plane;

[0009] (3) Enable multithreading on the GPU. Each thread is responsible for processing a valid sampling ray and calculating the intersection points between the valid sampling ray and all mesh surfaces in the X, Y, and Z directions to obtain the intersection point sequence set E.

[0010] (4) Sort the intersection points on each ray in the set E from small to large according to the parameter t to obtain an ordered intersection point sequence set E';

[0011] (5) Based on the ordered intersection point set E', obtain the adaptive sampling point set S;

[0012] (6) Load the non-uniform cuboid mesh data into the GPU 3D texture memory, perform coordinate transformation on all sampling points in the set S, use the transformed coordinates as input parameters for 3D texture query, and obtain a trilinear interpolation result set V;

[0013] (7) Use the Under operator of the Alpha fusion algorithm to fuse the color values ​​and transparency values ​​sampled from near to far on each ray in the set V to obtain the final color of the pixel corresponding to the sampled ray, and finally form the output result image.

[0014] In the step (1), the relevant attribute parameters of the non-uniform cuboid grid data include the length dimensions (Lx, Ly, Lz) in the three directions of X, Y, and Z, and the number of grid points (Nx, Ny, Nz) in the three directions, and the relevant scene parameters include the viewpoint position coordinates, the viewing plane, the light source position, the illumination direction, and the result image resolution, etc.;

[0015] In step (2), the projection of the data volume on the viewing plane needs to be calculated based on the bounding box of the data volume to determine the valid pixels that need to be calculated on the viewing plane. The ray connecting the viewpoint and the valid pixels is the valid sampling ray. Assume that the viewpoint position is P(x p ,y p ,z p ), then the effective pixel point Q(x q ,y q ,z q )'s effective ray (Let Rn be the total number of effective pixels, 1≤i≤Rn) The parameter equation is expressed as:

[0016]

[0017] In step (3), each GPU thread is responsible for a sampling ray Related calculations, rays The intersection points of all mesh surfaces in the X, Y, and Z directions form a set E i , then the intersection point set formed by all rays and the data volume is E = {E i|E i is the set of intersections between the i-th valid ray and all mesh surfaces, 1≤i≤Rn}. Taking the two-dimensional case as an example, the ray determined by the viewpoint P and the valid pixel Q The intersection points of the mesh planes parallel to all axes in the data volume are marked with an "×" symbol. Find all the intersection points E ij and the ray parameter equation parameter t corresponding to the intersection point ij Construct an intersection set E, where 1≤i≤Rn, 1≤j≤Sn i , Sn i For rays The number of all sampling points.

[0018] In step (4), the intersection points on each ray in the intersection point set E are sorted, that is, the rays The corresponding intersection set E i Sort the elements in E. i Each intersection point E ij Each corresponds to a t in the parametric equation ij Value, t ij The value indicates the linear distance between the intersection point and the viewpoint P. ij Value pair E i By sorting the elements in the collection, we can get the ray The ordered intersection sequence set E′ from near to far from point P i .

[0019] In step (5), the sampling point set S = {S i |S i For rays All adaptive sampling points on}, S i It is E′ i Calculated, assuming that the ray There are two adjacent points E on ij (x ij ,y ij ,z ij ) and E i,j+1 (x i,j+1 ,y i,j+1 ,z i,j+1 ), then E ij With E i,j+1 Take a sampling point S between ij , S ij The coordinates can be expressed as Where 1≤j≤Sn i ,ray All sampling points S on ij The composition set S i . Because the adjacent mesh surface intersection point E ij With Ei,j+1 It must be the entry point and exit point of the ray passing through a certain grid unit, so the above sampling point selection strategy can ensure that the ray There is a sampling point for all mesh cells passed through, ensuring that the mesh data features are not lost during the sampling process.

[0020] In step (6), the mesh data needs to be loaded into the GPU 3D texture memory first to implement the subsequent fast trilinear interpolation. ij The scalar field value at the sampling point is calculated by trilinear interpolation of the eight unit vertices of the unit to which the sampling point belongs. Assume that the scalar values ​​at the eight grid points of the unit where the sampling point is located are v 000 ,v 001 ,…v 111 , then point S ij The calculation formula for the scalar value v is:

[0021] v=v 000 (1-x d )(1-y d )(1-z d )+v 100 x d (1-y d )(1-z d )+v 001 (1-x d )(1-y d ) d +v 101 x d (1-y d ) d +v 010 x d (1-y d )(1-z d )+v 110 x d y d (1-z d )+v 011 (1-x d )y d z d +v 111 x d y d z d

[0022] in (x0, y0, z0) and (x1, y1, z1) are the grid points V 000 and V 111Coordinate values. According to the hardware characteristics of the GPU 3D texture memory, when the mesh data is loaded into the 3D texture, the above trilinear interpolation calculation process can be efficiently completed by the hardware, but the hardware trilinear interpolation is only applicable to normalized regular grid units. In order to achieve correct trilinear interpolation of non-uniform rectangular grids on the GPU 3D texture memory, it is necessary to perform a mathematical transformation on the elements in the original sampling point set S. In the process of transforming the rectangular grid into a cubic grid unit, in order to ensure that the scalar value at the sampling point remains unchanged after the grid coordinate transformation, it is necessary to ensure that the relative proportional position of the sampling point in the grid unit remains unchanged. Assume that the number of grid points in the three dimensional directions are Nx, Ny and Nz respectively, the lengths of the grids in the three directions are Lx, Ly and Lz respectively, and the sampling points in the original grid Located in the [k1, k2, k3]th grid cell (k1, k2 and k3 are the subscript indices of the three-dimensional array), the corresponding sampling point after the grid transformation is Then the following equations must hold before and after the grid coordinate transformation:

[0023]

[0024] Since the three-dimensional texture coordinates in the GPU need to be normalized, Lx = Ly = Lz = 1.0, after simplifying the formula, we can get the sampling point S′ ij Coordinates for:

[0025]

[0026] S′ ij As a parameter to call the three-dimensional texture sampling function in the GPU, the sampling point S' can be quickly obtained ij The scalar value v′ at the position. From the previous discussion, we know that v=v′, so we can directly use v′ to query the transfer function and get S ij The color value and transparency value at the sampling point are obtained by performing the above trilinear interpolation steps in parallel in a multi-threaded manner to obtain a trilinear interpolation result set V corresponding to the sampling point set S.

[0027] In the above step (7), since the sampling points on all rays are sorted from small to large according to the parameter t, the sampling points on the rays can be directly fused using the Under operator in the Alpha fusion algorithm to obtain the final color value of the pixel corresponding to the ray. Since the color fusion process of each ray is independent of each other, this step is also completed in parallel using GPU multi-threading, and the resulting image is finally output.

[0028] Compared with the prior art, the present invention has the following two technical innovations:

[0029] 1. The present invention proposes a Ray Casting volume rendering adaptive sampling method on GPU for non-uniform rectangular grids. By using GPU multithreading technology, the intersection points of effective projection rays and all grid unit faces are first obtained, and then the midpoints of adjacent intersection points are used as adaptive sampling points for subsequent trilinear interpolation calculations. The adaptive sampling calculation method ensures that there are sampling points for each cell that the ray passes through, ensuring that data features are not lost due to excessive sampling steps, and effectively controls the amount of sampling calculations, avoiding repeated sampling of large-scale grids.

[0030] 2. The present invention proposes a series of coordinate transformation calculation methods, which realize fast trilinear interpolation calculation of non-uniform rectangular grid sampling points on GPU three-dimensional texture hardware, effectively improving the execution efficiency of RayCasting algorithm of non-uniform rectangular grid data. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 A schematic diagram of the principle of determining effective sampling rays by projection of a data bounding box on a viewing plane according to the present invention;

[0032] Figure 2 It is a schematic diagram of the two-dimensional situation of sampling of the non-uniform rectangular grid by effective rays in the present invention; Intersection with non-uniform grid unit surface (intersection points are marked with ×), adaptive sampling point S ij Located at the grid surface intersection point E ij 、E i,j+1 The midpoint of the line.

[0033] Figure 3 A two-dimensional array Array storing effective ray intersection points of the present invention E Structural diagram.

[0034] Figure 4 is the rectangular grid unit structure and sampling point S in the present invention ij The transformed cubic grid unit structure and sampling point S′ ij The original rectangular grid unit has a length, width and height of L1, L2 and L3 respectively, and after being transformed into a cubic grid unit, the edge length is L.

[0035] Figure 5 To verify the Ray Casting volume rendering results of the 4 test data in the experiment, the upper left, upper right, lower left and lower right figures are experimental data 1, data 2, data 3 and data 4 respectively. DETAILED DESCRIPTION

[0036] The specific implementation modes of the present invention are explained below.

[0037] The Ray Casting volume rendering algorithm of the present invention is implemented on the GPU using the CUDA programming model. Assuming that the data type of the non-uniform rectangular grid data B to be processed is 32-bit floating-point type scalar field data, the lengths of the grid data in the three directions of X, Y, and Z are (Lx, Ly, Lz), and the number of grid points in the three directions are (Nx, Ny, Nz), respectively. When the Ray Casting volume rendering process is performed on the data, the specific implementation method corresponding to each step of the content of the present invention is as follows:

[0038] (1) Read the non-uniform rectangular grid data B into the system memory and store it in a three-dimensional array of size [Nx, Ny, Nz]; apply for constant memory space on the GPU to store (Lx, Ly, Lz), (Nx, Ny, Nz) and the screen resolution R N The value of; take the minimum coordinate point of data B as the origin, transform the viewpoint position and the view plane, and store them in the requested CUDA global variable memory space. The viewpoint position coordinate P(x p ,y p ,z p ), the viewing plane normal and the viewing focus are stored as one-dimensional vectors, so that the viewport size matches the viewing plane resolution;

[0039] (2) According to the viewpoint and the viewing plane position, the data bounding box is rendered to obtain the projection area of ​​the data bounding box on the viewing plane. The line connecting the viewpoint coordinates and the coordinates of all pixels in the projection area is the total valid sampling ray. The relationship between the viewpoint, the viewing plane, the data bounding box projection and the valid sampling ray is as follows: Figure 1 Assume that the coordinates of a valid pixel point in the projection area are Q(x q ,y q ,z q ), then the effective ray The parametric equation expression is:

[0040]

[0041] Assume that the total number of pixels in the projection area is Rn, then there are Rn ray parameter equations. Enable CUDA 2D thread grid on the GPU, and the thread grid size is That is, 128 threads are started in the specified CUDA thread block, for a total of A thread block is used to calculate the parametric equations of Rn valid sampling rays, and the expression form and coefficients of each ray parameter equation are stored in the CUDA global variable array;

[0042] (3) Enable CUDA 2D thread grid on the GPU (thread grid size is ), each thread is assigned to calculate the intersection of a valid ray with all mesh unit faces in the X, Y, and Z directions. For example, we need The grid unit faces for intersection calculation are the axis-parallel faces passing through all grid points in data B. A total of Nx+Ny+Nz faces need to be intersected. Find the intersection point (two-dimensional example Figure 2 shown), then The set of intersections with all unit faces of B is E i , the set of intersection points of all valid rays and grid unit surfaces is E = {E i |E i is the set of intersections between the i-th valid ray and all mesh surfaces, 1≤i≤Rn}. During the implementation, a two-dimensional array Array of size [Rn, Nxyz] is dynamically requested in the GPU global storage. E It is used to store E (it is easy to prove that the number of intersection points between the ray and the grid unit surface does not exceed Nx+Ny+Nz, so the maximum value of the second dimension of the array is set to Nxyz=Nx+Ny+Nz). Each element of the array is the coordinate value of an intersection point and the parameter t of the ray parameter equation corresponding to the intersection point. When the ray passes through the data body, Array E The built-in parameter t for the intersection position of the subsequent vacancies in the array is 2 127 (maximum single-precision floating point value), indicating that the array element is not an intersection point. The two-dimensional array Array corresponding to the intersection set E E Structure Figure 3 As shown, Array E The i-th column set corresponds to the ray The set of all intersection points E i , where E ij is the coordinate of the jth intersection point of the i-th ray, t ij are the parameters of the ray equation at the intersection point (1≤i≤Rn, 1≤j≤Nxyz);

[0043] (4) Sort the intersection points on each ray in the set E from small to large by parameter t, that is, sort the array Array E Each column of is sorted from small to large according to the parameter t. From the meaning of the ray parameter equation, we can know that the ray intersection E ij The corresponding parameter t ij , represents E ij The distance from the ray origin (viewpoint), t ij The larger the value, the ij The farther away from the viewpoint, the intersection point set E corresponding to the i-th ray iSorting by parameter t will obtain an ordered sequence of intersection points on the ray from near to far, which is convenient for subsequent Alpha fusion operations. E Each column is used as input, and the Sort function in the Thrust library of CUDA is called, and the parameter t is specified as the sorting key value to sort the t value from small to large, and the updated array Array is obtained. E That is, the column-ordered intersection set E';

[0044] (5) Based on the column ordered intersection set E', obtain the adaptive sampling point set S, where S = {S i |S i For rays All adaptive sampling points on S}. i The calculation of E′ is i Calculated, assuming that the ray There are two adjacent points E on ij (x ij ,y ij ,z ij ) and E i,j+1 (x i,j+1 ,y i,j+1 ,z i,j+1 ), then E ij With E i,j+1 Take a sampling point S between ij The coordinates are Where 1≤j≤Sn i ,ray All sampling points S on ij The composition set S i . Because the adjacent mesh surface intersection point E ij With E i,j+1 It must be the entry point and exit point of the ray passing through a certain grid unit, so the above sampling point calculation method can ensure that the ray There is a sampling point for all grid cells passed through, ensuring that the grid data features are not lost during the sampling process. ij The selection and E ij 、E i,j+1 The position relationship is as follows Figure 2 shown.

[0045] When the program is implemented, the adaptive sampling point S is calculated according to ij The algorithm requires the application of CUDA two-dimensional global array Array S Used to store the sampling point coordinate set S, enable CUDA multi-threaded update array Array S The value of is updated as Where 1≤i≤Rn, 1≤j≤Nxyz-1. Note that in the process of calculating the sampling point, you need to first determine the Array E Is the t value of the element 2? 127 , if t value is 2 127 If the situation occurs, it means that the current sampling area has passed through the grid area, and the current sampling point coordinate Array needs to be terminated. S Calculation of [i,j];

[0046] (6) After calculating the coordinate set S of all valid sampling points, we start to use the sampling points to sample the data set B according to the Ray Casting volume rendering algorithm. The sampling process needs to be completed using trilinear interpolation. Assume that the sampling point S ij The scalar values ​​at the eight grid points of the unit are v 000 , v 001 …v 111 (like Figure 4 As shown), then point S ij The calculation formula for the scalar value v is:

[0047] v=v 000 (1-x d )(1-y d )(1-z d )+v 100 x d (1-y d )(1-z d )+v 001 (1-x d )(1-y d ) d +v 101 x d (1-y d ) d +v 010 x d (1-y d )(1-z d )+v 110 x d y d (1-z d )+v 011 (1-x d )y d z d +v 111 x d y d z d

[0048] in (x0, y0, z0) and (x1, y1, z1) are the grid points V 000and V 111 The coordinate value of .

[0049] According to the hardware characteristics of the GPU 3D texture memory, when the mesh data is loaded into the 3D texture, the above trilinear interpolation calculation process can be efficiently completed by hardware, but the hardware trilinear interpolation is only applicable to normalized regular grid units. In order to achieve the correct trilinear interpolation of the non-uniform rectangular grid on the GPU 3D texture memory, it is necessary to perform mathematical transformation on the elements in the original sampling point set S. In the process of transforming the rectangular grid into a cubic grid unit (such as Figure 4 To ensure that the scalar value at the sampling point remains unchanged after the grid coordinate transformation, the relative proportional position of the sampling point in the grid unit must remain unchanged. Assume that the sampling point Located in the [k1, k2, k3]th grid cell (k1, k2 and k3 are the subscript indices of the three-dimensional array), the corresponding sampling point after the grid transformation is Then the following equations must hold before and after the grid coordinate transformation:

[0050]

[0051] Since the three-dimensional texture coordinates in the GPU need to be normalized, we have Lx = Ly = Lz = 1.0. After simplifying the formula, we can get the sampling point S′ ij Coordinates for:

[0052]

[0053] S′ ij The coordinates of the 3D texture sampling function in the GPU are used as parameters to quickly obtain the sampling point S′ ij The scalar value v′ at the position. From the previous discussion, we know that v=v′, so we can directly use v′ to query the transfer function and get S ij The color value and transparency value at the sampling point are obtained by performing the above trilinear interpolation steps in parallel in a multi-threaded manner to obtain a trilinear interpolation result set V corresponding to the sampling point set S.

[0054] When creating a 3D texture on the GPU, use the cudaTextureObject_t type texture object handle and call the CUDA API function cudaCreateTextureObject to create a 3D texture object and upload the 3D dataset B to the 3D texture object. S The elements in S′ ij The calculation formula is transformed to obtain a new sampling point array Array S′ ; Array S′The sampling point value and cudaTextureObject_t object are used as input parameters to call the CUDA API function tex3D <float>That is, return the color and transparency value at the sampling point, and then apply for the intersection array Array S′ Arrays of the same size C Used to store the color transparency array obtained by query;

[0055] (7) From the above steps, we can see that Array C Each column element in is a sequence of adaptive sampling points from near to far on a certain ray, so C By performing Alpha fusion by column, the final color and transparency value of the effective sampling ray can be obtained. C The column elements in are sorted from near to far according to the distance from the viewpoint, so the Under operator is used for Alpha fusion. Assume that there are N i sampling points, Array C [i,j].c and Array C [i,j].α is the color value and transparency value of the jth sampling point on the i-th ray. Then according to the calculation rules of the Under operator, take j as the loop variable and let j increase from 1 to N step by step. i -1, for Array C Perform calculation updates, and the calculation rules are as follows:

[0056] Array C [i,j].c=(1-Array C [i,j-1].α)·Array C [i,j].c+Array C [i,j-1].c

[0057] Array C [i,j].α=(1-Array C [i,j-1].α)·Array C [i,j].α+Array C [i,j-1].α

[0058] Update Array according to the above rules C After completion, Array C [i,N i -1].c and Array C [i,N i -1].α is then merged with the background color to obtain the final result color and transparency value of the i-th pixel. The colors and transparency values ​​of all pixels constitute the final output display of the result image, and the entire RayCasting volume rendering calculation process is completed.

[0059] Experimental verification and results

[0060] In order to verify the effectiveness of the present invention, a typical GPU workstation is selected as the experimental hardware platform to verify the computational efficiency of using the adaptive sampling Ray Casting volume rendering method for visualization on non-uniform rectangular grid data.

[0061] The hardware configuration parameters of the GPU workstation selected in the experiment are as follows: CPU Xeon(R)E5-2650v2, main frequency 2.60GHz, running memory capacity 64GB, GPU model is NVIDIAGeForceRTX 4080, independent video memory capacity 16GB, CUDA core number is 9728, operating system is Windows 1064-bit Professional Edition.

[0062] The experiment selects four non-uniform rectangular scalar field grid data, each grid point stores a single-precision floating-point scalar value, the grid dimensions and the uniform resampling grid dimensions while maintaining the minimum grid features are shown in Table 1. Assuming the screen resolution is 1920×1440, the CPU serial adaptive sampling method, GPU adaptive sampling method and GPU uniform sampling method are selected for Ray Casting calculation performance comparison. The average time for drawing a frame of image is shown in Table 1. The drawing results of the test data are shown in Figure 5 shown.

[0063] Table 1. Computation time of different Ray Casting volume rendering implementation methods

[0064]

[0065] From the statistical data in Table 1, it can be seen that for the four test data sets, the method proposed in the present invention shortens the rendering time by about 60.79%, 71.4%, 81.24% and 88.69% respectively compared with the CPU serial adaptive method, and shortens the rendering time by about 9.93%, 23.25%, 55.15% and 57.58% respectively compared with the GPU parallel uniform resampling method. The experimental results show that the technical method of the present invention can effectively improve the computational efficiency of the adaptive sampling Ray Casting volume rendering method.< / float>

Claims

1. A non-uniform cuboid grid adaptive sampling volume rendering method based on GPU acceleration, characterized in that: The following steps are involved: (1) Read the non-uniform rectangular grid data, obtain the relevant attribute parameters of the grid data body, establish the world coordinate system with the minimum coordinate point of the grid data as the origin of the world coordinate system, and determine the scene parameters; (2) Taking the viewpoint as the starting point of the sampling ray, the parametric equation of the effective sampling ray is determined according to the external contour of the data body and the projection area of ​​the visible surface on the viewing plane; (3) Enable multithreading on the GPU. Each thread is responsible for processing a valid sampling ray and calculating the intersection points between the valid sampling ray and all mesh surfaces in the X, Y, and Z directions to obtain the intersection point sequence set E. (4) Sort the intersection points on each ray in the set E from small to large according to the parameter t to obtain an ordered intersection point sequence set E'; (5) Based on the ordered intersection point set E', obtain the adaptive sampling point set S; (6) Load the non-uniform cuboid mesh data into the GPU 3D texture memory, perform coordinate transformation on all sampling points in the set S, use the transformed coordinates as input parameters for 3D texture query, and obtain a trilinear interpolation result set V; (7) Use the Under operator of the Alpha fusion algorithm to fuse the color values ​​and transparency values ​​sampled from near to far on each ray in the set V to obtain the final color of the pixel corresponding to the sampled ray, and finally form the output result image.

2. The GPU-accelerated non-uniform cuboid grid adaptive sampling volume rendering method according to claim 1, characterized in that: In the step (1), the relevant attribute parameters of the non-uniform rectangular grid data include the length dimensions (Lx, Ly, Lz) in the three directions of X, Y, and Z, and the number of grid points in the three directions (Nx, Ny, Nz), and the relevant scene parameters include the viewpoint position coordinates, the viewing plane, the light source position, the lighting direction, and the resulting image resolution.

3. The GPU-accelerated non-uniform cuboid grid adaptive sampling volume rendering method according to claim 1, characterized in that: In step (2), the projection of the data volume on the viewing plane needs to be calculated based on the bounding box of the data volume to determine the valid pixels that need to be calculated on the viewing plane. The ray connecting the viewpoint and the valid pixels is the valid sampling ray. Assume that the viewpoint position is P(x p ,y p ,z p ), then the effective pixel point Q(x q ,y q ,z q )'s effective ray The parametric equation expression is: Where Rn is the total number of valid pixels, 1≤i≤Rn.

4. The GPU-accelerated non-uniform cuboid grid adaptive sampling volume rendering method according to claim 1, characterized in that: In step (3), each GPU thread is responsible for a sampling ray Related calculations, rays The intersection points of all mesh surfaces in the X, Y, and Z directions form a set E i , then the intersection point set formed by all rays and the data volume is E = {E i |E i is the set of intersections between the i-th valid ray and all mesh surfaces, 1≤i≤Rn}.

5. The GPU-accelerated non-uniform cuboid grid adaptive sampling volume rendering method according to claim 1, characterized in that: In step (4), the intersection points on each ray in the intersection point set E are sorted, that is, the rays The corresponding intersection set E i Sort the elements in E i Each intersection point E ij Each corresponds to a t in the parametric equation ij Value, t ij The value indicates the distance between the intersection point and the viewpoint P. ij Value pair E i Sort the elements in the collection and get the ray The ordered intersection sequence set E from point P from near to far i ′.

6. The GPU-accelerated non-uniform cuboid grid adaptive sampling volume rendering method according to claim 1, characterized in that: In step (5), the sampling point set S = {S i |S i For rays All adaptive sampling points on}, S i By E i 'Calculated; Assume that the ray There are two adjacent points E on ij (x ij ,y ij ,z ij ) and E i,j+1 (x i,j+1 ,y i,j+1 ,z i,j+1 ), then E ij With E i,j+1 Take a sampling point S between ij , the coordinates are Where 1≤j≤Sn i ,ray All sampling points S on ij The composition set S i .

7. The GPU-accelerated non-uniform cuboid grid adaptive sampling volume rendering method according to claim 1, characterized in that: In the step (6), the grid data needs to be loaded into the GPU 3D texture memory first to implement the subsequent fast trilinear interpolation; the sampling point S ij The scalar field value at is calculated by trilinear interpolation of the eight unit vertices of the unit to which the sampling point belongs; Assume that the scalar values ​​at the eight grid points of the unit where the sampling point is located are v 000 ,v 001 ,…v 111 , then point S ij The scalar value v is calculated as: v=v 000 (1-x d )(1-y d )(1-z d )+v 100 x d (1-y d )(1-z d )+v 001 (1-x d )(1-y d )z d +v 101 x d (1-y d )z d +v 010 x d (1-y d )(1-z d )+v 110 x d y d (1-z d ) +v 011 (1-x d )y d z d +v 111 x d y d z d in (x0, y0, z0) and (x1, y1, z1) are the grid points V 000 and V 111 The coordinate value of .

8. The GPU-accelerated non-uniform cuboid grid adaptive sampling volume rendering method according to claim 1, characterized in that: In step (6), it is assumed that the number of grid points in the three dimensions is Nx, Ny and Nz respectively, and the length of the grid in the three directions is Lx, Ly and Lz respectively. Located in the [k1, k2, k3]th grid cell (k1, k2 and k3 are the subscript indices of the three-dimensional array), the corresponding sampling point after the grid transformation is Then the following equations must hold before and after the grid coordinate transformation: Since the three-dimensional texture coordinates in the GPU need to be normalized, Lx = Ly = Lz = 1.0, after simplifying the formula, we can get the sampling point S ij ′’s coordinates for: S ij ′ as a parameter to call the 3D texture sampling function in the GPU, and the sampling point S can be quickly obtained. ij ′; use v′ to query the transfer function and get S ij The color value and transparency value at the sampling point are obtained by performing the above trilinear interpolation steps in parallel in a multi-threaded manner to obtain a trilinear interpolation result set V corresponding to the sampling point set S.

9. The GPU-accelerated non-uniform cuboid grid adaptive sampling volume rendering method according to claim 1, characterized in that: In the step (7), the sampling points on all rays are sorted from small to large according to the parameter t, and the sampling points on the rays are directly fused using the Under operator in the Alpha fusion algorithm to obtain the final color value of the pixel corresponding to the ray. The color fusion process of each ray is completed in parallel using GPU multi-threading, and the resulting image is finally output.

Citation Information

Patent Citations

  • Access memory method for realizing shear wave data three-dimensional visualization by aiming at parallel volume rendering

    CN102750727A

  • Quick volume data skeleton extraction method based on rendering

    CN104156997A

  • Cone beam CT three-dimensional reconstruction method and system

    CN107784684A

  • Fast cone beam computed tomography reconstruction method based on GPU

    CN109146987A

  • GPU-based meteorological data volume rendering method

    CN111652961A

Cited By

  • Ray casting volume rendering method for InterfaceGrid grid model

    CN120495497A

  • A ray-casting volume rendering method for interface grid models

    CN120495497B