A ray processing method and system based on grid hybrid scene ray tracing

By dividing pixel areas in a surface/volume mesh hybrid scene and generating random ray sequences, the parallel computing process of ray tracing is optimized, solving the problem of low computing efficiency in existing technologies and achieving more efficient parallel computing.

CN115187718BActive Publication Date: 2025-09-12XIDIAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211040758.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-29
Publication Date
2025-09-12
Estimated Expiration
2042-08-29

AI Technical Summary

Technical Problem

Existing technologies ignore the parallel optimization of secondary tasks in ray tracing of surface/volume mesh hybrid scenes, resulting in low computational efficiency.

Method used

The pixel plane is divided into several pixel areas based on the grid type, a random ray sequence is generated, and the ray tracing of the grid mixed scene is calculated in parallel. The calculation process is optimized by adjusting the pixel sequence and ray sequence.

Benefits of technology

The parallel computing efficiency of the ray tracing algorithm for surface/volume mesh mixed scenes has been improved, making the task load more balanced and improving the parallel computing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115187718B_ABST
    Figure CN115187718B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of ray tracing technology, disclosing a ray processing method and system based on ray tracing for a grid-blended scene. This ray processing method divides a pixel plane into several pixel regions based on the grid type, and uses random rays generated within the same pixel region or within multiple merged pixel regions as parallel units to perform parallel computations on the ray traces for the grid-blended scene. This invention addresses existing issues such as the neglect of parallel optimization for secondary tasks and relatively low computational efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of ray tracing technology, and in particular to a ray processing method and system based on grid hybrid scene ray tracing. Background Art

[0002] Ray tracing for mixed surface / volume mesh scenes is a technique for tracing rays in 3D scenes containing both surface and volume meshes. In numerical image simulations, surface and volume meshes can be used to simulate the physical characteristics of the objects depicted. For example, static objects can be described using surface meshes, while dynamic aircraft require a volume mesh due to the surrounding flow field. The computational effort required to trace a single ray root for surface and volume meshes often differs significantly.

[0003] Ray tracing for mixed surface / volume meshes is a technique for tracing rays in 3D scenes containing both surface and volume meshes. Compared to ray tracing for scenes with single surface or volume meshes, ray tracing for mixed surface / volume meshes can result in significant differences in computational load between threads when processing multiple rays in parallel. This uneven distribution of computing resources reduces the efficiency of parallel operations.

[0004] Existing technical solutions, such as Xu Zhengwei of Henan Normal University's master's thesis, "Research on Key Technologies for Parallel Optimization of Physics-Based Ray Tracing Algorithms," propose a parallel primary task partitioning method based on the "subgraph method." This method divides the computation of an image with a resolution of m*n and a sampling rate of s (the number of ray samples) into the computation of k sub-images with a resolution of m*n and a sampling rate of s / k. These k images are then used as secondary tasks for parallel computation. Finally, after obtaining the k sub-images, all sub-images are merged to obtain the image at the full sampling rate. While this method has the advantage of fast computational speed, it still neglects the parallel optimization of secondary tasks. Existing technologies in this scenario still have relatively low computational efficiency. Summary of the Invention

[0005] To overcome the deficiencies of the prior art, the present invention provides a ray processing method and system based on grid hybrid scene ray tracing, which solves the problems of the prior art such as neglecting the parallel optimization of secondary tasks and relatively low computational efficiency.

[0006] The technical solution adopted by the present invention to solve the above problems is:

[0007] A ray processing method based on ray tracing of a grid hybrid scene divides a pixel plane into several pixel areas based on the grid type, uses random rays generated in the same pixel area or in multiple merged pixel areas as parallel units, and parallelly calculates the ray tracing of the grid hybrid scene.

[0008] As a preferred technical solution, the following steps are included:

[0009] S1, generate pixel sequence: divide the pixel plane into several pixel regions based on the grid type, and convert each pixel region into a corresponding pixel sequence;

[0010] S2, generate random ray sequences: set different sampling rates for different grid types and convert different pixel sequences into corresponding random ray sequences;

[0011] S3, adjust the length of random ray sequences: merge random ray sequences with the number of rays less than 1000;

[0012] S4, calculate ray tracing: calculate the ray tracing of the grid hybrid scene for each ray sequence to obtain a simulated image.

[0013] As a preferred technical solution, step S1 includes the following steps:

[0014] S11, in the detector local coordinate system , construct the direction vector of the central ray: traverse each pixel on the pixel plane and construct the direction vector of the central ray , the direction vector of the constructed central ray takes the origin (0,0,0) as the starting point, pixel Center Point is the end point; among them, Indicates the row number of the pixel on the pixel plane, Indicates the column number of the pixel on the pixel plane, Represents the three-dimensional coordinates of the corner point on the pixel plane, is the distance from the pixel plane to the detection point, respectively Pixels The length, Pixels width;

[0015] S12, in the scene coordinate system, get the starting point of the central ray in the scene coordinate system and direction :

[0016] ,

[0017] ,

[0018] ,

[0019] ;

[0020] in, is the coordinate of the starting point of the central ray in the scene coordinate system, is the coordinate of the end point of the central ray in the scene coordinate system, The transformation matrix that transforms the detector's local coordinate system into the scene coordinate system;

[0021] S13, after obtaining the starting point and direction of the central ray in the scene coordinate system, find the surface element that intersects with the central ray in the scene coordinate system and record the grid to which the surface element belongs;

[0022] S14, classifying the grid types of the grids in the scene coordinate system into m categories; wherein m ≥ 2 and m is an integer;

[0023] S15, according to the number of pixels corresponding to each grid type, generate m pixel sequence arrays, each pixel sequence array records the corresponding pixels .

[0024] As a preferred technical solution, in step S15, if the grid type is divided only into volume grid and surface grid, then m=2, and in the two pixel sequence arrays, one pixel sequence array records the pixels where the central ray intersects with the volume grid, and the other pixel sequence array records the pixels where the central ray intersects with the surface grid.

[0025] As a preferred technical solution, step S2 includes the following steps:

[0026] S21, in the detector local coordinate system In, construct random rays;

[0027] S22, transform the random ray into the scene coordinate system;

[0028] S23 , based on the m pixel sequence arrays generated in step S15 , setting different sampling rates for different grid types to generate corresponding m ray sequences.

[0029] As a preferred technical solution, in step S21, the method for constructing random rays is:

[0030] In the detector local coordinate system The origin (0,0,0) is the starting point, pixel Random point on As the end point, construct the direction vector of the random ray ;

[0031] in, Indicates the row number of the lth pixel in the kth pixel sequence array, Indicates the column number of the lth pixel in the kth pixel sequence array, k represents the number of the pixel sequence array, 1≤k≤m, l represents the number of the pixel in the kth pixel sequence array, l≥1, 、 are random numbers that obey a uniform distribution on the real number interval (0, 1).

[0032] As a preferred technical solution, in step S22, the method for converting the random ray into the scene coordinate system is:

[0033] In the scene coordinate system, get the starting point of the random ray in the scene coordinate system and direction :

[0034] ,

[0035] ,

[0036] ,

[0037] ,

[0038] in, The coordinates of the random ray endpoint in the scene coordinate system.

[0039] As a preferred technical solution, step S3 includes the following steps:

[0040] S31, calculating the complexity g of the target model mesh, the calculation method is: for a volume mesh, assuming the number of voxels in the target model mesh is w, and the bounding box volume of the target model mesh in the scene is f, then the target model mesh complexity is: g=w / f; for a surface mesh, w=0, and the target model mesh complexity is 0;

[0041] S32, arranging the corresponding ray sequences according to the complexity;

[0042] S33: Merge the arranged adjacent ray sequences with the number of rays less than 1000 to form a larger sequence.

[0043] As a preferred technical solution, step S4 includes the following steps:

[0044] S41, performing ray tracing calculations on each ray sequence, wherein the rays in the same ray sequence are calculated in parallel, and then the brightness values ​​of the rays belonging to the same pixel in the ray sequence are averaged to obtain the brightness of each pixel. The calculation formula is:

[0045] ,

[0046] in, Represents the brightness value of the lth pixel in the kth pixel sequence array, Represents the brightness value of the sth random ray of the lth pixel in the kth pixel sequence array. Indicates the ray sampling rate of the k-th pixel sequence array corresponding to the grid type;

[0047] S42, outputting a ray tracing image of the mesh hybrid scene.

[0048] A ray processing system based on grid hybrid scene ray tracing, based on the above-mentioned ray processing method based on grid hybrid scene ray tracing, includes the following modules connected in sequence:

[0049] Pixel sequence generation module: used to divide the pixel plane into several pixel areas based on the grid type and convert each pixel area into a corresponding pixel sequence;

[0050] Ray sequence generation module: used to set different sampling rates for different grid types and convert different pixel sequences into corresponding random ray sequences;

[0051] Ray sequence length adjustment module: used to merge random ray sequences with the number of rays less than 1000;

[0052] Ray tracing calculation module: used to calculate the ray tracing of the grid mixed scene for each ray sequence to obtain a simulated image.

[0053] Compared with the prior art, the present invention has the following beneficial effects:

[0054] (1) The present invention is used for parallel optimization of ray tracing algorithms for surface / volume mesh hybrid scenes, effectively improving computational efficiency;

[0055] (2) The present invention makes the task load more balanced, thereby improving the parallel efficiency;

[0056] (3) The present invention classifies rays according to the type of mesh they intersect for the first time, which can effectively distinguish the computational cost of the rays. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 A schematic diagram of the steps of a ray processing method based on grid hybrid scene ray tracing according to the present invention;

[0058] Figure 2 Schematic diagram of ray tracing of a grid hybrid scene according to the present invention. DETAILED DESCRIPTION

[0059] The present invention will be further described in detail below with reference to the embodiments and the accompanying drawings, but the embodiments of the present invention are not limited thereto.

[0060] Example 1

[0061] like Figure 1 、 Figure 2As shown, the present invention proposes a ray processing method and system based on grid hybrid scene ray tracing, aiming to further optimize the efficiency of surface / volume grid hybrid scene ray tracing.

[0062] Reference Figure 1 , the present invention comprises the following steps:

[0063] S1, generate pixel sequence: generate pixel sequence divided by target;

[0064] S11, in the detector local coordinate system , construct the direction vector of the central ray: traverse each pixel on the pixel plane and construct the direction vector of the central ray , the direction vector of the constructed central ray takes the origin (0,0,0) as the starting point, pixel Center Point is the end point; among them, Indicates the row number of the pixel on the pixel plane, Indicates the column number of the pixel on the pixel plane, Represents the three-dimensional coordinates of the corner point on the pixel plane, is the distance from the pixel plane to the detection point, respectively Pixels The length, Pixels width;

[0065] S12, transform the ray into the scene coordinate system to obtain the starting point and direction of the ray in the scene:

[0066] In the scene coordinate system, get the starting point of the central ray in the scene coordinate system and direction :

[0067] ,

[0068] ,

[0069] ,

[0070] ;

[0071] in, is the coordinate of the starting point of the central ray in the scene coordinate system, is the coordinate of the end point of the central ray in the scene coordinate system, The transformation matrix that transforms the detector's local coordinate system into the scene coordinate system;

[0072] S13, after obtaining the starting point and direction of the central ray in the scene coordinate system, find the surface element that intersects with the central ray in the scene coordinate system and record the grid to which the surface element belongs;

[0073] S14, classifying the grid types of the grids in the scene coordinate system into m categories; wherein m ≥ 2 and m is an integer;

[0074] S15, according to the number of pixels corresponding to each grid type, generate m pixel sequence arrays, each pixel sequence array records the corresponding pixels .

[0075] If the grid type is divided only into volume grid and surface grid, then m=2. In the two pixel sequence arrays, one pixel sequence array records the pixels where the central ray intersects with the volume grid, and the other pixel sequence array records the pixels where the central ray intersects with the surface grid.

[0076] Here are some examples:

[0077]

[0078] S2, generate random ray sequence: convert the pixel sequence into ray sequence according to the sampling rate set by the target type;

[0079] S21, in the detector local coordinate system In, construct random rays;

[0080] In step S21, the method for constructing random rays is:

[0081] In the detector local coordinate system The origin (0,0,0) is the starting point, pixel Random point on As the end point, construct the direction vector of the random ray ;

[0082] in, Indicates the row number of the lth pixel in the kth pixel sequence array, Indicates the column number of the lth pixel in the kth pixel sequence array, k represents the number of the pixel sequence array, 1≤k≤m, l represents the number of the pixel in the kth pixel sequence array, l≥1, 、 are random numbers that obey a uniform distribution on the real number interval (0, 1).

[0083] S22, transform the random ray into the scene coordinate system;

[0084] In step S22, the method of converting the random ray into the scene coordinate system is:

[0085] In the scene coordinate system, get the starting point of the random ray in the scene coordinate system and direction :

[0086] ,

[0087] ,

[0088] ,

[0089] ,

[0090] in, The coordinates of the random ray endpoint in the scene coordinate system.

[0091] S23 , based on the m pixel sequence arrays generated in step S15 , setting different sampling rates for different grid types to generate corresponding m ray sequences.

[0092] Specifically, based on the m pixel sequences generated above, a corresponding m ray sequence is generated according to the sampling rate (the number of rays randomly sampled at each pixel) set for the corresponding object mesh type. For example, for pixel 0, pixel 2, pixel 3, ..., we can obtain ray 00, ray 01, ray 02, ..., ray 10, ray 11, ray 12, ..., ray 30, ray 31, ray 32, ....

[0093] Class 1: Ray 11, Ray 12, ...

[0094] Class 2: Ray 21, Ray 22, ... . . .

[0095] Class m: ray m1, ray m2, ...

[0096] S3, adjust the length of random ray sequences: merge random ray sequences with the number of rays less than 1000;

[0097] S31, calculate the complexity g of the target model grid, combined with Figure 2 It can be seen that the computational complexity of ray tracing in a model is related to the mesh complexity of the model.

[0098] Calculate the complexity g of the target model mesh. The calculation method is: for volume meshes, let the number of voxels of the target model mesh be w, and the bounding box volume of the target model mesh in the scene be f, then the target model mesh complexity is: g=w / f; for surface meshes, w=0, and the target model mesh complexity is 0.

[0099] S32, arranging the corresponding ray sequences according to the complexity;

[0100] S33, for a relatively short ray sequence, it can be merged with ray sequences with similar arrangements or similar grid complexity to form a larger sequence to improve parallel efficiency.

[0101] Specifically, adjacent arranged ray sequences with the number of rays less than 1000 are merged to form a larger sequence.

[0102] S4, calculating ray tracing: performing parallel calculations on the ray tracing of each ray sequence in turn to obtain a simulated image.

[0103] S41, performing ray tracing calculations on each ray sequence, wherein the rays in the same ray sequence are calculated in parallel, and then the brightness values ​​of the rays belonging to the same pixel in the ray sequence are averaged to obtain the brightness of each pixel. The calculation formula is:

[0104] ,

[0105] in, Represents the brightness value of the lth pixel in the kth pixel sequence array, Represents the brightness value of the sth random ray of the lth pixel in the kth pixel sequence array. Indicates the ray sampling rate of the k-th pixel sequence array corresponding to the grid type.

[0106] S42, outputting a ray tracing image of the mesh hybrid scene.

[0107] The present invention is used for parallel optimization of ray tracing algorithms in surface / volume mesh hybrid scenes, effectively improving computational efficiency.

[0108] Compared with the prior art which uses pictures as parallel units for optimization, the present invention uses pixels as parallel units, which can make the task load more balanced, thereby making the parallel efficiency higher.

[0109] The present invention takes into account that when each ray first intersects the surface of an object, the probability of intersecting with the same type of grid after reflection will increase accordingly, so classifying the rays according to the type of grid intersected for the first time can effectively distinguish the computational amount of the rays.

[0110] As described above, the present invention can be preferably implemented.

[0111] All features disclosed in all embodiments in this specification, or steps in all methods or processes implicitly disclosed, except for mutually exclusive features and / or steps, can be combined and / or expanded or replaced in any manner.

[0112] The above description is merely a preferred embodiment of the present invention and does not constitute any form of limitation to the present invention. Based on the technical essence of the present invention and within the spirit and principles of the present invention, any simple modification, equivalent replacement and improvement of the above embodiment shall still fall within the scope of protection of the technical solution of the present invention.

Claims

1. A ray processing method based on grid hybrid scene ray tracing, characterized in that: Divide the pixel plane into several pixel regions based on the grid type, use the random rays generated in the same pixel region or multiple merged pixel regions as parallel units, and parallelly calculate the ray tracing of the grid hybrid scene; The specific steps include: S1, generate pixel sequence: divide the pixel plane into several pixel regions based on the grid type, and convert each pixel region into a corresponding pixel sequence; S2, generate random ray sequences: set different sampling rates for different grid types and convert different pixel sequences into corresponding random ray sequences; S3, adjust the length of random ray sequences: merge random ray sequences with the number of rays less than 1000; S4, calculating ray tracing: calculating ray tracing of the grid hybrid scene for each ray sequence to obtain a simulation image; The step S1 comprises the following steps: S11, in the detector local coordinate system , construct the direction vector of the central ray; S12, in the scene coordinate system, get the starting point of the central ray in the scene coordinate system and direction ; S13, after obtaining the starting point and direction of the central ray in the scene coordinate system, find the surface element that intersects with the central ray in the scene coordinate system and record the grid to which the surface element belongs; S14, classifying the grid types of the grids in the scene coordinate system into m categories; where m ≥ 2 and m is an integer; S15, according to the number of pixels corresponding to each grid type, generate m pixel sequence arrays, each pixel sequence array records the corresponding pixels ; The step S4 comprises the following steps: S41, performing ray tracing calculations on each ray sequence, wherein rays in the same ray sequence are calculated in parallel, and then averaging the brightness values ​​of rays belonging to the same pixel in the ray sequence to obtain the brightness of each pixel; S42, outputting a ray tracing image of the mesh hybrid scene.

2. A ray processing method based on grid hybrid scene ray tracing according to claim 1, characterized in that: Step S1 includes the following steps: S11, in the detector local coordinate system , construct the direction vector of the central ray: traverse each pixel on the pixel plane and construct the direction vector of the central ray The direction vector of the constructed central ray takes the origin (0,0,0) as the starting point and the pixel Center point is the end point; among them, Indicates the row number of the pixel on the pixel plane, Indicates the column number of the pixel on the pixel plane, Represents the three-dimensional coordinates of the corner point on the pixel plane, is the distance from the pixel plane to the detection point, Pixels The length, Pixels width; S12, in the scene coordinate system, get the starting point of the central ray in the scene coordinate system and direction : , , , ; in, is the coordinate of the starting point of the central ray in the scene coordinate system, is the coordinate of the end point of the central ray in the scene coordinate system, The transformation matrix that transforms the detector's local coordinate system into the scene coordinate system; S13, after obtaining the starting point and direction of the central ray in the scene coordinate system, find the surface element that intersects with the central ray in the scene coordinate system and record the grid to which the surface element belongs; S14, classifying the grid types of the grids in the scene coordinate system into m categories; wherein m ≥ 2 and m is an integer; S15, according to the number of pixels corresponding to each grid type, generate m pixel sequence arrays, each pixel sequence array records the corresponding pixels .

3. The method for processing light based on grid hybrid scene ray tracing according to claim 2, characterized in that: In step S15, if the grid type is divided only into volume grid and surface grid, then m=2, and of the two pixel sequence arrays, one pixel sequence array records the pixels where the central ray intersects with the volume grid, and the other pixel sequence array records the pixels where the central ray intersects with the surface grid.

4. The method for processing light based on grid hybrid scene ray tracing according to claim 3, characterized in that: Step S2 includes the following steps: S21, in the detector local coordinate system In, construct random rays; S22, transform the random ray into the scene coordinate system; S23 , based on the m pixel sequence arrays generated in step S15 , setting different sampling rates for different grid types to generate corresponding m ray sequences.

5. The method for processing light based on grid hybrid scene ray tracing according to claim 4, characterized in that: In step S21, the method for constructing random rays is: In the detector local coordinate system The origin (0,0,0) is the starting point, pixel Random point on As the end point, construct the direction vector of the random ray ; in, Indicates the row number of the lth pixel in the kth pixel sequence array, Indicates the column number of the lth pixel in the kth pixel sequence array, k represents the number of the pixel sequence array, 1≤k≤m, l represents the number of the pixel in the kth pixel sequence array, l≥1, 、 are random numbers that obey a uniform distribution on the real number interval (0, 1).

6. The method for processing light based on grid hybrid scene ray tracing according to claim 5, characterized in that: In step S22, the method of converting the random ray into the scene coordinate system is: In the scene coordinate system, get the starting point of the random ray in the scene coordinate system and direction : , , , , in, The coordinates of the random ray endpoint in the scene coordinate system.

7. The method for processing light based on grid hybrid scene ray tracing according to claim 6, characterized in that: Step S3 includes the following steps: S31, calculating the complexity g of the target model mesh, the calculation method is: for a volume mesh, assuming the number of voxels in the target model mesh is w, and the bounding box volume of the target model mesh in the scene is f, then the target model mesh complexity is: g=w / f; for a surface mesh, w=0, and the target model mesh complexity is 0; S32, arranging the corresponding ray sequences according to the complexity; S33: Merge the arranged adjacent ray sequences with the number of rays less than 1000 to form a larger sequence.

8. The method for processing light based on grid hybrid scene ray tracing according to claim 7, characterized in that: The calculation formula used in step S41 is: , in, Represents the brightness value of the lth pixel in the kth pixel sequence array, Represents the brightness value of the sth random ray of the lth pixel in the kth pixel sequence array. Indicates the ray sampling rate of the k-th pixel sequence array corresponding to the grid type.

9. A light processing system based on grid hybrid scene ray tracing, characterized in that: A ray processing method based on grid hybrid scene ray tracing according to any one of claims 1 to 8, comprising the following modules connected in sequence: Pixel sequence generation module: used to divide the pixel plane into several pixel areas based on the grid type and convert each pixel area into a corresponding pixel sequence; Ray sequence generation module: used to set different sampling rates for different grid types and convert different pixel sequences into corresponding random ray sequences; Ray sequence length adjustment module: used to merge random ray sequences with the number of rays less than 1000; Ray tracing calculation module: used to calculate the ray tracing of the grid mixed scene for each ray sequence to obtain a simulated image.

Citation Information

Patent Citations

  • Image synthesis by rank-1 lattices

    AU2006261874A1

  • Quasi-monte carlo light transport simulation by efficient ray tracing

    WO2009044282A2