A 3D mapping irregular surface projection method and system supporting game interaction
By introducing pixel and neighborhood compensation of irregular surface 3D data models into 3D games and combining it with the Delaunay triangulation rule to calculate vertex indices, the problem of slow real-time correction of irregular projections is solved, the rendering speed of 3D games is improved, and the complexity of game development is reduced.
Patent Information
- Application Number
- CN202210795359.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-07
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2042-07-07
AI Technical Summary
The slow real-time correction speed of irregular projections reduces the rendering speed of 3D games, increasing the difficulty of game development.
The 3D rendered image, rendered using the D3D rendering plugin, is input into the trained irregular surface 3D data model. Pixel and neighborhood compensation is performed through the mapping module, primary compensation module, and secondary compensation module to generate the compensated irregular image, which replaces the current rendered image in the D3D interactive game system. The Delaunay triangulation rule is used to calculate the vertex index of the depth image to generate the irregular 3D data model.
It improves the rendering speed of 3D games, reduces the complexity of developing games with irregular projections, and enables real-time correction of irregular projections.
Smart Images

Figure CN115205429B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of irregular surface projection technology, and in particular to a 3D mapping irregular surface projection method and system that supports game interaction. Background Technology
[0002] In recent years, projection technology has developed rapidly, and in addition to regular planar projection, irregular-shaped projection has also emerged. The surface on which the image is projected for irregular-shaped projection has no fixed requirements, and projection can be achieved on the surface of any object according to the user's needs.
[0003] The implementation of irregular projection mainly relies on projection blending technology to correct the image content, allowing the projection to blend perfectly with the surface of the irregular object without overlap or gaps, presenting viewers with a delicate, exquisite, and near-ideal projection effect. However, correcting the image content itself is time-consuming, and 3D games inherently require high image rendering speeds. Real-time correction during image output would reduce the rendering rate of the 3D game. If the rendering rate of the 3D game is increased, the real-time correction speed of irregular projection will be slow, thus increasing the difficulty of 3D game development. Summary of the Invention
[0004] Based on the technical problems existing in the background technology, this invention proposes a 3D mapping irregular surface projection method and system that supports game interaction, which solves the problem of slow real-time correction speed of irregular surface projection and reduces the complexity of game development for irregular surface projection.
[0005] The present invention proposes a 3D mapping irregular surface projection method that supports game interaction, comprising the following steps:
[0006] The 3D rendered image rendered by the D3D rendering plugin is input into the trained irregular surface 3D data model, which includes a mapping module, a primary compensation module and a secondary compensation module.
[0007] The mapping module converts the 3D rendered image into an irregularly shaped image.
[0008] The irregular image is compensated by a single compensation module, and the pixel compensation is performed in the neighborhood of the pixel compensation.
[0009] The secondary compensation module applies the neighborhood compensation pixels back to the irregular image to obtain the compensated irregular image.
[0010] The compensated irregular image is sent to the rendering plugin, and the rendered irregular image is output.
[0011] Replace the current rendered image in the D3D interactive game system with the rendered alien image to perform a replacement projection.
[0012] Furthermore, the process of constructing the 3D data model of the irregular surface:
[0013] Obtain a first depth image set, perform neighborhood compensation on invalid data in the first depth image set, and obtain a first depth compensated image;
[0014] A second depth image set is obtained, and invalid data in the second depth image set is compensated for to obtain a second depth compensated image. The second depth image and the first depth image are different image sets obtained at adjacent time points.
[0015] The optimal difference operation is performed on the first depth-compensated image and the second depth-compensated image to obtain the third depth image set;
[0016] Transform the depth images in the third depth image set into a 3D point cloud set;
[0017] The depth image vertex indices in the third depth image set are calculated using the Delaunay triangulation rule.
[0018] Based on the three-dimensional point cloud set and the vertex index of the depth image, a non-planar three-dimensional data model is calculated and generated.
[0019] Furthermore, the process of transforming the depth images in the third depth image set into a 3D point cloud set specifically includes:
[0020] Let I be the depth image in the third depth image set, and project each pixel in I.
[0021] By assuming that the individual camera matrix is consistent with the world matrix, the three-dimensional spatial coordinates P of each pixel in the depth image I are derived;
[0022] Based on the condition that the depth value of each pixel in the given depth map is consistent with the z-axis coordinate of the three-dimensional point, the three-dimensional spatial coordinate P is derived.
[0023] By unifying the coordinate systems corresponding to the camera matrices generated by the three cameras into the same coordinate system, a set of three-dimensional points is obtained.
[0024] Furthermore, the calculation of the depth image vertex indices in the third depth image set using the Delaunay triangulation rule specifically includes:
[0025] Set the 3D point cloud set S in the depth image to satisfy the condition that three points are not collinear and four points are not concyclic;
[0026] Choose any point pi, and find the point pj with the shortest edge connecting to that point;
[0027] Extend the edges to the right of the connecting lines pi-pj and pj-pi respectively to obtain the extended point pk, and add the two newly generated edges pi-pk and pk-pj to the queue Q.
[0028] The process is repeated until queue Q is empty, at which point the vertex indices of the depth image are obtained.
[0029] Furthermore, after performing optimal difference calculation on the first depth-compensated image and the second depth-compensated image to obtain the third depth image set, the first depth-compensated image and the second depth-compensated image are compared and corrected to correct the detail errors of the single-frame depth image.
[0030] A 3D mapping irregular surface projection system that supports game interaction includes an image input module, a mapping module, a primary compensation module, a secondary compensation module, a rendering module, and a replacement module;
[0031] The image input module is used to input the 3D rendered image output by the rendering plugin in the 3D game program into the trained irregular surface 3D data model;
[0032] The mapping module is used to convert 3D rendered images into irregularly shaped images;
[0033] The primary compensation module is used to perform pixel compensation on irregularly shaped images and to compensate pixels in the neighborhood of pixel compensation.
[0034] The secondary compensation module is used to compensate the irregular image again by using neighborhood compensation pixels to obtain the compensated irregular image;
[0035] The rendering module is used to send the compensated irregular image to the rendering plugin and output the rendered irregular image.
[0036] The replacement module is used to replace the currently rendered image in a 3D game program with a rendered irregular image, thus performing a replacement projection.
[0037] Furthermore, the process of constructing the 3D data model of the irregular surface:
[0038] Obtain a first depth image set, perform neighborhood compensation on invalid data in the first depth image set, and obtain a first depth compensated image;
[0039] A second depth image set is obtained, and invalid data in the second depth image set is compensated for to obtain a second depth compensated image. The second depth image and the first depth image are different image sets obtained at adjacent time points.
[0040] The optimal difference operation is performed on the first depth-compensated image and the second depth-compensated image to obtain the third depth image set;
[0041] Transform the depth images in the third depth image set into a 3D point cloud set;
[0042] The depth image vertex indices in the third depth image set are calculated using the Delaunay triangulation rule.
[0043] Based on the three-dimensional point cloud set and the vertex index of the depth image, a non-planar three-dimensional data model is calculated and generated.
[0044] A computer-readable storage medium storing a plurality of classification programs, the plurality of classification programs being invoked by a processor and executed as described above in the 3D mapping irregular surface projection method.
[0045] The advantages of the 3D mapping irregular surface projection method and system supporting game interaction provided by this invention are as follows: The 3D mapping irregular surface projection method and system supporting game interaction provided by this invention adopts a static injection method to merge files into the D3D interactive game, which improves the rendering speed of the 3D game, solves the problem of slow real-time correction speed of irregular surface projection, and reduces the game development complexity for irregular surface projection. Attached Figure Description
[0046] Figure 1 This is a schematic diagram of the structure of the present invention;
[0047] Figure 2 A flowchart illustrating the construction process of a 3D data model for an irregularly shaped surface;
[0048] Figure 3 A hardware structure diagram on which the mapping irregular surface projection method depends;
[0049] Figure 4 This is a neighborhood compensation example using a 5x5 neighborhood set. Detailed Implementation
[0050] The technical solution of the present invention will now be described in detail through specific embodiments. Many specific details are set forth in the following description to provide a thorough understanding of the invention. However, the present invention can be implemented 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 invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0051] like Figures 1 to 4 As shown, the present invention proposes a 3D mapping irregular surface projection method that supports game interaction, comprising the following steps:
[0052] S1: The 3D rendered image rendered by the D3D rendering plugin is input into the trained irregular surface 3D data model, which includes a mapping module, a primary compensation module and a secondary compensation module.
[0053] The D3D interactive game system starts up, outputs 3D images, loads the irregular surface 3D data model from the projection mapping correction and pixel compensation system, the D3D rendering plugin intercepts the game rendering interface of the D3D interactive game system, renders the 3D images, outputs 3D rendered images, and loads the 3D rendered images into the irregular surface 3D data model for image processing.
[0054] S2: Converts the 3D rendered image into an irregularly shaped image through the mapping module;
[0055] S3: Performs pixel compensation on irregular images and neighborhood compensation pixels through a primary compensation module;
[0056] S4: The secondary compensation module compensates the irregular image again by using neighborhood compensation pixels to obtain the compensated irregular image;
[0057] Steps S2 to S4 are the processing steps of the non-plane 3D data model on the input image to compensate the input image and obtain a more accurate image for more accurate non-plane projection display.
[0058] S5: Send the compensated irregular image to the rendering plugin and output the rendered irregular image;
[0059] S6: Replace the current rendered image in the D3D interactive game system with the rendered irregular image to perform a replacement projection.
[0060] The projection mapping correction and pixel compensation system loads the rendered irregular image into the D3D interactive game system. During the image replacement process, the game rendering is paused first, and the rendered irregular image is replaced with the rendered irregular image. The D3D interactive game system outputs the rendered irregular image through the game rendering interface, and then the game rendering is resumed.
[0061] The loop steps S1 to S6 can output the fused irregular surface projection in real time. Steps S1 to S6 use GPU computing and static injection to merge the file into the D3D interactive game (any game file developed based on D3D technology), which improves the rendering speed of the 3D game, solves the problem of slow real-time correction of irregular surface projection, and reduces the complexity of game development for irregular surface projection.
[0062] The 3D data model of the irregular surface is generated by calculating the depth data from the projector to the projection surface, as detailed below:
[0063] S11: Obtain the first depth image set, perform neighborhood compensation on the invalid data in the first depth image set, and obtain the first depth compensated image;
[0064] S12: Obtain the second depth image set, perform neighborhood compensation on the invalid data in the second depth image set, and obtain the second depth compensated image. The second depth image and the first depth image are different image sets obtained at adjacent time points.
[0065] The depth pixels in the first and second depth image sets satisfy the interval [0, +∞). Depth pixels with values greater than +∞ or a fixed threshold are considered invalid data. After removing invalid data, these pixels are filled with image data through neighborhood compensation. The neighborhood compensation method for the first and second depth image sets is the same, such as... Figure 4 As shown, taking a 5x5 neighborhood set as an example, it specifically includes:
[0066] Calculate the mean of the 5x5 neighborhood set using Euclidean distance as the coefficient;
[0067] After removing invalid data, the total number of valid pixels Sn within the valid 5x5 neighborhood is obtained.
[0068]
[0069] The final compensated pixel Iv is obtained as follows: Iv = Sub / n;
[0070] n represents the number of data points to be compensated, I(x,y) represents any pixel point on the corresponding depth map, and K represents... Figure 4 The center point on the template (specifically, the 0 circled in the box).
[0071] S13: Perform optimal difference calculation on the first depth-compensated image and the second depth-compensated image to obtain the third depth image set;
[0072] By comparing and correcting two depth images (the first depth image and the second depth image) at close time points, detail errors in a single-frame depth image are corrected, resulting in a third depth image set.
[0073] S14: Convert the depth images in the third depth image set into a 3D point cloud set; the specific conversion process is as follows:
[0074] S141: Let I be the depth image in the third depth image set. Project each pixel in I using the following mapping formula:
[0075]
[0076] Mr33 is a 3×3 vector of camera physical coordinates, Mt31 is a 3×1 vector of camera physical coordinates, the fixed intrinsic parameters of the camera dx,dy are the physical coordinates of a single pixel, w is the width of I, h is the height of I, f is the camera focal length, and P is the three-dimensional spatial coordinates of the depth image I.
[0077] The above mapping formula is used to map I, meaning that the projection of each pixel in the depth image I satisfies the ray formula.
[0078] S142: Set the single camera matrix to be consistent with the world matrix, and derive the three-dimensional spatial coordinates P of each pixel in the depth image I;
[0079] Based on the condition that the depth value of each pixel in the given depth map is consistent with the z-axis coordinate of the 3D point, the 3D spatial coordinate P is derived using the following formula:
[0080]
[0081] S143: Unify the coordinate systems corresponding to the camera matrices generated by the three cameras into the same coordinate system to obtain a set of three-dimensional points;
[0082] Since the points generated by the three cameras are in different coordinate systems, it is necessary to unify the points in the three different coordinate systems into one coordinate system. The points generated by the three cameras are then aggregated in this coordinate system to obtain a 3D point set, as follows:
[0083]
[0084] Among them, M0, M1, and M2 are three camera matrices.
[0085] By unifying the points obtained from the three cameras in the three coordinate systems into one coordinate system through steps S141 to S143, we obtain three points in the same coordinate system. These three points are then combined to obtain a three-dimensional point set.
[0086] S15: Calculate the vertex indices of the depth images in the third depth image set using the Delaunay triangulation rule, specifically including:
[0087] S151: Set the 3D point cloud set S in the depth image to satisfy the condition that three points are not collinear and four points are not concyclic;
[0088] S = {p1, p2, ..., pn}, n ≥ 3, where n represents any natural number greater than or equal to 3, and the contents within {} indicate that there are n points in set P.
[0089] V={x∈R2|d(x,pi)≤d(x,pj),i,j=1,2,...,n and i≠j}
[0090] Where V represents the set that satisfies the condition, d(x,pi) represents the Euclidean distance between x and pi, d(x,pj) represents the Euclidean distance between points x and pj, and R2 is the diameter of the circle (the diameter of the circle formed by any three points in the three-dimensional point cloud set S).
[0091] S152: Take any point pi, find the point pj with the shortest edge connected to that point;
[0092] For example: randomly select a point p1 from the three-dimensional point cloud set S as the starting point, and find the point closest to it as the second point p2;
[0093] S153: Extend the right side of the connecting lines pi-pj and pj-pi respectively to obtain the extended point pk, and add the two newly generated edges pi-pk and pk-pj to the queue Q.
[0094] For example: Extend the line p1-p2 to the right to obtain extension point p3, and extend the line p2-p1 to the right to obtain extension point p4. Record the two triangles obtained from the extension. Add p1-p3, p3-p2, p2-p4, and p4-p1 to queue Q. The extension method is to find a third point on the right side of the line that forms the largest angle with it. If there is no point on the right side that satisfies the condition, the extension of this edge fails.
[0095] S154: Loop through S153 until queue Q is empty, depth image vertex index.
[0096] By expanding the 3D point cloud set S through steps S151 to S154, the depth image vertex indexes in the third depth image set are obtained.
[0097] S16: Generate a non-planar 3D data model based on the 3D point cloud set and the vertex index of the depth image.
[0098] After steps S11 to S16, in a certain space, by performing difference operations on different images corresponding to two adjacent time points, a third depth image set is obtained. Then, the third depth image set is compared with the depth map corresponding to the adjacent time point to obtain the Nth depth map. A relatively accurate depth map can be output. Point cloud conversion and vertex index settings are performed on the depth map to generate a non-linear 3D data model, which can be directly implemented for 3D mapping and non-linear surface projection display when the subsequent ordered interface is displayed.
[0099] In this embodiment, the hardware relied upon by the irregular surface projection method includes an irregular projection surface modeling system, a projection mapping correction and pixel compensation system, a D3D interactive game system, and a D3D rendering plugin. The D3D rendering plugin is connected to the projection mapping correction and pixel compensation system and the D3D interactive game system to synchronize irregular surface projection correction and game rendering. Specifically, during the image processing process of the mapping module, primary compensation module, and secondary compensation module in the projection mapping correction and pixel compensation system, the D3D rendering plugin renders the processed image, so that the final output to the 3D interactive game system is the rendered irregular image.
[0100] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as ROM, RAM, magnetic disk, or optical disk.
[0101] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A 3D mapping method for projecting irregular surfaces to support game interaction, comprising the following steps: The 3D rendered image rendered by the D3D rendering plugin is input into the trained irregular surface 3D data model, which includes a mapping module, a primary compensation module and a secondary compensation module. The mapping module converts the 3D rendered image into an irregularly shaped image. The irregular image is pixel compensated by a single compensation module, and the neighborhood compensated pixels are generated after pixel compensation. The secondary compensation module uses neighboring compensation pixels to compensate the irregular image again, resulting in a compensated irregular image. The compensated irregular image is sent to the rendering plugin, and the rendered irregular image is output. Replace the current rendered image in the D3D interactive game system with the rendered irregular image to perform a replacement projection; The process of constructing a 3D data model of an irregular surface: Obtain a first depth image set, perform neighborhood compensation on invalid data in the first depth image set, and obtain a first depth compensated image; A second depth image set is obtained, and neighborhood compensation is performed on invalid data in the second depth image set to obtain a second depth compensated image. The second depth image and the first depth image are different image sets obtained at nearby time points. The optimal difference operation is performed on the first depth-compensated image and the second depth-compensated image to obtain the third depth image set; Transform the depth images in the third depth image set into a 3D point cloud set; The depth image vertex indices in the third depth image set are calculated using the Delaunay triangulation rule. Based on the three-dimensional point cloud set and the vertex index of the depth image, a non-planar three-dimensional data model is calculated and generated.
2. The 3D mapping irregular surface projection method supporting game interaction according to claim 1, characterized in that, The process of converting depth images from the third depth image set into a 3D point cloud set specifically includes: Let I be the depth image in the third depth image set, and project each pixel in I. By assuming that the individual camera matrix is consistent with the world matrix, the three-dimensional spatial coordinates P of each pixel in the depth image I are derived; Based on the condition that the depth value of each pixel in the given depth map is consistent with the z-axis coordinate of the three-dimensional point, the three-dimensional spatial coordinate P is derived. By unifying the coordinate systems corresponding to the camera matrices generated by the three cameras into the same coordinate system, a set of three-dimensional points is obtained.
3. The 3D mapping irregular surface projection method supporting game interaction according to claim 1, characterized in that, The calculation of the depth image vertex indices in the third depth image set using the Delaunay triangulation rule specifically includes: Set the 3D point cloud set S in the depth image to satisfy the condition that three points are not collinear and four points are not concyclic; Choose any point pi, and find the point pj with the shortest edge connecting to that point; Connecting pi respectively pj and pj Extend the right side of pi to obtain the extended point pk, and connect the two newly generated edges pi. pk and pk pj is added to queue Q; The process is repeated until queue Q is empty, at which point the vertex indices of the depth image are obtained.
4. The 3D mapping irregular surface projection method supporting game interaction according to claim 1, characterized in that, After performing optimal difference calculation on the first and second depth compensated images to obtain the third depth image set, the first and second depth compensated images are compared and corrected to correct detail errors in the single-frame depth image.
5. A 3D mapping irregular surface projection system supporting game interaction, characterized in that, It includes an image input module, a mapping module, a primary compensation module, a secondary compensation module, a rendering module, and a replacement module; The image input module is used to input the 3D rendered image output by the rendering plugin in the 3D game program into the trained irregular surface 3D data model; The mapping module is used to convert 3D rendered images into irregularly shaped images; The primary compensation module is used to perform pixel compensation on irregularly shaped images and generate neighborhood compensation pixels after pixel compensation. The secondary compensation module is used to compensate the irregular image again by using neighboring compensation pixels to obtain the compensated irregular image; The rendering module is used to send the compensated irregular image to the rendering plugin and output the rendered irregular image. The replacement module is used to replace the currently rendered image in a 3D game program with a rendered irregular image, thus performing a replacement projection; The process of constructing a 3D data model of an irregular surface: Obtain a first depth image set, perform neighborhood compensation on invalid data in the first depth image set, and obtain a first depth compensated image; A second depth image set is obtained, and neighborhood compensation is performed on invalid data in the second depth image set to obtain a second depth compensated image. The second depth image and the first depth image are different image sets obtained at nearby time points. The optimal difference operation is performed on the first depth-compensated image and the second depth-compensated image to obtain the third depth image set; Transform the depth images in the third depth image set into a 3D point cloud set; The depth image vertex indices in the third depth image set are calculated using the Delaunay triangulation rule. Based on the three-dimensional point cloud set and the vertex index of the depth image, a non-planar three-dimensional data model is calculated and generated.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of classification programs, which are used by a processor to execute the 3D mapping irregular surface projection method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Three-dimensional visualization method based on point cloud and image data and system thereof
CN107194983A
Micro-nano-order binary-plane structural line detection method and system
CN108088386A
